游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

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

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