Skip to content

Commit

Permalink
Merge branch 'master' into patch-voiceless
Browse files Browse the repository at this point in the history
  • Loading branch information
mercury233 committed May 11, 2024
2 parents bb4b2a9 + d18e943 commit abe8dcd
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 27 deletions.
60 changes: 35 additions & 25 deletions BotWrapper/bot.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

!随机-报社
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
6 changes: 6 additions & 0 deletions Dialogs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
}
5 changes: 5 additions & 0 deletions Dialogs/gugugu.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,10 @@
"但我鸽了",
"无此服务",
"可怕"
],
"surrender": [
"太可怕了(跑路",
"这游戏好难玩(跑路",
"还好我不玩游戏王(跑路"
]
}
4 changes: 4 additions & 0 deletions Dialogs/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,9 @@
"我不认同。{0},发动!",
"看样子你忘了我的{0}!",
"你考虑过我有{0}吗?"
],
"surrender": [
"我认输。",
"我承认你的胜利。"
]
}
2 changes: 1 addition & 1 deletion Game/AI/Decks/TearlamentsExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,7 @@ private bool UnderworldGoddessoftheClosedWorldLinkSummon(bool filter = true)
if (Duel.Turn == 1 || Enemy.GetMonsterCount() <= 0) return false;
List<ClientCard> e_cards = Enemy.GetMonsters().Where(card => card != null && card.IsFaceup() && card.IsAttack()).ToList();
List<ClientCard> 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);
Expand Down
11 changes: 11 additions & 0 deletions Game/AI/Dialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -78,6 +81,7 @@ public Dialogs(GameClient game)
_summon = data.summon;
_setmonster = data.setmonster;
_chaining = data.chaining;
_surrender = data.surrender;
_custom = data.custom;
}
}
Expand Down Expand Up @@ -162,10 +166,17 @@ public void SendChaining(string card)
InternalSendMessage(_chaining, card);
}

public void SendSurrender()
{
InternalSendMessage(_surrender);
}

private void InternalSendMessage(IList<string> 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);
Expand Down
3 changes: 2 additions & 1 deletion Game/AI/ExecutorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public enum ExecutorType
SummonOrSet,
GoToBattlePhase,
GoToMainPhase2,
GoToEndPhase
GoToEndPhase,
Surrender
}
}
16 changes: 16 additions & 0 deletions Game/GameAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ public GameAI(GameClient game, Duel duel)
_activatedCards = new Dictionary<int, int>();
}

private void CheckSurrender()
{
foreach (CardExecutor exec in Executor.Executors)
{
if (exec.Type == ExecutorType.Surrender && exec.Func())
{
_dialogs.SendSurrender();
Game.Surrender();
}
}
}

/// <summary>
/// Called when the AI got the error message.
/// </summary>
Expand Down Expand Up @@ -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)
Expand All @@ -130,6 +143,7 @@ public void OnMove(ClientCard card, int previousControler, int previousLocation,
public void OnDirectAttack(ClientCard card)
{
_dialogs.SendOnDirectAttack(card.Name);
CheckSurrender();
}

/// <summary>
Expand All @@ -155,6 +169,7 @@ public void OnChainEnd()
m_selector.Clear();
m_selector_pointer = -1;
Executor.OnChainEnd();
CheckSurrender();
}

/// <summary>
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Game/GameClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit abe8dcd

Please sign in to comment.