游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

Lines of script/c0.lua from check-in e78ba68423 that are changed by the sequence of edits moving toward check-in 89efe6af3d:

                         1: 
                         2: local str = {}
                         3: 
                         4: local math = math
                         5: local string = string
                         6: local table = table
                         7: 
                         8: _G.fun = {}
                         9: 
                        10: ---------------------------------
                        11: 
                        12: local cache_1
                        13: local cache_2
                        14: local cache_3
                        15: local cache_4
                        16: local cache_5
                        17: local cache_6
                        18: local cache_7
                        19: local cache_8
                        20: local cache_9
                        21: 
                        22: local _
                        23: 
                        24: str["效果卡的种类表"] = {
                        25:   
                        26:   TYPE_SPELL
                        27:   , TYPE_TRAP
                        28:   , TYPE_EFFECT
                        29:   }
                        30:   
                        31: str["无效果灵摆怪兽表"] = {
                        32:   
                        33:   28363749
                        34:   , 19474136
                        35:   , 17390179
                        36:   , 83980492
                        37:   }
                        38:   
                        39: cache_1 = 0
                        40: 
                        41: cache_1 = cache_1 + LOCATION_HAND
                        42: + LOCATION_MZONE
                        43: + LOCATION_SZONE
                        44: + LOCATION_GRAVE
                        45: + LOCATION_REMOVED
                        46: 
                        47: str["除卡组与额外卡组以外的区域"] = cache_1
                        48: 
                        49: cache_1 = cache_1 + LOCATION_DECK
                        50: + LOCATION_EXTRA
                        51: 
                        52: str["所有区域"] = cache_1
                        53: 
                        54: --第一层-------------------------------
                        55: 
                        56: local cache_1
                        57: local cache_2
                        58: local cache_3
                        59: local cache_4
                        60: local cache_5
                        61: local cache_6
                        62: local cache_7
                        63: local cache_8
                        64: local cache_9
                        65: 
                        66: local _
                        67: 
                        68: fun["一_通关邀请"] = function() --{
                        69:   
                        70:   str["效果"] = Effect.GlobalEffect()
                        71:   
                        72:   str["效果"]:SetType(EFFECT_TYPE_FIELD
                        73:   + EFFECT_TYPE_CONTINUOUS)
                        74:   
                        75:   str["效果"]:SetCode(EVENT_DAMAGE)
                        76:   
                        77:   function cache_1() --{
                        78:     
                        79:     cache_1 = Duel.GetLP(1)
                        80:     
                        81:     if cache_1 <= 0 then --{
                        82:       
                        83:       if cache_1 == 0 then --{
                        84:         
                        85:         --}
                        86:         
                        87:       else  --{
                        88:         
                        89:         Debug.ShowHint("QB:「你居然二解了,请加群告诉我怎么二解。」")
                        90:         
                        91:         end --}
                        92:         
                        93:       Debug.ShowHint("残局群181175613")
                        94:       
                        95:       --}
                        96:       
                        97:     else --{
                        98:       
                        99:       return false
                       100:       
                       101:       end --}
                       102:       
                       103:     end --}
                       104:     
                       105:   str["效果"]:SetCondition(cache_1)
                       106:   
                       107:   str["效果"]:SetOperation(aux.NULL)
                       108:   
                       109:   Duel.RegisterEffect(str["效果"]
                       110:   , 0)
                       111:   
                       112:   end --}
                       113:   
                       114: fun["一_是否效果卡"] = function(card) --{
                       115:   
                       116:   for i = 1, #str["效果卡的种类表"] do --{
                       117:     
                       118:     if Card.IsType(card, str["效果卡的种类表"][i]) then --{
                       119:       
                       120:       return true
                       121:       end --}
                       122:       
                       123:     end --}
                       124:     
                       125:   if Card.IsType(card, TYPE_PENDULUM) then --{
                       126:     
                       127:     for i = 1, #str["无效果灵摆怪兽表"] do --{
                       128:       
                       129:       if Card.IsCode(card, str["无效果灵摆怪兽表"][i]) then --{
                       130:         
                       131:         --}
                       132:         
                       133:       else  --{
                       134:         
                       135:         return true
                       136:         
                       137:         end --}
                       138:         
                       139:       end --}
                       140:       
                       141:     end --}
                       142:     
                       143:   return false
                       144:   
                       145:   end --}
                       146:   
                       147: fun["一_开局添加手卡"] = function(str_1) --{
                       148:   
                       149:   str["开局添加手卡的数量"] = str_1
                       150:   
                       151:   str["效果"] = Effect.GlobalEffect()
                       152:   
                       153:   str["效果"]:SetType(EFFECT_TYPE_FIELD
                       154:   + EFFECT_TYPE_CONTINUOUS)
                       155:   
                       156:   str["效果"]:SetCode(EVENT_ADJUST)
                       157:   
                       158:   str["效果"]:SetCondition(aux.TRUE)
                       159:   
                       160:   function cache_1(effect_event
                       161:   , player_who_activate_the_effect) --{
                       162:     
                       163:     str["玩家选定的卡"] = Duel.SelectMatchingCard(player_who_activate_the_effect
                       164:     , Card.IsAbleToHand
                       165:     , player_who_activate_the_effect
                       166:     , LOCATION_DECK
                       167:     , 0
                       168:     , str_1
                       169:     , str_1
                       170:     , nil)
                       171:     
                       172:     Duel.SendtoHand(str["玩家选定的卡"]
                       173:     , nil
                       174:     , REASON_RULE)
                       175:     
                       176:     effect_event:Reset()
                       177:     
                       178:     end --}
                       179:     
                       180:   str["效果"]:SetOperation(cache_1)
                       181:   
                       182:   Duel.RegisterEffect(str["效果"]
                       183:   , 0)
                       184:   
                       185:   end --}
                       186:   
                       187: fun["一_禁格"] = function(str_1) --{
                       188:   
                       189:   str["禁格的数量"] = str_1
                       190:   
                       191:   str["效果"] = Effect.GlobalEffect()
                       192:   
                       193:   str["效果"]:SetCode(EFFECT_USE_EXTRA_MZONE)
                       194:   
                       195:   str["效果"]:SetValue(str_1)
                       196:   
                       197:   Duel.RegisterEffect(str["效果"],0)
                       198:   
                       199:   end --}
                       200: 
                       201: --第二层-------------------------------
                       202: 
                       203: local cache_1
                       204: local cache_2
                       205: local cache_3
                       206: local cache_4
                       207: local cache_5
                       208: local cache_6
                       209: local cache_7
                       210: local cache_8
                       211: local cache_9
                       212: 
                       213: local _
                       214: 
                       215: fun["二_开局说明"] = function() --{
                       216:   
                       217:   str["这个残局的效果卡数量"] = Duel.GetMatchingGroupCount(fun["是否效果卡"]
                       218:   , 0
                       219:   , str["所有区域"]
                       220:   , str["所有区域"]
                       221:   , nil)
                       222:   
                       223:   str["超量素材组"] = Duel.GetOverlayGroup(0
                       224:   , LOCATION_MZONE
                       225:   , LOCATION_MZONE)
                       226:   
                       227:   for k in aux.Next(str["超量素材组"]) do --{
                       228:     
                       229:     if fun["一_是否效果卡"](k) then --{
                       230:       
                       231:       str["这个残局的效果卡数量"] = str["这个残局的效果卡数量"] + 1
                       232:       
                       233:       end --}
                       234:       
                       235:     end --}
                       236:     
                       237:   str["开局说明"] = str["这个残局的效果卡数量"]
                       238:   .. "卡 "
                       239:   .. str["规则"]
                       240:   
                       241:   if str["不洗牌"] == 0 then --{
                       242:     
                       243:     --}
                       244:     
                       245:   else --{
                       246:     
                       247:     str["开局说明"] = str["开局说明"] .. "伪洗牌 "
                       248:     
                       249:     end --}
                       250:     
                       251:   if str["无BP"] == 0 then --{
                       252:     
                       253:     str["开局说明"] = str["开局说明"] .. "无BP "
                       254:     
                       255:     end --}
                       256:     
                       257:   if str["开局添加手卡"] then --{
                       258:     
                       259:     str["开局说明"] = str["开局说明"]
                       260:     .. "选"
                       261:     .. str["开局添加手卡的数量"]
                       262:     .. "卡 "
                       263:     
                       264:     end --}
                       265:     
                       266:   if str["禁格"] then --{
                       267:     
                       268:     str["开局说明"] = str["开局说明"]
                       269:     .. "禁"
                       270:     .. str["禁格的数量"]
                       271:     .. "格 "
                       272:     
                       273:     end --}
                       274:     
                       275:   if str["随机抽卡的数量"] then --{
                       276:     
                       277:     str["开局说明"] = str["开局说明"]
                       278:     .. "抽"
                       279:     .. str["随机抽卡的数量"]
                       280:     .. "卡 "
                       281:     end --}
                       282:     
                       283:   Debug.ShowHint(str["开局说明"])
                       284:   
                       285:   end --}
                       286:   
                       287: --第三层-------------------------------
                       288: 
                       289: local cache_1
                       290: local cache_2
                       291: local cache_3
                       292: local cache_4
                       293: local cache_5
                       294: local cache_6
                       295: local cache_7
                       296: local cache_8
                       297: local cache_9
                       298: 
                       299: local _
                       300: 
                       301: --兼容层-------------------------------
                       302: 
                       303: fun["Debug.ReloadFieldBegin"] = Debug.ReloadFieldBegin
                       304: 
                       305: Debug.ReloadFieldBegin = function(str_1, str_2) --{
                       306:   
                       307:   str["不洗牌"] = str_1 & DUEL_PSEUDO_SHUFFLE
                       308:   
                       309:   str["无BP"] = str_1 & DUEL_ATTACK_FIRST_TURN
                       310:   
                       311:   str["规则表"] = {
                       312:     
                       313:     [3] = "大师3 "
                       314:     , [4] = "新大师 "
                       315:     , [5] = "大师2020 "
                       316:     }
                       317:     
                       318:   if str_2 then --{
                       319:     
                       320:     str["规则"] = str["规则表"][str_2]
                       321:     
                       322:     --}
                       323:     
                       324:   else --{
                       325:     
                       326:     str["规则"] = str["规则表"][5]
                       327:     
                       328:     end --}
                       329:     
                       330:   fun["Debug.ReloadFieldBegin"](str_1, str_2)
                       331:   
                       332:   end --}
                       333:   
                       334: fun["Debug.ReloadFieldEnd"] = Debug.ReloadFieldEnd
                       335: 
                       336: Debug.ReloadFieldEnd = function(str_1) --{
                       337:   
                       338:   fun["Debug.ReloadFieldEnd"]()
                       339:   
                       340:   if str_1 then --{
                       341:     
                       342:     fun["随机抽卡"](str_1)
                       343:     
                       344:     end --}
                       345:     
                       346:   end --}
                       347:   
                       348: fun["aux.BeginPuzzle"] = aux.BeginPuzzle
                       349: 
                       350: aux.BeginPuzzle = function(str_1, str_2) --{
                       351:   
                       352:   fun["aux.BeginPuzzle"]()
                       353:   
                       354:   if str_1 then --{
                       355:     
                       356:     fun["开局添加手卡"](str_1)
                       357:     
                       358:     end --}
                       359:     
                       360:   if str_2 then --{
                       361:     
                       362:     fun["禁格"](str_2)
                       363:     
                       364:     end --}
                       365:     
                       366:   fun["开局说明"]()
                       367:   
                       368:   fun["通关邀请"]()
                       369:   
                       370:   fun["失败得分"]()
                       371:   
                       372:   end --}
                       373:   
                       374: 
                       375:   
                       376: 
e78ba68423 2023-08-02  377:   
                       378: 
e78ba68423 2023-08-02  379:   
e78ba68423 2023-08-02  380: fun["该效果不能被连锁"] = function() --{
e78ba68423 2023-08-02  381:   
e78ba68423 2023-08-02  382:   Duel.SetChainLimit(aux.FALSE)
e78ba68423 2023-08-02  383:   
e78ba68423 2023-08-02  384:   return true
e78ba68423 2023-08-02  385:   end --}
                       386:   
                       387: fun["印卡"] = function(str_1, str_2, str_3) --{
                       388:   
                       389:   if str_3 then --{
                       390:     
                       391:     --}
                       392:     
                       393:   else --{
                       394:     
                       395:     str_3 = str_2
                       396:     
                       397:     end --}
                       398:     
                       399:   Debug.ShowHint("点击对方额外卡组可以进行印卡。\n手卡只能印 "
                       400:   .. str_2
                       401:   .. " 张。\n最多可以印 "
                       402:   .. str_3
                       403:   .. " 张")
                       404:   
                       405:   str["效果"] = Effect.CreateEffect(str_1)
                       406:   
                       407:   str["当前印卡数"] = 1
                       408:   
                       409:   str["效果"]:SetType(EFFECT_TYPE_IGNITION)
                       410:   
                       411:   str["效果"]:SetProperty(EFFECT_FLAG_BOTH_SIDE
                       412:   + EFFECT_FLAG_UNCOPYABLE
                       413:   + EFFECT_FLAG_CANNOT_NEGATE
                       414:   + EFFECT_FLAG_CANNOT_DISABLE)
                       415:   
                       416:   str["效果"]:SetTarget(fun["该效果不能被连锁"])
                       417:   
                       418:   str["效果"]:SetRange(LOCATION_EXTRA)
                       419:   
                       420:   function print_hand(effect_event
                       421:   , player_who_activate_the_effect) --{
                       422:     
                       423:     announce_card = Duel.AnnounceCard(player_who_activate_the_effect)
                       424:     
                       425:     card = Duel.CreateToken(player_who_activate_the_effect
                       426:     , announce_card)
                       427:     
                       428:     if str["当前印卡数"] <= str_2 then --{
                       429:       
                       430:       str["当前印卡数"] = str["当前印卡数"] + 1
                       431:       
                       432:       Duel.SendtoHand(card,nil,REASON_RULE)
                       433:       
                       434:       --}
                       435:       
                       436:     else --{
                       437:       
                       438:       if str["当前印卡数"] <= str_3 then --{
                       439:         
                       440:         str["当前印卡数"] = str["当前印卡数"] + 1
                       441:         
                       442:         Duel.Remove(card,POS_FACEUP,REASON_RULE)
                       443:         
                       444:         Duel.SendtoDeck(card,player_who_activate_the_effect,0,REASON_RULE)
                       445:         
                       446:         --}
                       447:         
                       448:       else --{
                       449:         
                       450:         Debug.ShowHint("印卡过多!")
                       451:         
                       452:         effect_event:Reset()
                       453:         
                       454:         end --}
                       455:         
                       456:       end --}
                       457:       
                       458:     end --}
                       459:     
                       460:   str["效果"]:SetOperation(print_hand)
                       461:   
                       462:   str_1:RegisterEffect(str["效果"])
                       463:   
                       464:   end --}
                       465:   
                       466: fun["随机抽卡"] = function(str_1) --{
                       467:   
                       468:   str["随机抽卡的数量"] = str_1
                       469:   
                       470:   str["效果"] = Effect.GlobalEffect()
                       471:   
                       472:   str["效果"]:SetType(EFFECT_TYPE_FIELD
                       473:   + EFFECT_TYPE_CONTINUOUS)
                       474:   
                       475:   str["效果"]:SetCode(EVENT_ADJUST)
                       476:   
                       477:   str["效果"]:SetCondition(aux.TRUE)
                       478:   
                       479:   function cache_1(effect_event
                       480:   , player_who_activate_the_effect) --{
                       481:     
                       482:     Duel.ShuffleDeck(0)
                       483:     
                       484:     Duel.Draw(0,str_1,REASON_RULE)
                       485:     
                       486:     effect_event:Reset()
                       487:     
                       488:     end --}
                       489:     
                       490:   str["效果"]:SetOperation(cache_1)
                       491:   
                       492:   Duel.RegisterEffect(str["效果"]
                       493:   , 0)
                       494:   
                       495:   end --}
                       496:   
                       497: fun["失败得分"] = function() --{
                       498:   
                       499:   str["失败得分表"] = {
                       500:     
                       501:     [0] = "神龙之圣刻印"
                       502:     , [100] = "调和支援士"
                       503:     , [200] = "深渊的暗杀者"
                       504:     , [300] = "救援猫"
                       505:     , [400] = "注射天使 莉莉"
                       506:     , [500] = "不知火的隐者"
                       507:     , [600] = "影依猎鹰"
                       508:     , [700] = "铁兽战线 姬特"
                       509:     , [800] = "召唤僧"
                       510:     , [900] = "恩底弥翁的仆从"
                       511:     , [1000] = "机壳工具 丑恶"
                       512:     , [1100] = "欧尼斯特"
                       513:     , [1200] = "次元吸引者"
                       514:     , [1300] = "黑羽-疾风之盖尔"
                       515:     , [1400] = "加农炮兵"
                       516:     , [1500] = "教导的大神祗官"
                       517:     , [1600] = "地中族导师"
                       518:     , [1700] = "相剑师-莫邪"
                       519:     , [1800] = "宝玉兽-青玉飞马"
                       520:     , [1900] = "命运英雄 血魔-D"
                       521:     , [2000] = "流离的狮鹫骑手"
                       522:     , [2100] = "电子龙"
                       523:     , [2200] = "古遗物-死镰"
                       524:     , [2300] = "能朋克 调狐"
                       525:     , [2400] = "俱舍怒威族·芬里尔狼"
                       526:     , [2500] = "黑魔术师"
                       527:     , [2600] = "雅典娜"
                       528:     , [2700] = "暗黑界的龙神 格拉法"
                       529:     , [2800] = "魔导兽 刻耳柏洛斯尊主"
                       530:     , [2900] = "元素英雄 永生侠"
                       531:     , [3000] = "青眼白龙"
                       532:     }
                       533:     
                       534:   str["对方玩家的初始生命值"] = Duel.GetLP(1)
                       535:   
                       536:   str["效果"] = Effect.GlobalEffect()
                       537:   
                       538:   str["效果"]:SetType(EFFECT_TYPE_FIELD
                       539:   + EFFECT_TYPE_CONTINUOUS)
                       540:   
                       541:   str["效果"]:SetCode(EVENT_PHASE_START+PHASE_END)
                       542:   
                       543:   function cache_1(effect_event
                       544:   , player_who_activate_the_effect) --{
                       545:     
                       546:     cache_1 = Duel.GetLP(1) - str["对方玩家的初始生命值"]
                       547:     
                       548:     if cache_1 > 0 then --{
                       549:       
                       550:       return
                       551:       
                       552:       --}
                       553:       
                       554:     else --{
                       555:       
                       556:       cache_1 = math.abs(cache_1) / (str["对方玩家的初始生命值"] - 100)
                       557:       
                       558:       cache_1 = math.tointeger(cache_1 * 3000 // 100 * 100)
                       559:       
                       560:       end --}
                       561:       
                       562:     if cache_1 > 3000 then --{
                       563:       
                       564:       --}
                       565:       
                       566:     else --{
                       567:       
                       568:       Debug.ShowHint("这局,您的得分是 "
                       569:       .. cache_1
                       570:       .. " 分!\n处于「"
                       571:       .. str["失败得分表"][cache_1]
                       572:       .. "」级别!")
                       573:       
                       574:       end --}
                       575:       
                       576:     effect_event:Reset()
                       577:     
                       578:     end --}
                       579:     
                       580:   str["效果"]:SetOperation(cache_1)
                       581:   
                       582:   Duel.RegisterEffect(str["效果"]
                       583:   , 0)
                       584:   
                       585:   end --}
                       586: