diff --git a/BotWrapper/bot.conf b/BotWrapper/bot.conf index 66f50839..64a73f6a 100644 --- a/BotWrapper/bot.conf +++ b/BotWrapper/bot.conf @@ -14,9 +14,19 @@ Random=AI_LV2 一些比较弱的卡组。 SUPPORT_MASTER_RULE_2020 -!随机-普通 +!随机-一般 Random=AI_LV3 -一些环境里可以看到的卡组。 +一些不是很弱的卡组。 +SUPPORT_MASTER_RULE_2020 + +!随机-普通 +Random=AI_LV4 +一些可以(或者曾经可以)在竞技环境里看到的卡组。 +SUPPORT_MASTER_RULE_2020 + +!随机-狂野 +Random=AI_WILD +普通的人机的卡组会符合其使用的卡池对应的环境的禁限卡表,但狂野模式的人机的卡组一般不符合任何禁限卡表。 SUPPORT_MASTER_RULE_2020 !随机-报社 @@ -67,17 +77,17 @@ AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 !琪露诺-饼蛙 Name=琪露诺 Deck='Toadally Awesome' Dialog=cirno.zh-CN 大师规则三的全盛饼蛙卡组。 -SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 +AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 !复制植物-青眼 Name=复制植物 Deck=Blue-Eyes Dialog=copy.zh-CN 青眼卡组。 -AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 +AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 !复制植物-十二兽 Name=复制植物 Deck=Zoodiac Dialog=copy.zh-CN 大师规则三的十四兽卡组。 -SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 !尼亚-妖仙兽 Name=尼亚 Deck=Yosenju Dialog=near.zh-CN @@ -92,17 +102,17 @@ AI_ANTI_META SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2 !尼亚-淘气仙星 Name=尼亚 Deck=Trickstar Dialog=near.zh-CN 旧式淘气仙星卡组。 -AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !尼亚-幻变骚灵 Name=尼亚 Deck=Altergeist Dialog=near.zh-CN 幻变骚灵卡组。 -AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !尼亚-拉比林斯迷宫 Name=尼亚 Deck=Labrynth Dialog=near.zh-CN 拉比林斯迷宫卡组。 -AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !复制梁龙-闪刀姬 Name=复制梁龙 Deck=SkyStriker Dialog=anothercopy.zh-CN @@ -112,7 +122,7 @@ AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !复制梁龙-自奏圣乐 Name=复制梁龙 Deck=Orcust Dialog=anothercopy.zh-CN 旧式自奏圣乐卡组。 -AI_LV3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !复制梁龙-转生炎兽 Name=复制梁龙 Deck=Salamangreat Dialog=anothercopy.zh-CN @@ -152,7 +162,7 @@ AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !试作型机器人1732 Name=试作型机器人1732 Deck=ST1732 Dialog=zh-CN 由三盒ST17和三盒SD32组成的卡组。 -AI_LV2 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV1 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !奇異果 Name=奇異果 Deck=LightswornShaddoldinosour Dialog=kiwi.zh-TW @@ -167,7 +177,7 @@ AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !MAX龍果 Name=MAX龍果 Deck=BlueEyesMaxDragon Dialog=kiwi.zh-TW 青眼混沌极龙卡组。 -AI_LV2 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !幻煌果 Name=幻煌果 Deck=Phantasm Dialog=kiwi.zh-TW @@ -187,59 +197,59 @@ AI_ANTI_META SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2 !我太帅了-真红眼龙骑士 Name=我太帅了 Deck=Dragun Dialog=smart.zh-CN 超魔导真红眼龙骑士卡组。 -AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !我太帅了-水百凤凰勇者 Name=我太帅了 Deck=Brave Dialog=smart.zh-CN 水机百头龙凤凰人勇者卡组。 -AI_LV3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_2020 !玻璃女巫-魔女术 Name=玻璃女巫 Deck=Witchcraft Dialog=verre.zh-CN 魔女术卡组。 -AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !玻璃女巫-救祓少女 Name=玻璃女巫 Deck=Exosister Dialog=verre.zh-CN 救祓少女卡组。 -AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 !艾克莉西娅-相剑 Name=艾克莉西娅 Deck=Swordsoul Dialog=ecclesia.zh-CN 相剑卡组。 -AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_3 SUPPORT_MASTER_RULE_2020 !艾克莉西娅-教导 Name=艾克莉西娅 Deck=Dogmatika Dialog=ecclesia.zh-CN 教导卡组。 -AI_LV3 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_3 SUPPORT_NEW_MASTER_RULE SUPPORT_MASTER_RULE_2020 !神数不神-刹帝利 Name=神数不神 Deck=Kashtira Dialog=Zefra.zh-CN 俱舍怒威族卡组。 -AI_LV3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_2020 -![狂野模式]神数不神-雷龙 +![狂野]神数不神-雷龙 Name=神数不神 Deck=ThunderDragon Dialog=Zefra.zh-CN -深渊混沌雷龙卡组。(普通模式的人机的卡组会符合其使用的卡池对应的环境的禁限卡表,但在狂野模式中,人机的卡组不符合任何禁限卡表。) -SUPPORT_MASTER_RULE_2020 +深渊混沌雷龙卡组。 +AI_WILD SUPPORT_MASTER_RULE_2020 !神数不神-珠泪哀歌 Name=神数不神 Deck=Tearlaments Dialog=Zefra.zh-CN 旧式地天使珠泪哀歌族卡组。 -AI_LV3 SUPPORT_MASTER_RULE_2020 +AI_LV4 AI_WILD SUPPORT_MASTER_RULE_2020 !神数不神-神数 Name=神数不神 Deck=Zefra Dialog=Zefra.zh-CN 神数卡组。 -AI_LV3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_2020 !今晚有宵夜吗-超重武者 Name=今晚有宵夜吗 Deck=SuperheavySamurai Dialog=superheavysamurai.zh-CN 超重武者卡组。 -AI_LV3 SUPPORT_MASTER_RULE_2020 +AI_LV4 SUPPORT_MASTER_RULE_2020 !无声的声音-肃声 -Name=今晚有宵夜吗 Deck=Voiceless Dialog=Zefra.zh-CN +Name=无声的声音 Deck=Voiceless Dialog=zh-CN 肃声卡组。 AI_LV3 SUPPORT_MASTER_RULE_2020 diff --git a/Dialogs/default.json b/Dialogs/default.json index 22ff2f28..311558d7 100644 --- a/Dialogs/default.json +++ b/Dialogs/default.json @@ -64,5 +64,11 @@ "Before you do that, I'll chain {0}!", "Nice try, but I have {0}!", "Didn't expect {0}, did you?" + ], + "surrender": [ + "I surrender.", + "You win this time.", + "I can't win this duel.", + "Good game." ] } \ No newline at end of file diff --git a/Dialogs/gugugu.zh-CN.json b/Dialogs/gugugu.zh-CN.json index 5084819d..72d899a3 100644 --- a/Dialogs/gugugu.zh-CN.json +++ b/Dialogs/gugugu.zh-CN.json @@ -55,5 +55,10 @@ "但我鸽了", "无此服务", "可怕" + ], + "surrender": [ + "太可怕了(跑路", + "这游戏好难玩(跑路", + "还好我不玩游戏王(跑路" ] } diff --git a/Dialogs/zh-CN.json b/Dialogs/zh-CN.json index c77ba9d4..4a9d3b92 100644 --- a/Dialogs/zh-CN.json +++ b/Dialogs/zh-CN.json @@ -71,5 +71,9 @@ "我不认同。{0},发动!", "看样子你忘了我的{0}!", "你考虑过我有{0}吗?" + ], + "surrender": [ + "我认输。", + "我承认你的胜利。" ] } diff --git a/Game/AI/Decks/TearlamentsExecutor.cs b/Game/AI/Decks/TearlamentsExecutor.cs index 3641c243..2300de7e 100644 --- a/Game/AI/Decks/TearlamentsExecutor.cs +++ b/Game/AI/Decks/TearlamentsExecutor.cs @@ -1705,7 +1705,7 @@ private bool UnderworldGoddessoftheClosedWorldLinkSummon(bool filter = true) if (Duel.Turn == 1 || Enemy.GetMonsterCount() <= 0) return false; List e_cards = Enemy.GetMonsters().Where(card => card != null && card.IsFaceup() && card.IsAttack()).ToList(); List b_cards = Bot.GetMonsters().Where(card => card != null && card.IsFaceup() && card.IsAttack()).ToList(); - if ((e_cards.Count <= 0 || b_cards.Count <= 0) && Enemy.MonsterZone.GetDangerousMonster() == null) return false; + if (e_cards.Count <= 0 || b_cards.Count <= 0 || Enemy.MonsterZone.GetDangerousMonster() == null) return false; e_cards.Sort(CardContainer.CompareCardAttack); e_cards.Reverse(); b_cards.Sort(CardContainer.CompareCardAttack); diff --git a/Game/AI/Dialogs.cs b/Game/AI/Dialogs.cs index 00835649..8be0c716 100644 --- a/Game/AI/Dialogs.cs +++ b/Game/AI/Dialogs.cs @@ -36,6 +36,8 @@ public class DialogsData [DataMember] public string[] chaining { get; set; } [DataMember] + public string[] surrender { get; set; } + [DataMember] public string[] custom { get; set; } } public class Dialogs @@ -55,6 +57,7 @@ public class Dialogs private string[] _summon; private string[] _setmonster; private string[] _chaining; + private string[] _surrender; private string[] _custom; public Dialogs(GameClient game) @@ -78,6 +81,7 @@ public Dialogs(GameClient game) _summon = data.summon; _setmonster = data.setmonster; _chaining = data.chaining; + _surrender = data.surrender; _custom = data.custom; } } @@ -162,10 +166,17 @@ public void SendChaining(string card) InternalSendMessage(_chaining, card); } + public void SendSurrender() + { + InternalSendMessage(_surrender); + } + private void InternalSendMessage(IList array, params object[] opts) { if (!_game._chat) return; + if (array == null || array.Count == 0) + return; string message = string.Format(array[Program.Rand.Next(array.Count)], opts); if (message != "") _game.Chat(message); diff --git a/Game/AI/ExecutorType.cs b/Game/AI/ExecutorType.cs index 47a557d3..d505f4dc 100644 --- a/Game/AI/ExecutorType.cs +++ b/Game/AI/ExecutorType.cs @@ -11,6 +11,7 @@ public enum ExecutorType SummonOrSet, GoToBattlePhase, GoToMainPhase2, - GoToEndPhase + GoToEndPhase, + Surrender } } \ No newline at end of file diff --git a/Game/GameAI.cs b/Game/GameAI.cs index 77136319..4eda9711 100644 --- a/Game/GameAI.cs +++ b/Game/GameAI.cs @@ -25,6 +25,18 @@ public GameAI(GameClient game, Duel duel) _activatedCards = new Dictionary(); } + private void CheckSurrender() + { + foreach (CardExecutor exec in Executor.Executors) + { + if (exec.Type == ExecutorType.Surrender && exec.Func()) + { + _dialogs.SendSurrender(); + Game.Surrender(); + } + } + } + /// /// Called when the AI got the error message. /// @@ -117,6 +129,7 @@ public void OnNewPhase() _dialogs.SendNewTurn(); } Executor.OnNewPhase(); + CheckSurrender(); } public void OnMove(ClientCard card, int previousControler, int previousLocation, int currentControler, int currentLocation) @@ -130,6 +143,7 @@ public void OnMove(ClientCard card, int previousControler, int previousLocation, public void OnDirectAttack(ClientCard card) { _dialogs.SendOnDirectAttack(card.Name); + CheckSurrender(); } /// @@ -155,6 +169,7 @@ public void OnChainEnd() m_selector.Clear(); m_selector_pointer = -1; Executor.OnChainEnd(); + CheckSurrender(); } /// @@ -422,6 +437,7 @@ public bool OnSelectEffectYn(ClientCard card, int desc) public MainPhaseAction OnSelectIdleCmd(MainPhase main) { Executor.SetMain(main); + CheckSurrender(); foreach (CardExecutor exec in Executor.Executors) { if (exec.Type == ExecutorType.GoToEndPhase && main.CanEndPhase && exec.Func()) // check if should enter end phase directly diff --git a/Game/GameClient.cs b/Game/GameClient.cs index 89e0c5d7..616cac04 100644 --- a/Game/GameClient.cs +++ b/Game/GameClient.cs @@ -90,6 +90,11 @@ public void Chat(string message) Connection.Send(chat); } + public void Surrender() + { + Connection.Send(CtosMessage.Surrender); + } + private void OnPacketReceived(BinaryReader reader) { _behavior.OnPacket(reader);