游戏王残局简化版

Annotation For script/c0.lua
Login

Annotation For script/c0.lua

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

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