游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Lines of script/c0.lua from check-in 6bc844fccc that are changed by the sequence of edits moving toward check-in 091f486d37:

                         1: local str = {}
                         2: local string = string
                         3: local table = table
                         4: local s = {}
                         5: _G.fun = {}
                         6: str["效果卡的种类表"] = {
                         7:   TYPE_SPELL,
                         8:   TYPE_TRAP,
                         9:   TYPE_EFFECT,
                        10: }
                        11: str["无效果灵摆怪兽表"] = {
                        12:   28363749,
                        13:   19474136,
                        14:   17390179,
                        15:   83980492,
                        16: }
                        17: local h1
                        18: --~ 区域
                        19: h1 = LOCATION_HAND + LOCATION_MZONE + LOCATION_SZONE + LOCATION_GRAVE + LOCATION_REMOVED
                        20: str["除卡组与额外卡组以外的区域"] = h1
                        21: h1 = h1 + LOCATION_DECK + LOCATION_EXTRA
                        22: str["所有区域"] = h1
                        23: --第一层-------------------------------
                        24: local cache_1
                        25: local cache_2
                        26: local cache_3
                        27: local cache_4
                        28: local cache_5
                        29: local cache_6
                        30: local cache_7
                        31: local cache_8
                        32: local cache_9
                        33: local _
                        34: fun["Debug.ReloadFieldBegin"] = Debug.ReloadFieldBegin
                        35: Debug.ReloadFieldBegin = function(u1, u2)
                        36:   str["不洗牌"] = u1 & DUEL_PSEUDO_SHUFFLE
                        37:   str["无BP"] = u1 & DUEL_ATTACK_FIRST_TURN
                        38:   str["无AI"] = u1 & DUEL_SIMPLE_AI
                        39:   str["规则表"] = {
                        40:     [3] = "大师3 ",
                        41:     [4] = "新大师 ",
                        42:     [5] = "大师2020 ",
                        43:   }
                        44:   if u2 then
                        45:     str["规则"] = str["规则表"][u2]
                        46:   else
                        47:     str["规则"] = str["规则表"][5]
                        48:   end
                        49:   fun["Debug.ReloadFieldBegin"](u1, u2)
                        50: end
6bc844fccc 2024-02-13   51: fun["一_随机抽卡"] = function(u1)
                        52:   local h1, h2
                        53:   str["随机抽卡的数量"] = u1
                        54:   --~ 效果
                        55:   h1 = Effect.GlobalEffect()
                        56:   h1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                        57:   h1:SetCode(EVENT_ADJUST)
                        58:   h1:SetCondition(aux.TRUE)
                        59:   -- 随机抽卡
                        60:   --~ 调该效果的效果
                        61:   function h2(u2)
                        62:     Duel.ShuffleDeck(0)
                        63:     Duel.Draw(0, u1, REASON_RULE)
                        64:     u2:Reset()
                        65:     end
                        66:   h1:SetOperation(h2)
                        67:   Duel.RegisterEffect(h1, 0)
                        68:   end
                        69: fun["一_该效果不能被连锁"] = function()
                        70:   Duel.SetChainLimit(aux.FALSE)
                        71:   return true
                        72:   end
                        73: do
                        74:   local h1, h2
                        75:   --~ 原解邀请
                        76:   h1 = "残局群181175613"
                        77:   --~ 二解邀请,备用:圣魔术师
                        78:   h2 = "爆貘团:「你居然二解了,请加群告诉我怎么二解。」"
                        79:   function s["通关之邀"]()
                        80:     local h3, h4
                        81:     --~ 效果
                        82:     h3 = Effect.GlobalEffect()
                        83:     h3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                        84:     h3:SetCode(EVENT_DAMAGE)
                        85:     --~ 通关之邀
                        86:     function h4()
                        87:       local h5
                        88:       --~ 对方之血
                        89:       h5 = Duel.GetLP(1)
                        90:       if h5 <= 0 then
                        91:         if h5 == 0 then
                        92:           Debug.ShowHint(h1)
                        93:         else
                        94:           Debug.ShowHint(h2)
                        95:           end
                        96:       else
                        97:         return false
                        98:         end
                        99:       end
                       100:     h3:SetCondition(h4)
                       101:     h3:SetOperation(aux.NULL)
                       102:     Duel.RegisterEffect(h3, 0)
                       103:     end
                       104:   end
                       105: fun["一_是否效果卡"] = function(card)
                       106:   for i = 1, #str["效果卡的种类表"] do
                       107:     if Card.IsType(card, str["效果卡的种类表"][i]) then
                       108:       return true
                       109:     end
                       110:   end
                       111:   if Card.IsType(card, TYPE_PENDULUM) then
                       112:     for i = 1, #str["无效果灵摆怪兽表"] do
                       113:       if Card.IsCode(card, str["无效果灵摆怪兽表"][i]) then
                       114:       else
                       115:         return true
                       116:       end
                       117:     end
                       118:   end
                       119: end
                       120: fun["一_开局添加手卡"] = function(u1)
                       121:   str["开局添加手卡"] = true
                       122:   str["开局添加手卡的数量"] = u1
                       123:   str["效果"] = Effect.GlobalEffect()
                       124:   str["效果"]:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
                       125:   str["效果"]:SetCode(EVENT_ADJUST)
                       126:   str["效果"]:SetCondition(aux.TRUE)
                       127:   function cache_1(effect_event, player_who_activate_the_effect)
                       128:     str["玩家选定的卡"] = Duel.SelectMatchingCard(
                       129:       player_who_activate_the_effect,
                       130:       Card.IsAbleToHand,
                       131:       player_who_activate_the_effect,
                       132:       LOCATION_DECK,
                       133:       0,
                       134:       u1,
                       135:       u1,
                       136:       nil
                       137:     )
                       138:     Duel.SendtoHand(str["玩家选定的卡"], nil, REASON_RULE)
                       139:     effect_event:Reset()
                       140:   end
                       141:   str["效果"]:SetOperation(cache_1)
                       142:   Duel.RegisterEffect(str["效果"], 0)
                       143: end
                       144: fun["一_禁格"] = function(u1)
                       145:   local h1
                       146:   str["禁格"] = true
                       147:   str["禁格的数量"] = u1
                       148:   --~ 效果
                       149:   h1 = Effect.GlobalEffect()
                       150:   h1:SetCode(EFFECT_USE_EXTRA_MZONE)
                       151:   h1:SetValue(u1)
                       152:   Duel.RegisterEffect(h1, 0)
                       153:   end
                       154: --第二层-------------------------------
                       155: local cache_1
                       156: local cache_2
                       157: local cache_3
                       158: local cache_4
                       159: local cache_5
                       160: local cache_6
                       161: local cache_7
                       162: local cache_8
                       163: local cache_9
                       164: local _
                       165: fun["Debug.ReloadFieldEnd"] = Debug.ReloadFieldEnd
                       166: Debug.ReloadFieldEnd = function(u1)
                       167:   fun["Debug.ReloadFieldEnd"]()
                       168:   if u1 then
6bc844fccc 2024-02-13  169:     fun["一_随机抽卡"](u1)
                       170:     end
                       171:   end
                       172: fun["二_印卡"] = function(u1, u2, u3)
                       173:   u3 = u3 or u2
                       174:   Debug.ShowHint(
                       175:     "点击对方额外卡组可以进行印卡。\n手卡只能印 "
                       176:       .. u2
                       177:       .. " 张。\n最多可以印 "
                       178:       .. u3
                       179:       .. " 张"
                       180:   )
                       181:   str["效果"] = Effect.CreateEffect(u1)
                       182:   str["当前印卡数"] = 1
                       183:   str["效果"]:SetType(EFFECT_TYPE_IGNITION)
                       184:   str["效果"]:SetProperty(
                       185:     EFFECT_FLAG_BOTH_SIDE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_CANNOT_NEGATE + EFFECT_FLAG_CANNOT_DISABLE
                       186:   )
                       187:   str["效果"]:SetTarget(fun["一_该效果不能被连锁"])
                       188:   str["效果"]:SetRange(LOCATION_EXTRA)
                       189:   function print_hand(effect_event, player_who_activate_the_effect)
                       190:     announce_card = Duel.AnnounceCard(player_who_activate_the_effect)
                       191:     card = Duel.CreateToken(player_who_activate_the_effect, announce_card)
                       192:     if str["当前印卡数"] <= u2 then
                       193:       str["当前印卡数"] = str["当前印卡数"] + 1
                       194:       Duel.SendtoHand(card, nil, REASON_RULE)
                       195:     else
                       196:       if str["当前印卡数"] <= u3 then
                       197:         str["当前印卡数"] = str["当前印卡数"] + 1
                       198:         Duel.Remove(card, POS_FACEUP, REASON_RULE)
                       199:         Duel.SendtoDeck(card, player_who_activate_the_effect, 0, REASON_RULE)
                       200:       else
                       201:         Debug.ShowHint("印卡过多!")
                       202:         effect_event:Reset()
                       203:       end
                       204:     end
                       205:   end
                       206:   str["效果"]:SetOperation(print_hand)
                       207:   u1:RegisterEffect(str["效果"])
                       208: end
                       209: fun["二_开局说明"] = function()
                       210:   str["这个残局的效果卡数量"] =
                       211:     Duel.GetMatchingGroupCount(fun["是否效果卡"], 0, str["所有区域"], str["所有区域"], nil)
                       212:   str["超量素材组"] = Duel.GetOverlayGroup(0, LOCATION_MZONE, LOCATION_MZONE)
                       213:   for k in aux.Next(str["超量素材组"]) do
                       214:     if fun["一_是否效果卡"](k) then
                       215:       str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + 1
                       216:     end
6bc844fccc 2024-02-13  217:   end
6bc844fccc 2024-02-13  218:   str["开局说明"] = str["这个残局的效果卡数量"] .. "卡 " .. str["规则"]
                       219:   if str["不洗牌"] == 0 then
                       220:   else
6bc844fccc 2024-02-13  221:     str["开局说明"] = str["开局说明"] .. "伪洗牌 "
6bc844fccc 2024-02-13  222:   end
                       223:   if str["无BP"] == 0 then
6bc844fccc 2024-02-13  224:     str["开局说明"] = str["开局说明"] .. "无BP "
6bc844fccc 2024-02-13  225:   end
                       226:   if str["无AI"] == 0 then
6bc844fccc 2024-02-13  227:     str["开局说明"] = str["开局说明"] .. "无AI "
6bc844fccc 2024-02-13  228:   end
                       229:   if str["开局添加手卡"] then
6bc844fccc 2024-02-13  230:     str["开局说明"] = str["开局说明"] .. "选" .. str["开局添加手卡的数量"] .. "卡 "
6bc844fccc 2024-02-13  231:   end
                       232:   if str["禁格"] then
6bc844fccc 2024-02-13  233:     str["开局说明"] = str["开局说明"] .. "禁" .. str["禁格的数量"] .. "格 "
6bc844fccc 2024-02-13  234:   end
                       235:   if str["随机抽卡的数量"] then
6bc844fccc 2024-02-13  236:     str["开局说明"] = str["开局说明"] .. "抽" .. str["随机抽卡的数量"] .. "卡 "
                       237:   end
6bc844fccc 2024-02-13  238:   Debug.ShowHint(str["开局说明"])
6bc844fccc 2024-02-13  239: end
                       240: fun["aux.BeginPuzzle"] = aux.BeginPuzzle
                       241: aux.BeginPuzzle = function(u1, u2)
                       242:   fun["aux.BeginPuzzle"]()
                       243:   if u1 then
                       244:     fun["一_开局添加手卡"](u1)
                       245:   end
                       246:   if u2 then
                       247:     fun["一_禁格"](u2)
                       248:   end
                       249:   fun["二_开局说明"]()
                       250:   s["通关之邀"]()
                       251: end
                       252: --兼容层-------------------------------
                       253: fun["印卡"] = fun["二_印卡"]
                       254: fun["开局添加手卡"] = fun["一_开局添加手卡"]
                       255: fun["是否效果卡"] = fun["一_是否效果卡"]
                       256: fun["禁格"] = fun["一_禁格"]
6bc844fccc 2024-02-13  257: fun["随机抽卡"] = fun["一_随机抽卡"]