游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Origin for each line in script/c0.lua from check-in 951ea1b58f:

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