Commit 250d2b3b authored by mercury233's avatar mercury233

update and fix ai

parent 041d9adc
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
80280737 80280737
#extra #extra
99267150 99267150
99267150 50954680
99267150 50954680
76774528 76774528
76774528 76774528
76774528 76774528
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
45082499 45082499
33911264 33911264
33911264 33911264
33911264
65367484 65367484
65367484 65367484
24610207 24610207
...@@ -15,6 +14,7 @@ ...@@ -15,6 +14,7 @@
24610207 24610207
30914564 30914564
30914564 30914564
30914564
25259669 25259669
25259669 25259669
25259669 25259669
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
94656263 94656263
94656263 94656263
94656263 94656263
34143852 40941889
34143852 18063928
34143852
18063928 18063928
18063928 18063928
423585 423585
...@@ -36,24 +35,39 @@ ...@@ -36,24 +35,39 @@
53129443 53129443
5318639 5318639
5318639 5318639
78474168 11705261
78474168 11705261
78474168 11705261
40605147
84749824 84749824
#extra #extra
45231177 45231177
45231177
17881964 17881964
17881964 17881964
91949988 91949988
60992364 60992364
60992364 56832966
94119480 56832966
56832966
29669359 29669359
71594310 86532744
86532744
86532744
84013237 84013237
84013237 84013237
84013237 84013237
!side
33911264
34143852
34143852
34143852
45231177
60992364
94119480
29669359
71594310
25341652 25341652
12014404 12014404
!side 78474168
78474168
78474168
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"duelstart": [ "duelstart": [
"青眼卡组测试中,渣操是正常情况。", "青眼卡组测试中,渣操是正常情况。",
"超主流是游戏王的一环,不爽不要玩。", "超主流是游戏王的一环,不爽不要玩。",
"抄主流是游戏王的一环,不爽不要玩。",
"抄来的卡组不会用,怎么办?" "抄来的卡组不会用,怎么办?"
], ],
"newturn": [ "newturn": [
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"welcome": [ "welcome": [
"你好,我是一个机器人。", "你好,我是一个机器人。",
"AI功能正在测试中,遇到问题请及时反馈。", "AI功能正在测试中,遇到问题请及时反馈。",
"不要再幻想我会进化成LV6了。不过听说过几天会出现比我强的家伙。" "新的风暴已经出现,怎么能够停滞不前!我的希望皇卡组和龙骑星爆卡组都得到了加强!"
], ],
"duelstart": [ "duelstart": [
"好戏才正要开始呢!", "好戏才正要开始呢!",
......
...@@ -45,6 +45,7 @@ namespace MycardBot.Game.AI.Decks ...@@ -45,6 +45,7 @@ namespace MycardBot.Game.AI.Decks
private List<ClientCard> 使用过的青眼亚白龙 = new List<ClientCard>(); private List<ClientCard> 使用过的青眼亚白龙 = new List<ClientCard>();
ClientCard 使用过的光波龙; ClientCard 使用过的光波龙;
bool 已特殊召唤青眼亚白龙 = false;
public BlueEyesExecutor(GameAI ai, Duel duel) public BlueEyesExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
...@@ -69,7 +70,7 @@ namespace MycardBot.Game.AI.Decks ...@@ -69,7 +70,7 @@ namespace MycardBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, (int)CardId.强欲而贪欲之壶, 强欲而贪欲之壶效果); AddExecutor(ExecutorType.Activate, (int)CardId.强欲而贪欲之壶, 强欲而贪欲之壶效果);
// 有亚白就跳 // 有亚白就跳
AddExecutor(ExecutorType.SpSummon, (int)CardId.青眼亚白龙); AddExecutor(ExecutorType.SpSummon, (int)CardId.青眼亚白龙, 青眼亚白龙特殊召唤);
// 苏生 // 苏生
AddExecutor(ExecutorType.Activate, (int)CardId.复活之福音, 死者苏生效果); AddExecutor(ExecutorType.Activate, (int)CardId.复活之福音, 死者苏生效果);
...@@ -106,22 +107,25 @@ namespace MycardBot.Game.AI.Decks ...@@ -106,22 +107,25 @@ namespace MycardBot.Game.AI.Decks
// 没别的可干 // 没别的可干
AddExecutor(ExecutorType.Repos, 改变攻守表示); AddExecutor(ExecutorType.Repos, 改变攻守表示);
AddExecutor(ExecutorType.MonsterSet, (int)CardId.太古的白石); // 优先盖传说白石以期望拿到白龙打开局面
AddExecutor(ExecutorType.MonsterSet, (int)CardId.传说的白石); AddExecutor(ExecutorType.MonsterSet, (int)CardId.传说的白石);
AddExecutor(ExecutorType.MonsterSet, (int)CardId.太古的白石);
AddExecutor(ExecutorType.SpellSet, 盖卡); AddExecutor(ExecutorType.SpellSet, 盖卡);
} }
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
// // 随机先后
return false; return Program.Rand.Next(2) > 0;
} }
public override void OnNewTurn() public override void OnNewTurn()
{ {
// 回合开始时重置亚白龙状况 // 回合开始时重置状况
使用过的青眼亚白龙.Clear(); 使用过的青眼亚白龙.Clear();
使用过的光波龙 = null;
已特殊召唤青眼亚白龙 = false;
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, bool cancelable)
...@@ -542,6 +546,19 @@ namespace MycardBot.Game.AI.Decks ...@@ -542,6 +546,19 @@ namespace MycardBot.Game.AI.Decks
if (ActivateDescription == AI.Utils.GetStringId((int)CardId.太古的白石, 0)) if (ActivateDescription == AI.Utils.GetStringId((int)CardId.太古的白石, 0))
{ {
Logger.WriteLine("太古白石回收效果."); Logger.WriteLine("太古白石回收效果.");
if (Duel.Fields[0].HasInHand((int)CardId.抵价购物)
&& !Duel.Fields[0].HasInHand((int)CardId.青眼白龙)
&& !Duel.Fields[0].HasInHand((int)CardId.青眼亚白龙))
{
Logger.WriteLine("回收喂八抽.");
AI.SelectCard((int)CardId.青眼白龙);
return true;
}
if (已特殊召唤青眼亚白龙)
{
Logger.WriteLine("已经跳过亚白龙,下回合再回收.");
return false;
}
if (Duel.Fields[0].HasInHand((int)CardId.青眼白龙) if (Duel.Fields[0].HasInHand((int)CardId.青眼白龙)
&& !Duel.Fields[0].HasInHand((int)CardId.青眼亚白龙) && !Duel.Fields[0].HasInHand((int)CardId.青眼亚白龙)
&& Duel.Fields[0].HasInGraveyard((int)CardId.青眼亚白龙)) && Duel.Fields[0].HasInGraveyard((int)CardId.青眼亚白龙))
...@@ -558,14 +575,6 @@ namespace MycardBot.Game.AI.Decks ...@@ -558,14 +575,6 @@ namespace MycardBot.Game.AI.Decks
AI.SelectCard((int)CardId.青眼白龙); AI.SelectCard((int)CardId.青眼白龙);
return true; return true;
} }
if (Duel.Fields[0].HasInHand((int)CardId.抵价购物)
&& !Duel.Fields[0].HasInHand((int)CardId.青眼白龙)
&& !Duel.Fields[0].HasInHand((int)CardId.青眼亚白龙))
{
Logger.WriteLine("回收喂八抽.");
AI.SelectCard((int)CardId.青眼白龙);
return true;
}
Logger.WriteLine("并没有应该回收的."); Logger.WriteLine("并没有应该回收的.");
return false; return false;
} }
...@@ -588,6 +597,12 @@ namespace MycardBot.Game.AI.Decks ...@@ -588,6 +597,12 @@ namespace MycardBot.Game.AI.Decks
} }
} }
private bool 青眼亚白龙特殊召唤()
{
已特殊召唤青眼亚白龙 = true;
return true;
}
private bool 太古的白石通常召唤() private bool 太古的白石通常召唤()
{ {
Logger.WriteLine("白石通常召唤."); Logger.WriteLine("白石通常召唤.");
......
namespace WindBot.Game.AI.Decks
{
[Deck("Test", "AI_Test")]
public class DoEverythingExecutor : DefaultExecutor
{
public enum CardId
{
LeoWizard = 4392470,
Bunilla = 69380702
}
public DoEverythingExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, DontChainMyself);
AddExecutor(ExecutorType.SummonOrSet);
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet);
}
private bool DontChainMyself()
{
return LastChainPlayer != 0;
}
}
}
\ No newline at end of file
...@@ -31,6 +31,7 @@ namespace DevBot.Game.AI.Decks ...@@ -31,6 +31,7 @@ namespace DevBot.Game.AI.Decks
DimensionalPrison = 70342110, DimensionalPrison = 70342110,
AssaultModeActivate = 80280737, AssaultModeActivate = 80280737,
FiveHeadedDragon = 99267150, FiveHeadedDragon = 99267150,
CrystalWingSynchroDragon = 50954680,
ScrapDragon = 76774528, ScrapDragon = 76774528,
StardustDragon = 44508094, StardustDragon = 44508094,
DragunityKnightGaeDearg = 34116027, DragunityKnightGaeDearg = 34116027,
...@@ -54,6 +55,7 @@ namespace DevBot.Game.AI.Decks ...@@ -54,6 +55,7 @@ namespace DevBot.Game.AI.Decks
// Execute monsters // Execute monsters
AddExecutor(ExecutorType.Activate, (int)CardId.ScrapDragon, ScrapDragonEffect); AddExecutor(ExecutorType.Activate, (int)CardId.ScrapDragon, ScrapDragonEffect);
AddExecutor(ExecutorType.Activate, (int)CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragonEffect);
AddExecutor(ExecutorType.Activate, (int)CardId.DragunityPhalanx); AddExecutor(ExecutorType.Activate, (int)CardId.DragunityPhalanx);
AddExecutor(ExecutorType.Activate, (int)CardId.DragunityKnightVajrayana); AddExecutor(ExecutorType.Activate, (int)CardId.DragunityKnightVajrayana);
AddExecutor(ExecutorType.Activate, (int)CardId.DragunityArmaMysletainn); AddExecutor(ExecutorType.Activate, (int)CardId.DragunityArmaMysletainn);
...@@ -62,6 +64,7 @@ namespace DevBot.Game.AI.Decks ...@@ -62,6 +64,7 @@ namespace DevBot.Game.AI.Decks
// Summon // Summon
AddExecutor(ExecutorType.Activate, (int)CardId.DragonsMirror, DragonsMirror); AddExecutor(ExecutorType.Activate, (int)CardId.DragonsMirror, DragonsMirror);
AddExecutor(ExecutorType.SpSummon, (int)CardId.ScrapDragon, ScrapDragonSummon); AddExecutor(ExecutorType.SpSummon, (int)CardId.ScrapDragon, ScrapDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragonSummon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.StardustDragon); AddExecutor(ExecutorType.SpSummon, (int)CardId.StardustDragon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityKnightVajrayana); AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityKnightVajrayana);
AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityKnightGaeDearg); AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityKnightGaeDearg);
...@@ -157,7 +160,7 @@ namespace DevBot.Game.AI.Decks ...@@ -157,7 +160,7 @@ namespace DevBot.Game.AI.Decks
needId = (int)CardId.DragunityDux; needId = (int)CardId.DragunityDux;
else else
{ {
bool hasRealMonster = false; /*bool hasRealMonster = false;
foreach (ClientCard card in field.GetMonsters()) foreach (ClientCard card in field.GetMonsters())
{ {
if (card.Id != (int)CardId.AssaultBeast) if (card.Id != (int)CardId.AssaultBeast)
...@@ -166,7 +169,7 @@ namespace DevBot.Game.AI.Decks ...@@ -166,7 +169,7 @@ namespace DevBot.Game.AI.Decks
break; break;
} }
} }
if (!hasRealMonster || GetProblematicCard() != null) if (!hasRealMonster || GetProblematicCard() != null)*/
needId = (int)CardId.DragunityDux; needId = (int)CardId.DragunityDux;
} }
...@@ -338,8 +341,8 @@ namespace DevBot.Game.AI.Decks ...@@ -338,8 +341,8 @@ namespace DevBot.Game.AI.Decks
private bool ScrapDragonSummon() private bool ScrapDragonSummon()
{ {
if (AI.Utils.IsOneEnnemyBetterThanValue(2500, true)) //if (AI.Utils.IsOneEnnemyBetterThanValue(2500, true))
return true; // return true;
ClientCard invincible = GetProblematicCard(); ClientCard invincible = GetProblematicCard();
return invincible != null; return invincible != null;
} }
...@@ -395,6 +398,18 @@ namespace DevBot.Game.AI.Decks ...@@ -395,6 +398,18 @@ namespace DevBot.Game.AI.Decks
return true; return true;
} }
private bool CrystalWingSynchroDragonSummon()
{
return !Duel.Fields[0].HasInHand((int)CardId.AssaultModeActivate)
&& !Duel.Fields[0].HasInHand((int)CardId.AssaultBeast)
&& !Duel.Fields[0].HasInSpellZone((int)CardId.AssaultModeActivate);
}
private bool CrystalWingSynchroDragonEffect()
{
return LastChainPlayer != 0;
}
private bool DragunityPhalanxSummon() private bool DragunityPhalanxSummon()
{ {
return Duel.Fields[0].HasInHand((int)CardId.DragunityArmaMysletainn); return Duel.Fields[0].HasInHand((int)CardId.DragunityArmaMysletainn);
......
...@@ -13,6 +13,7 @@ namespace DevBot.Game.AI.Decks ...@@ -13,6 +13,7 @@ namespace DevBot.Game.AI.Decks
CyberDragon = 70095155, CyberDragon = 70095155,
ZwTornadoBringer = 81471108, ZwTornadoBringer = 81471108,
ZwLightningBlade = 45082499, ZwLightningBlade = 45082499,
ZwAsuraStrike = 40941889,
SolarWindJammer = 33911264, SolarWindJammer = 33911264,
PhotonTrasher = 65367484, PhotonTrasher = 65367484,
StarDrawing = 24610207, StarDrawing = 24610207,
...@@ -30,6 +31,8 @@ namespace DevBot.Game.AI.Decks ...@@ -30,6 +31,8 @@ namespace DevBot.Game.AI.Decks
MysticalSpaceTyphoon = 5318639, MysticalSpaceTyphoon = 5318639,
BreakthroughSkill = 78474168, BreakthroughSkill = 78474168,
SolemnWarning = 84749824, SolemnWarning = 84749824,
SolemnStrike = 40605147,
XyzChangeTactics = 11705261,
FlameSwordsman = 45231177, FlameSwordsman = 45231177,
DarkfireDragon = 17881964, DarkfireDragon = 17881964,
...@@ -39,6 +42,8 @@ namespace DevBot.Game.AI.Decks ...@@ -39,6 +42,8 @@ namespace DevBot.Game.AI.Decks
Number61Volcasaurus = 29669359, Number61Volcasaurus = 29669359,
GemKnightPearl = 71594310, GemKnightPearl = 71594310,
Number39Utopia = 84013237, Number39Utopia = 84013237,
NumberS39UtopiaOne= 86532744,
NumberS39UtopiatheLightning = 56832966,
MaestrokeTheSymphonyDjinn = 25341652, MaestrokeTheSymphonyDjinn = 25341652,
GagagaCowboy = 12014404 GagagaCowboy = 12014404
} }
...@@ -49,26 +54,36 @@ namespace DevBot.Game.AI.Decks ...@@ -49,26 +54,36 @@ namespace DevBot.Game.AI.Decks
// Quick spells // Quick spells
AddExecutor(ExecutorType.Activate, (int)CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon); AddExecutor(ExecutorType.Activate, (int)CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
// Spell cards
AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, (int)CardId.ReinforcementOfTheArmy, ReinforcementOfTheArmy);
AddExecutor(ExecutorType.Activate, (int)CardId.XyzChangeTactics);
// XYZ summons // XYZ summons
AddExecutor(ExecutorType.SpSummon, (int)CardId.Number39Utopia); AddExecutor(ExecutorType.SpSummon, (int)CardId.Number39Utopia);
AddExecutor(ExecutorType.SpSummon, (int)CardId.NumberS39UtopiaOne);
AddExecutor(ExecutorType.SpSummon, (int)CardId.NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.SpSummon, (int)CardId.Number61Volcasaurus, Number61Volcasaurus);
AddExecutor(ExecutorType.SpSummon, (int)CardId.ZwLionArms); AddExecutor(ExecutorType.SpSummon, (int)CardId.ZwLionArms);
AddExecutor(ExecutorType.SpSummon, (int)CardId.AdreusKeeperOfArmageddon); AddExecutor(ExecutorType.SpSummon, (int)CardId.AdreusKeeperOfArmageddon);
AddExecutor(ExecutorType.SpSummon, (int)CardId.Number61Volcasaurus);
// XYZ effects // XYZ effects
AddExecutor(ExecutorType.Activate, (int)CardId.Number39Utopia, Number39Utopia); AddExecutor(ExecutorType.Activate, (int)CardId.Number39Utopia, Number39Utopia);
AddExecutor(ExecutorType.Activate, (int)CardId.NumberS39UtopiaOne);
AddExecutor(ExecutorType.Activate, (int)CardId.NumberS39UtopiatheLightning, NumberS39UtopiatheLightning);
AddExecutor(ExecutorType.Activate, (int)CardId.ZwLionArms, ZwLionArms); AddExecutor(ExecutorType.Activate, (int)CardId.ZwLionArms, ZwLionArms);
AddExecutor(ExecutorType.Activate, (int)CardId.AdreusKeeperOfArmageddon); AddExecutor(ExecutorType.Activate, (int)CardId.AdreusKeeperOfArmageddon);
AddExecutor(ExecutorType.Activate, (int)CardId.Number61Volcasaurus); AddExecutor(ExecutorType.Activate, (int)CardId.Number61Volcasaurus);
// Spummon GaiaDragonTheThunderCharger if Volcasaurus or ZwLionArms had been used
AddExecutor(ExecutorType.SpSummon, (int)CardId.GaiaDragonTheThunderCharger);
// Weapons // Weapons
AddExecutor(ExecutorType.Activate, (int)CardId.ZwTornadoBringer); AddExecutor(ExecutorType.Activate, (int)CardId.ZwTornadoBringer);
AddExecutor(ExecutorType.Activate, (int)CardId.ZwLightningBlade); AddExecutor(ExecutorType.Activate, (int)CardId.ZwLightningBlade);
AddExecutor(ExecutorType.Activate, (int)CardId.ZwAsuraStrike);
// Spell cards
AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
AddExecutor(ExecutorType.Activate, (int)CardId.ReinforcementOfTheArmy, ReinforcementOfTheArmy);
// Special summons // Special summons
AddExecutor(ExecutorType.SpSummon, (int)CardId.PhotonTrasher); AddExecutor(ExecutorType.SpSummon, (int)CardId.PhotonTrasher);
...@@ -92,15 +107,17 @@ namespace DevBot.Game.AI.Decks ...@@ -92,15 +107,17 @@ namespace DevBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, (int)CardId.TinGoldfish, GoblindberghEffect); AddExecutor(ExecutorType.Activate, (int)CardId.TinGoldfish, GoblindberghEffect);
AddExecutor(ExecutorType.Activate, (int)CardId.Kagetokage); AddExecutor(ExecutorType.Activate, (int)CardId.Kagetokage);
AddExecutor(ExecutorType.Activate, (int)CardId.SummonerMonk, SummonerMonkEffect); AddExecutor(ExecutorType.Activate, (int)CardId.SummonerMonk, SummonerMonkEffect);
AddExecutor(ExecutorType.Activate, (int)CardId.Honest, Honest);
// Reposition // Reposition
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, MonsterRepos);
// Set and activate traps // Set and activate traps
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet); AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.Activate, (int)CardId.BreakthroughSkill, BreakthroughSkill); AddExecutor(ExecutorType.Activate, (int)CardId.BreakthroughSkill, BreakthroughSkill);
AddExecutor(ExecutorType.Activate, (int)CardId.SolemnWarning, DefaultTrap); AddExecutor(ExecutorType.Activate, (int)CardId.SolemnWarning, DefaultTrap);
AddExecutor(ExecutorType.Activate, (int)CardId.SolemnStrike, DefaultTrap);
} }
public override bool OnSelectHand() public override bool OnSelectHand()
...@@ -108,6 +125,23 @@ namespace DevBot.Game.AI.Decks ...@@ -108,6 +125,23 @@ namespace DevBot.Game.AI.Decks
return false; return false;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (defender.IsMonsterInvincible())
{
if (defender.IsMonsterDangerous() || defender.IsDefense())
return false;
}
if (!(defender.Id == (int)CardId.NumberS39UtopiatheLightning))
{
if (attacker.Attribute == (int)CardAttribute.Light && Duel.Fields[0].HasInHand((int)CardId.Honest))
attacker.RealPower = attacker.RealPower + defender.Attack;
if (attacker.Id == (int)CardId.NumberS39UtopiatheLightning && !attacker.IsDisabled())
attacker.RealPower = 5000;
}
return attacker.RealPower > defender.GetDefensePower();
}
private bool Number39Utopia() private bool Number39Utopia()
{ {
if (!HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.Overlays.Count > 1) if (!HasChainedTrap(0) && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Card.Overlays.Count > 1)
...@@ -115,6 +149,11 @@ namespace DevBot.Game.AI.Decks ...@@ -115,6 +149,11 @@ namespace DevBot.Game.AI.Decks
return false; return false;
} }
private bool Number61Volcasaurus()
{
return AI.Utils.IsOneEnnemyBetterThanValue(2000, false);
}
private bool ZwLionArms() private bool ZwLionArms()
{ {
if (ActivateDescription == AI.Utils.GetStringId((int)CardId.ZwLionArms, 0)) if (ActivateDescription == AI.Utils.GetStringId((int)CardId.ZwLionArms, 0))
...@@ -140,18 +179,37 @@ namespace DevBot.Game.AI.Decks ...@@ -140,18 +179,37 @@ namespace DevBot.Game.AI.Decks
private bool InstantFusion() private bool InstantFusion()
{ {
List<ClientCard> monsters = Duel.Fields[0].GetMonsters(); List<ClientCard> monsters = Duel.Fields[0].GetMonsters();
int count = 0; int count4 = 0;
int count5 = 0;
foreach (ClientCard card in monsters) foreach (ClientCard card in monsters)
{ {
if (card.Level == 5) if (card.Level == 5)
++count; ++count5;
if (card.Level == 4)
++count4;
} }
if (count == 1) if (count5 == 1)
{
AI.SelectCard((int)CardId.FlameSwordsman); AI.SelectCard((int)CardId.FlameSwordsman);
else return true;
}
else if (count4 == 1)
{
AI.SelectCard((int)CardId.DarkfireDragon); AI.SelectCard((int)CardId.DarkfireDragon);
return true; return true;
} }
return false;
}
private bool NumberS39UtopiatheLightning()
{
return Card.Attack < 5000;
}
private bool Honest()
{
return Duel.Phase != DuelPhase.Main1 || Duel.Turn == 1;
}
private bool GoblindberghFirst() private bool GoblindberghFirst()
{ {
...@@ -201,6 +259,11 @@ namespace DevBot.Game.AI.Decks ...@@ -201,6 +259,11 @@ namespace DevBot.Game.AI.Decks
private bool SolarWindJammer() private bool SolarWindJammer()
{ {
if (!Duel.Fields[0].HasInHand(new List<int> {
(int)CardId.StarDrawing,
(int)CardId.InstantFusion
}))
return false;
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
...@@ -209,5 +272,12 @@ namespace DevBot.Game.AI.Decks ...@@ -209,5 +272,12 @@ namespace DevBot.Game.AI.Decks
{ {
return (CurrentChain.Count > 0 && DefaultTrap()); return (CurrentChain.Count > 0 && DefaultTrap());
} }
private bool MonsterRepos()
{
if (Card.Id == (int)CardId.NumberS39UtopiatheLightning)
return false;
return base.DefaultMonsterRepos();
}
} }
} }
...@@ -134,7 +134,7 @@ namespace WindBot.Game.AI ...@@ -134,7 +134,7 @@ namespace WindBot.Game.AI
protected bool DefaultTrap() protected bool DefaultTrap()
{ {
return LastChainPlayer == -1 || LastChainPlayer == 1; return (LastChainPlayer == -1 && Duel.LastSummonPlayer != 0) || LastChainPlayer == 1;
} }
protected bool DefaultUniqueTrap() protected bool DefaultUniqueTrap()
......
...@@ -47,13 +47,14 @@ namespace WindBot.Game.AI ...@@ -47,13 +47,14 @@ namespace WindBot.Game.AI
for (int i = defenders.Count - 1; i >= 0; --i) for (int i = defenders.Count - 1; i >= 0; --i)
{ {
ClientCard defender = defenders[i]; ClientCard defender = defenders[i];
int value = defender.GetDefensePower(); int def = defender.GetDefensePower();
for (int j = 0; j < attackers.Count; ++j) for (int j = 0; j < attackers.Count; ++j)
{ {
ClientCard attacker = attackers[j]; ClientCard attacker = attackers[j];
attacker.RealPower = attacker.Attack;
if (!OnPreBattleBetween(attacker, defender)) if (!OnPreBattleBetween(attacker, defender))
continue; continue;
if (attacker.Attack > value || (attacker.Attack >= value && j == attackers.Count - 1)) if (attacker.RealPower > def || (attacker.RealPower >= def && j == attackers.Count - 1))
return AI.Attack(attacker, defender); return AI.Attack(attacker, defender);
} }
} }
......
...@@ -24,6 +24,7 @@ namespace WindBot.Game ...@@ -24,6 +24,7 @@ namespace WindBot.Game
public int Defense { get; private set; } public int Defense { get; private set; }
public int BaseAttack { get; private set; } public int BaseAttack { get; private set; }
public int BaseDefense { get; private set; } public int BaseDefense { get; private set; }
public int RealPower { get; set; }
public List<int> Overlays { get; private set; } public List<int> Overlays { get; private set; }
public int Owner { get; private set; } public int Owner { get; private set; }
public int Controller { get; private set; } public int Controller { get; private set; }
......
...@@ -16,6 +16,7 @@ namespace WindBot.Game ...@@ -16,6 +16,7 @@ namespace WindBot.Game
public MainPhase MainPhase { get; set; } public MainPhase MainPhase { get; set; }
public BattlePhase BattlePhase { get; set; } public BattlePhase BattlePhase { get; set; }
public IList<ClientCard> ChainTargets { get; set; } public IList<ClientCard> ChainTargets { get; set; }
public int LastSummonPlayer { get; set; }
public Duel() public Duel()
{ {
...@@ -24,6 +25,7 @@ namespace WindBot.Game ...@@ -24,6 +25,7 @@ namespace WindBot.Game
Fields[0] = new ClientField(); Fields[0] = new ClientField();
Fields[1] = new ClientField(); Fields[1] = new ClientField();
ChainTargets = new List<ClientCard>(); ChainTargets = new List<ClientCard>();
LastSummonPlayer = -1;
} }
public ClientCard GetCard(int player, CardLocation loc, int index) public ClientCard GetCard(int player, CardLocation loc, int index)
......
...@@ -63,6 +63,7 @@ namespace WindBot.Game ...@@ -63,6 +63,7 @@ namespace WindBot.Game
m_nextSelector = null; m_nextSelector = null;
m_option = -1; m_option = -1;
m_position = CardPosition.FaceUpAttack; m_position = CardPosition.FaceUpAttack;
Duel.LastSummonPlayer = -1;
if (Duel.Player == 0 && Duel.Phase == DuelPhase.Draw) if (Duel.Player == 0 && Duel.Phase == DuelPhase.Draw)
{ {
_dialogs.SendNewTurn(); _dialogs.SendNewTurn();
...@@ -89,6 +90,7 @@ namespace WindBot.Game ...@@ -89,6 +90,7 @@ namespace WindBot.Game
/// <param name="player">Player who is currently chaining.</param> /// <param name="player">Player who is currently chaining.</param>
public void OnChaining(ClientCard card, int player) public void OnChaining(ClientCard card, int player)
{ {
Duel.LastSummonPlayer = -1;
Executor.OnChaining(player,card); Executor.OnChaining(player,card);
} }
...@@ -268,6 +270,7 @@ namespace WindBot.Game ...@@ -268,6 +270,7 @@ namespace WindBot.Game
if (ShouldExecute(exec, card, ExecutorType.SpSummon)) if (ShouldExecute(exec, card, ExecutorType.SpSummon))
{ {
_dialogs.SendSummon(card.Name); _dialogs.SendSummon(card.Name);
Duel.LastSummonPlayer = 0;
return new MainPhaseAction(MainPhaseAction.MainAction.SpSummon, card.ActionIndex); return new MainPhaseAction(MainPhaseAction.MainAction.SpSummon, card.ActionIndex);
} }
} }
...@@ -276,6 +279,7 @@ namespace WindBot.Game ...@@ -276,6 +279,7 @@ namespace WindBot.Game
if (ShouldExecute(exec, card, ExecutorType.Summon)) if (ShouldExecute(exec, card, ExecutorType.Summon))
{ {
_dialogs.SendSummon(card.Name); _dialogs.SendSummon(card.Name);
Duel.LastSummonPlayer = 0;
return new MainPhaseAction(MainPhaseAction.MainAction.Summon, card.ActionIndex); return new MainPhaseAction(MainPhaseAction.MainAction.Summon, card.ActionIndex);
} }
if (ShouldExecute(exec, card, ExecutorType.SummonOrSet)) if (ShouldExecute(exec, card, ExecutorType.SummonOrSet))
...@@ -287,6 +291,7 @@ namespace WindBot.Game ...@@ -287,6 +291,7 @@ namespace WindBot.Game
return new MainPhaseAction(MainPhaseAction.MainAction.SetMonster, card.ActionIndex); return new MainPhaseAction(MainPhaseAction.MainAction.SetMonster, card.ActionIndex);
} }
_dialogs.SendSummon(card.Name); _dialogs.SendSummon(card.Name);
Duel.LastSummonPlayer = 0;
return new MainPhaseAction(MainPhaseAction.MainAction.Summon, card.ActionIndex); return new MainPhaseAction(MainPhaseAction.MainAction.Summon, card.ActionIndex);
} }
} }
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Game\AI\Decks\BlueEyesExecutor.cs" />
<Compile Include="Game\AI\AIFunctions.cs" /> <Compile Include="Game\AI\AIFunctions.cs" />
<Compile Include="Game\AI\CardContainer.cs" /> <Compile Include="Game\AI\CardContainer.cs" />
<Compile Include="Game\AI\CardExecutor.cs" /> <Compile Include="Game\AI\CardExecutor.cs" />
...@@ -59,10 +58,12 @@ ...@@ -59,10 +58,12 @@
<Compile Include="Game\AI\CardSelector.cs" /> <Compile Include="Game\AI\CardSelector.cs" />
<Compile Include="Game\AI\DeckAttribute.cs" /> <Compile Include="Game\AI\DeckAttribute.cs" />
<Compile Include="Game\AI\DecksManager.cs" /> <Compile Include="Game\AI\DecksManager.cs" />
<Compile Include="Game\AI\Decks\BlueEyesExecutor.cs" />
<Compile Include="Game\AI\Decks\BurnExecutor.cs" /> <Compile Include="Game\AI\Decks\BurnExecutor.cs" />
<Compile Include="Game\AI\Decks\DragunityExecutor.cs" /> <Compile Include="Game\AI\Decks\DragunityExecutor.cs" />
<Compile Include="Game\AI\Decks\FrogExecutor.cs" /> <Compile Include="Game\AI\Decks\FrogExecutor.cs" />
<Compile Include="Game\AI\Decks\HorusExecutor.cs" /> <Compile Include="Game\AI\Decks\HorusExecutor.cs" />
<Compile Include="Game\AI\Decks\DoEverythingExecutor.cs" />
<Compile Include="Game\AI\Decks\OldSchoolExecutor.cs" /> <Compile Include="Game\AI\Decks\OldSchoolExecutor.cs" />
<Compile Include="Game\AI\Decks\Rank5Executor.cs" /> <Compile Include="Game\AI\Decks\Rank5Executor.cs" />
<Compile Include="Game\AI\Decks\ZexalWeaponsExecutor.cs" /> <Compile Include="Game\AI\Decks\ZexalWeaponsExecutor.cs" />
...@@ -96,9 +97,6 @@ ...@@ -96,9 +97,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
<None Include="Decks\AI_BlueEyes.ydk">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="sqlite3.dll"> <None Include="sqlite3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment