游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Lines of script/c0.lua from check-in 46bd1a8cd5 that are changed by the sequence of edits moving toward check-in f56b114da9:

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