Commit afa65cfc authored by wind2009's avatar wind2009 Committed by GitHub

Update TrickstarExecutor.cs

Edit search of トリックスター・キャロベイン.
Select Link material with attack order.
Fix Eater of Millions and Borreload Dragon's attack.
Use Borreload Dragon instead of Torymare Unicorn first.
parent 258990b9
...@@ -51,6 +51,7 @@ namespace WindBot.Game.AI.Decks ...@@ -51,6 +51,7 @@ namespace WindBot.Game.AI.Decks
public const int Abyss = 9753964; public const int Abyss = 9753964;
public const int Exterio = 99916754; public const int Exterio = 99916754;
public const int Ultimate = 86221741; public const int Ultimate = 86221741;
public const int Cardian = 87460579;
public const int Missus = 3987233; public const int Missus = 3987233;
} }
...@@ -88,6 +89,7 @@ namespace WindBot.Game.AI.Decks ...@@ -88,6 +89,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Ring, Ring_act); AddExecutor(ExecutorType.Activate, CardId.Ring, Ring_act);
AddExecutor(ExecutorType.Activate, CardId.Abyss, Abyss_eff); AddExecutor(ExecutorType.Activate, CardId.Abyss, Abyss_eff);
AddExecutor(ExecutorType.Activate, CardId.Exterio, Exterio_counter); AddExecutor(ExecutorType.Activate, CardId.Exterio, Exterio_counter);
AddExecutor(ExecutorType.Activate, CardId.Cardian);
// spell clean // spell clean
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock); AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock);
...@@ -95,36 +97,36 @@ namespace WindBot.Game.AI.Decks ...@@ -95,36 +97,36 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Galaxy, GalaxyCyclone); AddExecutor(ExecutorType.Activate, CardId.Galaxy, GalaxyCyclone);
AddExecutor(ExecutorType.Activate, CardId.TG, TG_eff); AddExecutor(ExecutorType.Activate, CardId.TG, TG_eff);
// ex_monster act
AddExecutor(ExecutorType.Activate, CardId.Beelze);
AddExecutor(ExecutorType.Activate, CardId.Missus, Missus_eff);
AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff);
AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.Linkuri, Linkuri_eff);
AddExecutor(ExecutorType.Activate, CardId.phoneix, Phoneix_eff);
AddExecutor(ExecutorType.Activate, CardId.unicorn, Unicorn_eff);
AddExecutor(ExecutorType.Activate, CardId.snake, Snake_eff);
AddExecutor(ExecutorType.Activate, CardId.borrel, Borrel_eff);
AddExecutor(ExecutorType.Activate, CardId.Tuner,Tuner_eff); AddExecutor(ExecutorType.Activate, CardId.Tuner,Tuner_eff);
// ex ss // ex ss
AddExecutor(ExecutorType.SpSummon, CardId.borrel, Borrel_ss); AddExecutor(ExecutorType.SpSummon, CardId.borrel, Borrel_ss);
AddExecutor(ExecutorType.SpSummon, CardId.snake, Snake_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Missus, Missus_ss); AddExecutor(ExecutorType.SpSummon, CardId.Missus, Missus_ss);
AddExecutor(ExecutorType.SpSummon, CardId.phoneix, Phoneix_ss); AddExecutor(ExecutorType.SpSummon, CardId.phoneix, Phoneix_ss);
AddExecutor(ExecutorType.SpSummon, CardId.unicorn, Unicorn_ss); AddExecutor(ExecutorType.SpSummon, CardId.snake, Snake_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Crystal, Crystal_ss); AddExecutor(ExecutorType.SpSummon, CardId.Crystal, Crystal_ss);
AddExecutor(ExecutorType.SpSummon, CardId.SafeDra, Safedragon_ss); AddExecutor(ExecutorType.SpSummon, CardId.SafeDra, Safedragon_ss);
AddExecutor(ExecutorType.Activate, CardId.Linkuri, Linkuri_eff);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuri, Linkuri_ss); AddExecutor(ExecutorType.SpSummon, CardId.Linkuri, Linkuri_ss);
AddExecutor(ExecutorType.SpSummon, CardId.unicorn, Unicorn_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Linkspi); AddExecutor(ExecutorType.SpSummon, CardId.Linkspi);
// ex_monster act
AddExecutor(ExecutorType.Activate, CardId.Beelze);
AddExecutor(ExecutorType.Activate, CardId.Missus, Missus_eff);
AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff);
AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.phoneix, Phoneix_eff);
AddExecutor(ExecutorType.Activate, CardId.unicorn, Unicorn_eff);
AddExecutor(ExecutorType.Activate, CardId.snake, Snake_eff);
AddExecutor(ExecutorType.Activate, CardId.borrel, Borrel_eff);
// normal act // normal act
AddExecutor(ExecutorType.Activate, CardId.Trans); AddExecutor(ExecutorType.Activate, CardId.Trans);
AddExecutor(ExecutorType.SpSummon, CardId.BF, BF_pos); AddExecutor(ExecutorType.SpSummon, CardId.BF, BF_pos);
AddExecutor(ExecutorType.Activate, CardId.BF, BF_pos); AddExecutor(ExecutorType.Activate, CardId.BF, BF_pos);
AddExecutor(ExecutorType.Activate, CardId.Sheep, Sheep_Act); AddExecutor(ExecutorType.Activate, CardId.Sheep, Sheep_Act);
AddExecutor(ExecutorType.Activate, CardId.Eater); AddExecutor(ExecutorType.Activate, CardId.Eater,Eater_eff);
AddExecutor(ExecutorType.Activate, CardId.LockBird, LockBird_act); AddExecutor(ExecutorType.Activate, CardId.LockBird, LockBird_act);
// ts // ts
...@@ -426,26 +428,26 @@ namespace WindBot.Game.AI.Decks ...@@ -426,26 +428,26 @@ namespace WindBot.Game.AI.Decks
stage_locked = null; stage_locked = null;
return true; return true;
} }
if (Bot.HasInMonstersZone(CardId.Yellow) && !Bot.HasInHand(CardId.Red)) if (Enemy.GetMonsterCount() > 0 && AI.Utils.GetBestEnemyMonster().Attack >= AI.Utils.GetBestAttack(Bot) && !Bot.HasInHand(CardId.White))
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Red, CardId.White,
CardId.Pink,
CardId.Yellow, CardId.Yellow,
CardId.White CardId.Pink,
CardId.Red
}); });
stage_locked = null; stage_locked = null;
return true; return true;
} }
if (Enemy.GetMonsterCount() > 0 && AI.Utils.GetBestEnemyMonster().Attack >= AI.Utils.GetBestAttack(Bot)) if (Bot.HasInMonstersZone(CardId.Yellow) && !Bot.HasInHand(CardId.Red))
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.White, CardId.Red,
CardId.Yellow,
CardId.Pink, CardId.Pink,
CardId.Red CardId.Yellow,
CardId.White
}); });
stage_locked = null; stage_locked = null;
return true; return true;
...@@ -536,6 +538,7 @@ namespace WindBot.Game.AI.Decks ...@@ -536,6 +538,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false; if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false; if (AI.Utils.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
if (Bot.SpellZone[5] != null && Bot.SpellZone[5].IsFacedown()) if (Bot.SpellZone[5] != null && Bot.SpellZone[5].IsFacedown())
{ {
...@@ -550,17 +553,16 @@ namespace WindBot.Game.AI.Decks ...@@ -550,17 +553,16 @@ namespace WindBot.Game.AI.Decks
targets.Add(e_c); targets.Add(e_c);
if (targets.Count >= 5) if (targets.Count >= 5)
{ {
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(targets); AI.SelectCard(targets);
return true; return true;
} }
} }
Logger.DebugWriteLine("*** Eater use up the extra deck.");
foreach (ClientCard s_c in Bot.GetSpells()) foreach (ClientCard s_c in Bot.GetSpells())
{ {
targets.Add(s_c); targets.Add(s_c);
if (targets.Count >= 5) if (targets.Count >= 5)
{ {
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(targets); AI.SelectCard(targets);
return true; return true;
} }
...@@ -568,14 +570,25 @@ namespace WindBot.Game.AI.Decks ...@@ -568,14 +570,25 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
public bool Eater_eff()
{
ClientCard self_card = (Duel.Player == 0) ? AI.GetAttacker() : AI.GetDefender();
ClientCard enemy_card = (Duel.Player == 1) ? AI.GetAttacker() : AI.GetDefender();
if (self_card == null || enemy_card == null) return false;
if (enemy_card.HasPosition(CardPosition.FaceDown)) return true;
if (enemy_card.HasPosition(CardPosition.Attack) && (self_card.Attack - enemy_card.GetDefensePower() >= Duel.LifePoints[1])) return true;
return (self_card.Attack <= (enemy_card.GetDefensePower() * 2));
}
public bool Red_ss() public bool Red_ss()
{ {
if (red_ss_count >= 6) return false; if (red_ss_count >= 6) return false;
if ((ChainContainsCard(53129443) || ChainContainsCard(99330325) || ChainContainsCard(53582587)) && ChainContainsCard(CardId.Red)) return false;
if (LastChainPlayer == 0 && GetLastChainCard().Id == CardId.Red) if (LastChainPlayer == 0 && GetLastChainCard().Id == CardId.Red)
{ {
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (AI.Utils.IsChainTarget(m)) if (AI.Utils.IsChainTarget(m) && IsTrickstar(m.Id))
{ {
red_ss_count += 1; red_ss_count += 1;
AI.SelectCard(m); AI.SelectCard(m);
...@@ -593,9 +606,9 @@ namespace WindBot.Game.AI.Decks ...@@ -593,9 +606,9 @@ namespace WindBot.Game.AI.Decks
ClientCard tosolve_enemy = AI.Utils.GetOneEnemyBetterThanMyBest(); ClientCard tosolve_enemy = AI.Utils.GetOneEnemyBetterThanMyBest();
foreach (ClientCard c in self_m) foreach (ClientCard c in self_m)
{ {
if (IsTrickstar(c.Id)) if (IsTrickstar(c.Id) && c.Id != CardId.Red)
{ {
if (c.Attacked && c.Id != CardId.Red) if (c.Attacked)
{ {
AI.SelectCard(c); AI.SelectCard(c);
red_ss_count += 1; red_ss_count += 1;
...@@ -603,7 +616,7 @@ namespace WindBot.Game.AI.Decks ...@@ -603,7 +616,7 @@ namespace WindBot.Game.AI.Decks
} }
if (tosolve_enemy != null) if (tosolve_enemy != null)
{ {
if (Bot.HasInHand(CardId.White) && c.Attack * 2 < tosolve_enemy.Attack) if (Bot.HasInHand(CardId.White) && c.Attack + c.BaseAttack < tosolve_enemy.Attack)
{ {
if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence); if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c); AI.SelectCard(c);
...@@ -638,7 +651,6 @@ namespace WindBot.Game.AI.Decks ...@@ -638,7 +651,6 @@ namespace WindBot.Game.AI.Decks
} }
} else } else
{ {
if ((ChainContainsCard(53129443) || ChainContainsCard(99330325)) && ChainContainsCard(CardId.Red)) return false;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
if (!Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(1600, true)) if (!Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(1600, true))
...@@ -675,109 +687,110 @@ namespace WindBot.Game.AI.Decks ...@@ -675,109 +687,110 @@ namespace WindBot.Game.AI.Decks
}); });
return true; return true;
} }
if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2()) if (Duel.LifePoints[1] <= 1000)
{ {
if (Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss) if (Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Pink, CardId.Pink,
CardId.Stage,
CardId.Red, CardId.Red,
CardId.White, CardId.White,
CardId.Re, CardId.Re,
CardId.Stage,
CardId.Crown, CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
return true;
} }
else if (Bot.HasInGraveyard(CardId.Pink) && Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Ring, 1) > 0) else if (Bot.HasInGraveyard(CardId.Pink) && Bot.GetRemainingCount(CardId.Crown, 1) > 0)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Crown, CardId.Crown,
CardId.Red, CardId.Pink,
CardId.White,
CardId.Re, CardId.Re,
CardId.Stage, CardId.Stage,
CardId.Pink, CardId.Red,
CardId.White,
CardId.Yellow CardId.Yellow
}); });
return true;
} }
else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Duel.LifePoints[1] <= 4000) }
if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2())
{
if (Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.White,
CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Red,
CardId.White,
CardId.Re, CardId.Re,
CardId.Stage, CardId.Stage,
CardId.Crown, CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
} }
else if (Bot.HasInGraveyard(CardId.White) && Bot.GetRemainingCount(CardId.Crown, 1) > 0) else if (Bot.HasInGraveyard(CardId.Pink) && Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Ring, 1) > 0)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Crown, CardId.Crown,
CardId.Red, CardId.Red,
CardId.Pink, CardId.White,
CardId.Re, CardId.Re,
CardId.Stage, CardId.Stage,
CardId.White, CardId.Pink,
CardId.Yellow CardId.Yellow
}); });
} }
else else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Duel.LifePoints[1] <= 4000)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.White,
CardId.Red, CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Crown,
CardId.Stage, CardId.Stage,
CardId.White, CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
} }
return true; else if (Bot.HasInGraveyard(CardId.White) && Bot.GetRemainingCount(CardId.Crown, 1) > 0)
}
if (Duel.LifePoints[1] <= 1000)
{
if (Bot.GetRemainingCount(CardId.Pink,1) > 0 && !pink_ss)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Crown,
CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re,
CardId.Stage, CardId.Stage,
CardId.Red,
CardId.White, CardId.White,
CardId.Re,
CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
return true; }
} else if (Bot.HasInGraveyard(CardId.Pink) && Bot.GetRemainingCount(CardId.Crown,1) > 0) else
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Crown, CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Crown,
CardId.Stage, CardId.Stage,
CardId.Red,
CardId.White, CardId.White,
CardId.Yellow CardId.Yellow
}); });
return true;
} }
return true;
} }
if (AI.Utils.GetProblematicEnemyMonster() != null) if (AI.Utils.GetProblematicEnemyMonster() != null)
{ {
int atk = AI.Utils.GetProblematicEnemyMonster().Attack; int atk = AI.Utils.GetProblematicEnemyMonster().Attack;
if (atk >= 1800 && atk <= 3600 && Bot.GetRemainingCount(CardId.White, 2) > 0) if (atk >= 1800 && atk <= 3600 && Bot.GetRemainingCount(CardId.White, 2) > 0 && !Bot.HasInHand(CardId.White))
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
...@@ -805,7 +818,8 @@ namespace WindBot.Game.AI.Decks ...@@ -805,7 +818,8 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
} }
if ((Bot.HasInHand(CardId.Red) || Bot.HasInHand(CardId.Stage)) && Bot.GetRemainingCount(CardId.Re,1) > 0 && Bot.HasInHand(CardId.LockBird)) { if ((Bot.HasInHand(CardId.Red) || Bot.HasInHand(CardId.Stage) || Bot.HasInHand(CardId.Yellow)) && Bot.GetRemainingCount(CardId.Re,1) > 0) {
Logger.DebugWriteLine("to search reincarnation");
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Re, CardId.Re,
...@@ -836,6 +850,7 @@ namespace WindBot.Game.AI.Decks ...@@ -836,6 +850,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
// from blackwing // from blackwing
/*
ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster(); ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyATK = Enemy.GetMonsters().GetHighestAttackMonster(); ClientCard bestEnemyATK = Enemy.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyDEF = Enemy.GetMonsters().GetHighestDefenseMonster(); ClientCard bestEnemyDEF = Enemy.GetMonsters().GetHighestDefenseMonster();
...@@ -851,6 +866,15 @@ namespace WindBot.Game.AI.Decks ...@@ -851,6 +866,15 @@ namespace WindBot.Game.AI.Decks
white_eff_used = true; white_eff_used = true;
return true; return true;
} }
*/
ClientCard self_monster = (Duel.Player == 0) ? AI.GetAttacker() : AI.GetDefender();
ClientCard enemy_monster = (Duel.Player == 1) ? AI.GetAttacker() : AI.GetDefender();
if (self_monster == null || enemy_monster == null || !IsTrickstar(self_monster.Id) || self_monster.HasPosition(CardPosition.Defence)) return false;
if (self_monster.Attack <= enemy_monster.RealPower && self_monster.Attack + self_monster.BaseAttack >= enemy_monster.RealPower)
{
white_eff_used = true;
return true;
}
return false; return false;
} else } else
{ {
...@@ -864,24 +888,32 @@ namespace WindBot.Game.AI.Decks ...@@ -864,24 +888,32 @@ namespace WindBot.Game.AI.Decks
ClientCard self_card = Bot.GetMonsters().GetHighestAttackMonster(); ClientCard self_card = Bot.GetMonsters().GetHighestAttackMonster();
if (tosolve == null || self_card == null || (tosolve != null && self_card != null && !IsTrickstar(self_card.Id))) if (tosolve == null || self_card == null || (tosolve != null && self_card != null && !IsTrickstar(self_card.Id)))
{ {
if (Enemy.GetMonsters().GetLowestAttackMonster() == null || if (Enemy.GetMonsters().GetHighestAttackMonster()== null ||
Enemy.GetMonsters().GetLowestDefenseMonster() == null || Enemy.GetMonsters().GetHighestDefenseMonster() == null ||
Enemy.GetMonsters().GetLowestAttackMonster().Attack < 2000 || Enemy.GetMonsters().GetHighestAttackMonster().GetDefensePower() < 2000 ||
Enemy.GetMonsters().GetLowestDefenseMonster().Defense < 2000) Enemy.GetMonsters().GetHighestDefenseMonster().GetDefensePower() < 2000)
{ {
white_eff_used = true; white_eff_used = true;
return true; return true;
} }
else return false; else return false;
} }
if (tosolve != null && self_card != null && IsTrickstar(self_card.Id)) if (tosolve != null && self_card != null && IsTrickstar(self_card.Id) && !tosolve.IsMonsterHasPreventActivationEffectInBattle())
{ {
int attacker_atk = self_card.Attack;
int defender_power = tosolve.GetDefensePower(); int defender_power = tosolve.GetDefensePower();
if (attacker_atk <= defender_power && attacker_atk * 2 >= defender_power) Logger.DebugWriteLine("battle check 0:" + Duel.Phase.ToString());
Logger.DebugWriteLine("battle check 1:" + self_card.Attack.ToString());
Logger.DebugWriteLine("battle check 2:" + (self_card.Attack+self_card.BaseAttack).ToString());
Logger.DebugWriteLine("battle check 3:" + defender_power.ToString());
if (self_card.Attack <= defender_power && self_card.Attack + self_card.BaseAttack >= defender_power)
{ {
return false; return false;
} }
else if (defender_power <= 2000)
{
white_eff_used = true;
return true;
}
} }
} }
return false; return false;
...@@ -917,7 +949,11 @@ namespace WindBot.Game.AI.Decks ...@@ -917,7 +949,11 @@ namespace WindBot.Game.AI.Decks
public bool Crown_eff() public bool Crown_eff()
{ {
if (Card.Location == CardLocation.Hand) return Ts_reborn(); if (Card.Location == CardLocation.Hand)
{
if (Duel.Phase <= DuelPhase.Main1) return Ts_reborn();
return false;
}
if (Bot.HasInHand(CardId.Pink)) if (Bot.HasInHand(CardId.Pink))
{ {
AI.SelectCard(CardId.Pink); AI.SelectCard(CardId.Pink);
...@@ -1024,7 +1060,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1024,7 +1060,7 @@ namespace WindBot.Game.AI.Decks
public bool Tuner_ss() public bool Tuner_ss()
{ {
if (crystal_eff_used) return false; if (crystal_eff_used || Bot.HasInMonstersZone(CardId.Crystal)) return false;
if (Bot.GetMonsterCount() == 0 || !Bot.HasInExtra(CardId.Crystal)) return false; if (Bot.GetMonsterCount() == 0 || !Bot.HasInExtra(CardId.Crystal)) return false;
if (Card.Id == CardId.Ghost && Bot.GetRemainingCount(CardId.Ghost, 2) <= 0) return false; if (Card.Id == CardId.Ghost && Bot.GetRemainingCount(CardId.Ghost, 2) <= 0) return false;
int count = 0; int count = 0;
...@@ -1051,7 +1087,18 @@ namespace WindBot.Game.AI.Decks ...@@ -1051,7 +1087,18 @@ namespace WindBot.Game.AI.Decks
public bool Ring_act() public bool Ring_act()
{ {
if (LastChainPlayer == 0 && GetLastChainCard() != null && GetLastChainCard().Id == CardId.Ghost) return false; if (LastChainPlayer == 0 && GetLastChainCard() != null && GetLastChainCard().Id == CardId.Ghost) return false;
return DefaultCompulsoryEvacuationDevice(); ClientCard target = AI.Utils.GetProblematicEnemyMonster();
if (target == null && AI.Utils.IsChainTarget(Card))
{
target = AI.Utils.GetBestEnemyMonster();
}
if (target != null)
{
if (Duel.LifePoints[0] <= target.Attack) return false;
AI.SelectCard(target);
return true;
}
return false;
} }
public bool Linkuri_ss() public bool Linkuri_ss()
...@@ -1100,7 +1147,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1100,7 +1147,9 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (targets.Count == 0) return false; if (targets.Count == 0) return false;
foreach(ClientCard e_check in Bot.GetMonsters()) List<ClientCard> m_list = new List<ClientCard>(Bot.GetMonsters());
m_list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard e_check in m_list)
{ {
if (e_check.IsFacedown()) continue; if (e_check.IsFacedown()) continue;
if (targets[0] != e_check && getLinkMarker(e_check.Id) <= 2 && e_check.Id != CardId.Eater && e_check.Id != CardId.Crystal) if (targets[0] != e_check && getLinkMarker(e_check.Id) <= 2 && e_check.Id != CardId.Eater && e_check.Id != CardId.Crystal)
...@@ -1153,12 +1202,13 @@ namespace WindBot.Game.AI.Decks ...@@ -1153,12 +1202,13 @@ namespace WindBot.Game.AI.Decks
public bool Safedragon_ss() public bool Safedragon_ss()
{ {
if (AI.Utils.IsTurn1OrMain2()) return false;
ClientCard m = AI.Utils.GetProblematicEnemyMonster(); ClientCard m = AI.Utils.GetProblematicEnemyMonster();
foreach(ClientCard ex_m in Bot.GetMonstersInExtraZone()) foreach(ClientCard ex_m in Bot.GetMonstersInExtraZone())
{ {
if (getLinkMarker(ex_m.Id) >= 4) return false; if (getLinkMarker(ex_m.Id) >= 4) return false;
} }
if (m == null) if ((m == null || m.HasPosition(CardPosition.FaceDown)) && Duel.LifePoints[1] <= 1100)
{ {
if (Enemy.GetMonsterCount() == 0 && Duel.Phase < DuelPhase.Battle) if (Enemy.GetMonsterCount() == 0 && Duel.Phase < DuelPhase.Battle)
{ {
...@@ -1166,9 +1216,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1166,9 +1216,9 @@ namespace WindBot.Game.AI.Decks
foreach(ClientCard monster in Bot.GetMonsters()) foreach(ClientCard monster in Bot.GetMonsters())
{ {
if (getLinkMarker(monster.Id) <= 2) list.Add(monster); if (getLinkMarker(monster.Id) <= 2) list.Add(monster);
if (list.Count >= 2) break; if (list.Count == 2) break;
} }
if (list.Count >= 2 && GetTotalATK(list) <= 1100) if (list.Count == 2 && GetTotalATK(list) <= 1100)
{ {
AI.SelectMaterials(list); AI.SelectMaterials(list);
return true; return true;
...@@ -1186,10 +1236,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1186,10 +1236,11 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard s_m in Bot.GetMonsters()) foreach (ClientCard s_m in Bot.GetMonsters())
{ {
if (s_m.Id == CardId.Eater) continue;
if (s_m != Bot.MonsterZone[5] && s_m != Bot.MonsterZone[6]) targets.Add(s_m); if (s_m != Bot.MonsterZone[5] && s_m != Bot.MonsterZone[6]) targets.Add(s_m);
if (targets.Count >= 2) break; if (targets.Count == 2) break;
} }
if (targets.Count >= 2) if (targets.Count == 2)
{ {
AI.SelectMaterials(targets); AI.SelectMaterials(targets);
return true; return true;
...@@ -1205,7 +1256,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1205,7 +1256,9 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1900 && Duel.Phase == DuelPhase.Main1) if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1900 && Duel.Phase == DuelPhase.Main1)
{ {
IList<ClientCard> m_list = new List<ClientCard>(); IList<ClientCard> m_list = new List<ClientCard>();
foreach(ClientCard monster in Bot.GetMonsters()) List<ClientCard> list = new List<ClientCard>(Bot.GetMonsters());
list.Sort(AIFunctions.CompareCardAttack);
foreach(ClientCard monster in list)
{ {
if (getLinkMarker(monster.Id) == 1 && monster.IsFaceup()) m_list.Add(monster); if (getLinkMarker(monster.Id) == 1 && monster.IsFaceup()) m_list.Add(monster);
if (m_list.Count == 2) break; if (m_list.Count == 2) break;
...@@ -1220,27 +1273,30 @@ namespace WindBot.Game.AI.Decks ...@@ -1220,27 +1273,30 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.Hand.Count == 0) return false; if (Bot.Hand.Count == 0) return false;
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
ClientCard ex_zone = null; List<ClientCard> main_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
foreach (ClientCard s_m in Bot.GetMonsters()) main_list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard s_m in main_list)
{ {
if (s_m.IsFacedown()) continue; if (s_m.IsFacedown()) continue;
if (s_m == Bot.MonsterZone[5] && s_m != Bot.MonsterZone[6]) if ((s_m.Id != CardId.Eater || (s_m.Id == CardId.Eater && s_m.IsDisabled())) && !targets.ContainsCardWithId(s_m.Id))
{ {
ex_zone = s_m; targets.Add(s_m);
};
if (targets.Count == 2) break;
} }
else if (targets.Count < 2)
{ {
foreach (ClientCard s_m in Bot.GetMonstersInExtraZone())
{
if (s_m.IsFacedown()) continue;
if (s_m.Id != CardId.Eater && !targets.ContainsCardWithId(s_m.Id)) if (s_m.Id != CardId.Eater && !targets.ContainsCardWithId(s_m.Id))
{ {
targets.Add(s_m); targets.Add(s_m);
}; };
}; if (targets.Count == 2) break;
if (targets.Count >= 2) break;
} }
if (targets.Count < 2)
{
targets.Add(ex_zone);
} }
if (targets.Count < 2) return false;
AI.SelectMaterials(targets); AI.SelectMaterials(targets);
return true; return true;
} }
...@@ -1259,7 +1315,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1259,7 +1315,9 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 2200 && Duel.Phase == DuelPhase.Main1) if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 2200 && Duel.Phase == DuelPhase.Main1)
{ {
IList<ClientCard> m_list = new List<ClientCard>(); IList<ClientCard> m_list = new List<ClientCard>();
foreach(ClientCard monster in Bot.GetMonsters()) List<ClientCard> _sort_list = new List<ClientCard>(Bot.GetMonsters());
_sort_list.Sort(AIFunctions.CompareCardAttack);
foreach(ClientCard monster in _sort_list)
{ {
if (getLinkMarker(monster.Id) == 2) if (getLinkMarker(monster.Id) == 2)
{ {
...@@ -1282,9 +1340,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1282,9 +1340,11 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.Hand.Count == 0) return false; if (Bot.Hand.Count == 0) return false;
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard s_m in Bot.GetMonsters()) List<ClientCard> sort_list = Bot.GetMonsters();
sort_list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard s_m in sort_list)
{ {
if (s_m.Id != CardId.Eater && getLinkMarker(s_m.Id) <= 2 && s_m.IsFaceup()) if ((s_m.Id != CardId.Eater || (s_m.Id == CardId.Eater && m.IsMonsterHasPreventActivationEffectInBattle())) && getLinkMarker(s_m.Id) <= 2 && s_m.IsFaceup())
{ {
if (!targets.ContainsCardWithId(s_m.Id)) if (!targets.ContainsCardWithId(s_m.Id))
{ {
...@@ -1334,7 +1394,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1334,7 +1394,9 @@ namespace WindBot.Game.AI.Decks
targets.Add(e_m); targets.Add(e_m);
} }
} }
foreach (ClientCard m in Bot.GetMonstersInMainZone()) List<ClientCard> sort_main_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
sort_main_list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard m in sort_main_list)
{ {
if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id) && m.IsFaceup()) if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id) && m.IsFaceup())
{ {
...@@ -1389,6 +1451,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1389,6 +1451,7 @@ namespace WindBot.Game.AI.Decks
foreach(ClientCard monster in Bot.GetMonsters()) foreach(ClientCard monster in Bot.GetMonsters())
{ {
if (monster.HasAttribute(CardAttribute.Earth) && getLinkMarker(monster.Id) == 1) material_list.Add(monster); if (monster.HasAttribute(CardAttribute.Earth) && getLinkMarker(monster.Id) == 1) material_list.Add(monster);
if (material_list.Count == 2) break;
} }
if (material_list.Count < 2) return false; if (material_list.Count < 2) return false;
if (Enemy.GetMonsterCount() == 0 || AI.Utils.GetProblematicEnemyMonster(2000) == null) if (Enemy.GetMonsterCount() == 0 || AI.Utils.GetProblematicEnemyMonster(2000) == null)
...@@ -1418,8 +1481,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1418,8 +1481,8 @@ namespace WindBot.Game.AI.Decks
{ {
bool already_link2 = false; bool already_link2 = false;
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
if (AI.Utils.GetProblematicEnemyMonster(2000) == null) Logger.DebugWriteLine("borrel:null"); if (AI.Utils.GetProblematicEnemyMonster(2000) == null) Logger.DebugWriteLine("***borrel:null");
else Logger.DebugWriteLine("borrel:" + (AI.Utils.GetProblematicEnemyMonster(2000).Name==null ? "unknown" : AI.Utils.GetProblematicEnemyMonster(2000).Name)); else Logger.DebugWriteLine("***borrel:" + (AI.Utils.GetProblematicEnemyMonster(2000).Name ?? "unknown"));
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Duel.LifePoints[1] <= 3000)) if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Duel.LifePoints[1] <= 3000))
{ {
foreach(ClientCard e_m in Bot.GetMonstersInExtraZone()) foreach(ClientCard e_m in Bot.GetMonstersInExtraZone())
...@@ -1430,7 +1493,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1430,7 +1493,10 @@ namespace WindBot.Game.AI.Decks
material_list.Add(e_m); material_list.Add(e_m);
} }
} }
foreach(ClientCard m in Bot.GetMonstersInMainZone()) List<ClientCard> sort_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
sort_list.Sort(AIFunctions.CompareCardAttack);
foreach(ClientCard m in sort_list)
{ {
if (getLinkMarker(m.Id) < 3) if (getLinkMarker(m.Id) < 3)
{ {
...@@ -1460,7 +1526,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1460,7 +1526,10 @@ namespace WindBot.Game.AI.Decks
public bool Borrel_eff() public bool Borrel_eff()
{ {
if (ActivateDescription == -1) return true; if (ActivateDescription == -1) {
Logger.DebugWriteLine("borrel's ntr effect");
return true;
};
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true); ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true);
ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster(); ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster();
if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false; if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false;
...@@ -1509,14 +1578,59 @@ namespace WindBot.Game.AI.Decks ...@@ -1509,14 +1578,59 @@ namespace WindBot.Game.AI.Decks
lockbird_used = false; lockbird_used = false;
} }
public override BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
if (attackers.Count == 0)
return AI.ToMainPhase2();
if (defenders.Count == 0)
{
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.Attack > 0)
return AI.Attack(attacker, null);
}
}
else
{
for (int i = defenders.Count - 1; i >= 0; --i)
{
ClientCard defender = defenders[i];
for (int j = 0; j < attackers.Count; ++j)
{
ClientCard attacker = attackers[j];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
// add
if (!defender.IsMonsterHasPreventActivationEffectInBattle() && !attacker.IsDisabled())
{
if ((attacker.Id == CardId.Eater && !defender.HasType(CardType.Token)) || attacker.Id == CardId.borrel) return AI.Attack(attacker, defender);
}
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && j == attackers.Count - 1))
return AI.Attack(attacker, defender);
}
}
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
}
}
if (!Battle.CanMainPhaseTwo)
return AI.Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]);
return AI.ToMainPhase2();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (IsTrickstar(attacker.Id) && Bot.HasInHand(CardId.White) && !white_eff_used) if (IsTrickstar(attacker.Id) && Bot.HasInHand(CardId.White) && !white_eff_used)
attacker.RealPower = attacker.RealPower * 2; attacker.RealPower = attacker.RealPower * 2;
else if (attacker.Id == CardId.Eater && !defender.HasType(CardType.Token))
attacker.RealPower = 99999;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
......
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