Commit 3f0e0200 authored by mercury233's avatar mercury233

update Trickstar deck

parent 5b861398
...@@ -30,6 +30,8 @@ namespace WindBot.Game.AI.Decks ...@@ -30,6 +30,8 @@ namespace WindBot.Game.AI.Decks
public const int Sheep = 73915051; public const int Sheep = 73915051;
public const int Crown = 22159429; public const int Crown = 22159429;
public const int Stage = 35371948; public const int Stage = 35371948;
public const int GraveCall = 24224830;
public const int DarkHole = 53129443;
public const int Re = 21076084; public const int Re = 21076084;
public const int Ring = 83555666; public const int Ring = 83555666;
...@@ -50,6 +52,8 @@ namespace WindBot.Game.AI.Decks ...@@ -50,6 +52,8 @@ namespace WindBot.Game.AI.Decks
public const int Beelze = 34408491; public const int Beelze = 34408491;
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 Cardian = 87460579;
public const int Missus = 3987233; public const int Missus = 3987233;
} }
...@@ -57,6 +61,7 @@ namespace WindBot.Game.AI.Decks ...@@ -57,6 +61,7 @@ namespace WindBot.Game.AI.Decks
public int getLinkMarker(int id) public int getLinkMarker(int id)
{ {
if (id == CardId.borrel || id == CardId.snake) return 4; if (id == CardId.borrel || id == CardId.snake) return 4;
else if (id == CardId.Abyss || id == CardId.Beelze || id == CardId.Exterio || id == CardId.Ultimate) return 5;
else if (id == CardId.unicorn) return 3; else if (id == CardId.unicorn) return 3;
else if (id == CardId.Crystal || id == CardId.phoneix || id == CardId.SafeDra || id == CardId.Missus) return 2; else if (id == CardId.Crystal || id == CardId.phoneix || id == CardId.SafeDra || id == CardId.Missus) return 2;
return 1; return 1;
...@@ -71,6 +76,9 @@ namespace WindBot.Game.AI.Decks ...@@ -71,6 +76,9 @@ namespace WindBot.Game.AI.Decks
int red_ss_count = 0; int red_ss_count = 0;
bool white_eff_used = false; bool white_eff_used = false;
bool lockbird_useful = false; bool lockbird_useful = false;
bool lockbird_used = false;
int GraveCall_id = 0;
int GraveCall_count = 0;
public TrickstarExecutor(GameAI ai, Duel duel) public TrickstarExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
...@@ -82,50 +90,54 @@ namespace WindBot.Game.AI.Decks ...@@ -82,50 +90,54 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Grass, Grass_ss); AddExecutor(ExecutorType.Activate, CardId.Grass, Grass_ss);
AddExecutor(ExecutorType.Activate, CardId.Urara, Hand_act_eff); AddExecutor(ExecutorType.Activate, CardId.Urara, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.Ghost, Hand_act_eff); AddExecutor(ExecutorType.Activate, CardId.Ghost, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.Ring, DefaultCompulsoryEvacuationDevice); 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);
AddExecutor(ExecutorType.Activate, CardId.GraveCall, GraveCall_eff);
AddExecutor(ExecutorType.Activate, CardId.DarkHole, DarkHole_eff);
// spell clean // spell clean
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock); AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock);
AddExecutor(ExecutorType.Activate, CardId.Feather, Feather_Act); AddExecutor(ExecutorType.Activate, CardId.Feather, Feather_Act);
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_act);
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.snake, Snake_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Missus, Missus_ss);
AddExecutor(ExecutorType.SpSummon, CardId.borrel, Borrel_ss); AddExecutor(ExecutorType.SpSummon, CardId.borrel, Borrel_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
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_act);
AddExecutor(ExecutorType.Activate, CardId.Pink, Pink_eff); AddExecutor(ExecutorType.Activate, CardId.Pink, Pink_eff);
AddExecutor(ExecutorType.Activate, CardId.Re, Reincarnation); AddExecutor(ExecutorType.Activate, CardId.Re, Reincarnation);
AddExecutor(ExecutorType.Activate, CardId.Red, Red_ss); AddExecutor(ExecutorType.Activate, CardId.Red, Red_ss);
...@@ -235,6 +247,14 @@ namespace WindBot.Game.AI.Decks ...@@ -235,6 +247,14 @@ namespace WindBot.Game.AI.Decks
if (!Enemy.HasInMonstersZone(CardId.Ghost) || Enemy.GetHandCount() <= 1) if (!Enemy.HasInMonstersZone(CardId.Ghost) || Enemy.GetHandCount() <= 1)
{ {
ClientCard tosolve = AI.Utils.GetProblematicEnemyCard(); ClientCard tosolve = AI.Utils.GetProblematicEnemyCard();
if (tosolve == null)
{
if (Duel.LastChainPlayer == 1 && AI.Utils.GetLastChainCard() != null)
{
ClientCard target = AI.Utils.GetLastChainCard();
if (target.HasPosition(CardPosition.FaceUp) && (target.Location == CardLocation.MonsterZone || target.Location == CardLocation.SpellZone)) tosolve = target;
}
}
if (tosolve != null) if (tosolve != null)
{ {
AI.SelectCard(tosolve); AI.SelectCard(tosolve);
...@@ -317,7 +337,7 @@ namespace WindBot.Game.AI.Decks ...@@ -317,7 +337,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Player == 0) return false; if (Duel.Player == 0) return false;
if (Duel.Phase == DuelPhase.End) return true; if (Duel.Phase == DuelPhase.End) return true;
if (LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (GetLastChainCard().Id == CardId.Feather && !Bot.HasInSpellZone(CardId.Grass)))) return true; if (Duel.LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (AI.Utils.GetLastChainCard().Id == CardId.Feather && !Bot.HasInSpellZone(CardId.Grass)))) return true;
if (Duel.Phase == DuelPhase.BattleStart) if (Duel.Phase == DuelPhase.BattleStart)
{ {
int total_atk = 0; int total_atk = 0;
...@@ -349,7 +369,7 @@ namespace WindBot.Game.AI.Decks ...@@ -349,7 +369,7 @@ namespace WindBot.Game.AI.Decks
stage_locked = null; stage_locked = null;
return true; return true;
} }
else if (Enemy.LifePoints <= 1000 && !pink_ss) else if (Enemy.LifePoints <= 1000 && Bot.GetRemainingCount(CardId.Pink,1) > 0)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
...@@ -403,44 +423,42 @@ namespace WindBot.Game.AI.Decks ...@@ -403,44 +423,42 @@ namespace WindBot.Game.AI.Decks
if (NormalSummoned) if (NormalSummoned)
{ {
if (Bot.HasInMonstersZone(CardId.Yellow) && !Bot.HasInHand(CardId.Red)) if (Enemy.LifePoints <= 1000 && !pink_ss && Bot.GetRemainingCount(CardId.Pink,1) > 0)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Yellow, CardId.Yellow,
CardId.Red,
CardId.White CardId.White
}); });
stage_locked = null; stage_locked = null;
return true; return true;
} }
else if (Enemy.LifePoints <= 1000 && !pink_ss) if (Enemy.GetMonsterCount() > 0 && AI.Utils.GetBestEnemyMonster().Attack >= AI.Utils.GetBestAttack(Bot) && !Bot.HasInHand(CardId.White))
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Pink, CardId.White,
CardId.Yellow, CardId.Yellow,
CardId.Red, CardId.Pink,
CardId.White CardId.Red
}); });
stage_locked = null; stage_locked = null;
return true; return true;
} }
else 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;
} }
else if (!Bot.HasInSpellZone(CardId.Stage))
{
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Yellow, CardId.Yellow,
...@@ -451,7 +469,6 @@ namespace WindBot.Game.AI.Decks ...@@ -451,7 +469,6 @@ namespace WindBot.Game.AI.Decks
stage_locked = null; stage_locked = null;
return true; return true;
} }
}
stage_locked = null; stage_locked = null;
return false; return false;
} }
...@@ -463,14 +480,15 @@ namespace WindBot.Game.AI.Decks ...@@ -463,14 +480,15 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff() public bool Hand_act_eff()
{ {
if (GraveCall_count > 0 && GraveCall_id == Card.Id) return false;
if (Card.Id == CardId.Urara && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false; if (Card.Id == CardId.Urara && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if (Card.Id == CardId.Ghost && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.Ghost)) return false; if (Card.Id == CardId.Ghost && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.Ghost)) return false;
return (LastChainPlayer == 1); return (Duel.LastChainPlayer == 1);
} }
public bool Exterio_counter() public bool Exterio_counter()
{ {
if (LastChainPlayer == 1) if (Duel.LastChainPlayer == 1)
{ {
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
return true; return true;
...@@ -480,7 +498,7 @@ namespace WindBot.Game.AI.Decks ...@@ -480,7 +498,7 @@ namespace WindBot.Game.AI.Decks
public bool G_act() public bool G_act()
{ {
return (Duel.Player == 1); return (Duel.Player == 1 && !(GraveCall_count > 0 && GraveCall_id == Card.Id));
} }
public bool Pink_eff() public bool Pink_eff()
...@@ -526,7 +544,9 @@ namespace WindBot.Game.AI.Decks ...@@ -526,7 +544,9 @@ namespace WindBot.Game.AI.Decks
public bool Eater_ss() public bool Eater_ss()
{ {
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())
{ {
...@@ -545,7 +565,8 @@ namespace WindBot.Game.AI.Decks ...@@ -545,7 +565,8 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
} }
foreach (ClientCard s_c in Bot.SpellZone) Logger.DebugWriteLine("*** Eater use up the extra deck.");
foreach (ClientCard s_c in Bot.GetSpells())
{ {
targets.Add(s_c); targets.Add(s_c);
if (targets.Count >= 5) if (targets.Count >= 5)
...@@ -557,14 +578,22 @@ namespace WindBot.Game.AI.Decks ...@@ -557,14 +578,22 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
public bool Eater_eff()
{
if (Enemy.BattlingMonster.HasPosition(CardPosition.FaceDown)) return true;
if (Enemy.BattlingMonster.HasPosition(CardPosition.Attack) && (Bot.BattlingMonster.Attack - Enemy.BattlingMonster.GetDefensePower() >= Enemy.LifePoints)) return true;
return (Bot.BattlingMonster.Attack <= (Enemy.BattlingMonster.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 (LastChainPlayer == 0 && GetLastChainCard().Id == CardId.Red) if ((AI.Utils.ChainContainsCard(CardId.DarkHole) || AI.Utils.ChainContainsCard(99330325) || AI.Utils.ChainContainsCard(53582587)) && AI.Utils.ChainContainsCard(CardId.Red)) return false;
if (Duel.LastChainPlayer == 0 && AI.Utils.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);
...@@ -572,7 +601,7 @@ namespace WindBot.Game.AI.Decks ...@@ -572,7 +601,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
} }
if (LastChainPlayer == 1) return true; if (Duel.LastChainPlayer == 1) return true;
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
if (AI.Utils.IsTurn1OrMain2()) return false; if (AI.Utils.IsTurn1OrMain2()) return false;
...@@ -582,9 +611,9 @@ namespace WindBot.Game.AI.Decks ...@@ -582,9 +611,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;
...@@ -592,7 +621,7 @@ namespace WindBot.Game.AI.Decks ...@@ -592,7 +621,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);
...@@ -627,7 +656,6 @@ namespace WindBot.Game.AI.Decks ...@@ -627,7 +656,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))
...@@ -659,12 +687,43 @@ namespace WindBot.Game.AI.Decks ...@@ -659,12 +687,43 @@ namespace WindBot.Game.AI.Decks
CardId.White, CardId.White,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Ring, CardId.Crown,
CardId.Yellow
});
return true;
}
if (Enemy.LifePoints <= 1000)
{
if (Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss)
{
AI.SelectCard(new[]
{
CardId.Pink,
CardId.Stage,
CardId.Red,
CardId.White,
CardId.Re,
CardId.Crown,
CardId.Yellow
});
return true;
}
else if (Bot.HasInGraveyard(CardId.Pink) && Bot.GetRemainingCount(CardId.Crown, 1) > 0)
{
AI.SelectCard(new[]
{
CardId.Crown,
CardId.Pink,
CardId.Re,
CardId.Stage,
CardId.Red,
CardId.White,
CardId.Yellow CardId.Yellow
}); });
return true; return true;
} }
else if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2()) }
if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2())
{ {
if (Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss) if (Bot.HasInGraveyard(CardId.Red) && Bot.GetRemainingCount(CardId.Pink, 1) > 0 && !pink_ss)
{ {
...@@ -675,7 +734,7 @@ namespace WindBot.Game.AI.Decks ...@@ -675,7 +734,7 @@ namespace WindBot.Game.AI.Decks
CardId.White, CardId.White,
CardId.Re, CardId.Re,
CardId.Stage, CardId.Stage,
CardId.Ring, CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
} }
...@@ -683,7 +742,7 @@ namespace WindBot.Game.AI.Decks ...@@ -683,7 +742,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Ring, CardId.Crown,
CardId.Red, CardId.Red,
CardId.White, CardId.White,
CardId.Re, CardId.Re,
...@@ -701,15 +760,15 @@ namespace WindBot.Game.AI.Decks ...@@ -701,15 +760,15 @@ namespace WindBot.Game.AI.Decks
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Stage, CardId.Stage,
CardId.Ring, CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
} }
else if (Bot.HasInGraveyard(CardId.White) && Bot.GetRemainingCount(CardId.Ring, 1) > 0) else if (Bot.HasInGraveyard(CardId.White) && Bot.GetRemainingCount(CardId.Crown, 1) > 0)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Ring, CardId.Crown,
CardId.Red, CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
...@@ -725,7 +784,7 @@ namespace WindBot.Game.AI.Decks ...@@ -725,7 +784,7 @@ namespace WindBot.Game.AI.Decks
CardId.Red, CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Ring, CardId.Crown,
CardId.Stage, CardId.Stage,
CardId.White, CardId.White,
CardId.Yellow CardId.Yellow
...@@ -733,10 +792,10 @@ namespace WindBot.Game.AI.Decks ...@@ -733,10 +792,10 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
} }
else 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[]
{ {
...@@ -745,7 +804,7 @@ namespace WindBot.Game.AI.Decks ...@@ -745,7 +804,7 @@ namespace WindBot.Game.AI.Decks
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Stage, CardId.Stage,
CardId.Ring, CardId.Crown,
CardId.Yellow CardId.Yellow
}); });
} }
...@@ -756,46 +815,47 @@ namespace WindBot.Game.AI.Decks ...@@ -756,46 +815,47 @@ namespace WindBot.Game.AI.Decks
CardId.Red, CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Ring, CardId.Crown,
CardId.Stage, CardId.Stage,
CardId.White, CardId.White,
CardId.Yellow CardId.Yellow
}); });
} }
return true; return true;
} else 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,
CardId.Red, CardId.Red,
CardId.White, CardId.White,
CardId.Ring, CardId.Crown,
CardId.Pink, CardId.Pink,
CardId.Stage, CardId.Stage,
CardId.Yellow CardId.Yellow
}); });
return true; return true;
} else }
{
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Red, CardId.Red,
CardId.Pink, CardId.Pink,
CardId.Re, CardId.Re,
CardId.Ring, CardId.Crown,
CardId.Stage, CardId.Stage,
CardId.White, CardId.White,
CardId.Yellow CardId.Yellow
}); });
return true; return true;
} }
}
public bool White_eff() public bool White_eff()
{ {
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();
...@@ -811,6 +871,13 @@ namespace WindBot.Game.AI.Decks ...@@ -811,6 +871,13 @@ namespace WindBot.Game.AI.Decks
white_eff_used = true; white_eff_used = true;
return true; return true;
} }
*/
if (Bot.BattlingMonster == null || Enemy.BattlingMonster == null || !IsTrickstar(Bot.BattlingMonster.Id) || Bot.BattlingMonster.HasPosition(CardPosition.Defence)) return false;
if (Bot.BattlingMonster.Attack <= Enemy.BattlingMonster.RealPower && Bot.BattlingMonster.Attack + Bot.BattlingMonster.BaseAttack >= Enemy.BattlingMonster.RealPower)
{
white_eff_used = true;
return true;
}
return false; return false;
} else } else
{ {
...@@ -824,24 +891,32 @@ namespace WindBot.Game.AI.Decks ...@@ -824,24 +891,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;
...@@ -850,9 +925,14 @@ namespace WindBot.Game.AI.Decks ...@@ -850,9 +925,14 @@ namespace WindBot.Game.AI.Decks
public bool LockBird_act() public bool LockBird_act()
{ {
if (Duel.Player == 0) return false; if (Duel.Player == 0 || lockbird_used) return false;
lockbird_useful = true; lockbird_useful = true;
if (Bot.HasInSpellZone(CardId.Re)) return ChainContainsCard(CardId.Re); if (Bot.HasInSpellZone(CardId.Re))
{
if (AI.Utils.ChainContainsCard(CardId.Re)) lockbird_used = true;
return AI.Utils.ChainContainsCard(CardId.Re);
}
lockbird_used = true;
return true; return true;
} }
...@@ -861,7 +941,7 @@ namespace WindBot.Game.AI.Decks ...@@ -861,7 +941,7 @@ namespace WindBot.Game.AI.Decks
if (Card.Location == CardLocation.Grave) return Ts_reborn(); if (Card.Location == CardLocation.Grave) return Ts_reborn();
if (Bot.HasInHand(CardId.LockBird)) if (Bot.HasInHand(CardId.LockBird))
{ {
if (lockbird_useful || AI.Utils.IsChainTarget(Card) || (Duel.Player == 1 && ChainContainsCard(CardId.Feather))) { if (lockbird_useful || AI.Utils.IsChainTarget(Card) || (Duel.Player == 1 && AI.Utils.ChainContainsCard(CardId.Feather))) {
lockbird_useful = false; lockbird_useful = false;
return true; return true;
} }
...@@ -872,8 +952,12 @@ namespace WindBot.Game.AI.Decks ...@@ -872,8 +952,12 @@ 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 (Bot.HasInHand(CardId.Pink)) {
if (Duel.Phase <= DuelPhase.Main1) return Ts_reborn();
return false;
}
if (Bot.HasInHand(CardId.Pink) && GraveCall_id != CardId.Pink)
{ {
AI.SelectCard(CardId.Pink); AI.SelectCard(CardId.Pink);
return true; return true;
...@@ -897,6 +981,11 @@ namespace WindBot.Game.AI.Decks ...@@ -897,6 +981,11 @@ namespace WindBot.Game.AI.Decks
public bool Ts_reborn() public bool Ts_reborn()
{ {
if (Duel.Player == 0 && Enemy.LifePoints <= 1000)
{
AI.SelectCard(CardId.Pink);
return true;
}
bool can_summon = (Duel.Player == 0 && NormalSummoned); bool can_summon = (Duel.Player == 0 && NormalSummoned);
if (can_summon) if (can_summon)
{ {
...@@ -919,6 +1008,7 @@ namespace WindBot.Game.AI.Decks ...@@ -919,6 +1008,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.Red, CardId.Red,
...@@ -973,8 +1063,9 @@ namespace WindBot.Game.AI.Decks ...@@ -973,8 +1063,9 @@ 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;
int count = 0; int count = 0;
if (Card.Id != CardId.Urara) count += 1; if (Card.Id != CardId.Urara) count += 1;
foreach(ClientCard hand in Bot.Hand) foreach(ClientCard hand in Bot.Hand)
...@@ -996,6 +1087,23 @@ namespace WindBot.Game.AI.Decks ...@@ -996,6 +1087,23 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
public bool Ring_act()
{
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.Ghost) return false;
ClientCard target = AI.Utils.GetProblematicEnemyMonster();
if (target == null && AI.Utils.IsChainTarget(Card))
{
target = AI.Utils.GetBestEnemyMonster();
}
if (target != null)
{
if (Bot.LifePoints <= target.Attack) return false;
AI.SelectCard(target);
return true;
}
return false;
}
public bool Linkuri_ss() public bool Linkuri_ss()
{ {
foreach(ClientCard c in Bot.GetMonsters()) foreach(ClientCard c in Bot.GetMonsters())
...@@ -1011,7 +1119,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1011,7 +1119,7 @@ namespace WindBot.Game.AI.Decks
public bool Linkuri_eff() public bool Linkuri_eff()
{ {
if (LastChainPlayer == 0 && GetLastChainCard().Id == CardId.Linkuri) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuri) return false;
AI.SelectCard(new[] { CardId.Tuner, CardId.BF + 1 }); AI.SelectCard(new[] { CardId.Tuner, CardId.BF + 1 });
return true; return true;
} }
...@@ -1027,9 +1135,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1027,9 +1135,14 @@ namespace WindBot.Game.AI.Decks
}); });
return true; return true;
} }
foreach(ClientCard extra_card in Bot.GetMonstersInExtraZone())
{
if (getLinkMarker(extra_card.Id) >= 5) return false;
}
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach(ClientCard t_check in Bot.GetMonsters()) foreach(ClientCard t_check in Bot.GetMonsters())
{ {
if (t_check.IsFacedown()) continue;
if (t_check.Id == CardId.BF || t_check.Id == CardId.Tuner || t_check.Id == CardId.Urara || t_check.Id == CardId.Ghost) if (t_check.Id == CardId.BF || t_check.Id == CardId.Tuner || t_check.Id == CardId.Urara || t_check.Id == CardId.Ghost)
{ {
targets.Add(t_check); targets.Add(t_check);
...@@ -1037,8 +1150,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1037,8 +1150,11 @@ 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 (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)
{ {
targets.Add(e_check); targets.Add(e_check);
...@@ -1046,7 +1162,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1046,7 +1162,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (targets.Count <= 1) return false; if (targets.Count <= 1) return false;
AI.SelectCard(targets); AI.SelectMaterials(targets);
return true; return true;
} }
...@@ -1077,24 +1193,40 @@ namespace WindBot.Game.AI.Decks ...@@ -1077,24 +1193,40 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location != CardLocation.MonsterZone) return true; if (Card.Location != CardLocation.MonsterZone) return true;
ClientCard target = AI.Utils.GetProblematicEnemySpell(); ClientCard target = AI.Utils.GetProblematicEnemySpell();
if (target != null) AI.SelectCard(target); IList<ClientCard> list = new List<ClientCard>();
if (target != null) list.Add(target);
foreach(ClientCard spells in Enemy.GetSpells())
{
if (spells != null && !list.Contains(spells)) list.Add(spells);
}
AI.SelectCard(list);
return true; return true;
} }
public bool Safedragon_ss() public bool Safedragon_ss()
{ {
if (AI.Utils.IsTurn1OrMain2()) return false;
ClientCard m = AI.Utils.GetProblematicEnemyMonster(); ClientCard m = AI.Utils.GetProblematicEnemyMonster();
if (m == null) foreach(ClientCard ex_m in Bot.GetMonstersInExtraZone())
{ {
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1100 && Duel.Phase < DuelPhase.Battle) if (getLinkMarker(ex_m.Id) >= 4) return false;
}
if ((m == null || m.HasPosition(CardPosition.FaceDown)) && Enemy.LifePoints <= 1100)
{
if (Enemy.GetMonsterCount() == 0 && Duel.Phase < DuelPhase.Battle)
{ {
IList<ClientCard> list = new List<ClientCard>(); IList<ClientCard> list = new List<ClientCard>();
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;
} }
return (list.Count >= 2 && GetTotalATK(list) <= 1100); if (list.Count == 2 && GetTotalATK(list) <= 1100)
{
AI.SelectMaterials(list);
return true;
}
return false;
} }
} }
ClientCard ex_1 = Bot.MonsterZone[5]; ClientCard ex_1 = Bot.MonsterZone[5];
...@@ -1107,12 +1239,13 @@ namespace WindBot.Game.AI.Decks ...@@ -1107,12 +1239,13 @@ 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.SelectCard(targets); AI.SelectMaterials(targets);
return true; return true;
} }
return false; return false;
...@@ -1126,37 +1259,47 @@ namespace WindBot.Game.AI.Decks ...@@ -1126,37 +1259,47 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 1900 && Duel.Phase == DuelPhase.Main1) if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 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) 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;
} }
return (m_list.Count == 2 && GetTotalATK(m_list) <= 1900); if (m_list.Count == 2 && GetTotalATK(m_list) <= 1900)
{
AI.SelectMaterials(m_list);
return true;
}
} }
return false; return false;
} }
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 == Bot.MonsterZone[5] && s_m != Bot.MonsterZone[6]) if (s_m.IsFacedown()) continue;
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;
} }
...@@ -1175,28 +1318,36 @@ namespace WindBot.Game.AI.Decks ...@@ -1175,28 +1318,36 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 2200 && Duel.Phase == DuelPhase.Main1) if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 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)
{ {
link_count += 2; link_count += 2;
m_list.Add(monster); m_list.Add(monster);
} else if (getLinkMarker(monster.Id) == 1) } else if (getLinkMarker(monster.Id) == 1 && monster.IsFaceup())
{ {
link_count += 1; link_count += 1;
m_list.Add(monster); m_list.Add(monster);
} }
if (link_count >= 3) break; if (link_count >= 3) break;
} }
return (link_count >= 3 && GetTotalATK(m_list) <= 2200); if (link_count >= 3 && GetTotalATK(m_list) <= 2200)
{
AI.SelectMaterials(m_list);
return true;
}
} }
return false; return false;
} }
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) 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))
{ {
...@@ -1215,8 +1366,23 @@ namespace WindBot.Game.AI.Decks ...@@ -1215,8 +1366,23 @@ namespace WindBot.Game.AI.Decks
{ {
ClientCard m = AI.Utils.GetProblematicEnemyCard(); ClientCard m = AI.Utils.GetProblematicEnemyCard();
if (m == null) return false; if (m == null) return false;
// avoid cards that cannot target.
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
AI.SelectNextCard(m); IList<ClientCard> enemy_list = new List<ClientCard>();
enemy_list.Add(m);
foreach(ClientCard enemy in Enemy.GetMonstersInExtraZone())
{
if (enemy != null && !enemy_list.Contains(enemy)) enemy_list.Add(enemy);
}
foreach (ClientCard enemy in Enemy.GetMonstersInMainZone())
{
if (enemy != null && !enemy_list.Contains(enemy)) enemy_list.Add(enemy);
}
foreach (ClientCard enemy in Enemy.GetSpells())
{
if (enemy != null && !enemy_list.Contains(enemy)) enemy_list.Add(enemy);
}
AI.SelectNextCard(enemy_list);
return true; return true;
} }
...@@ -1226,14 +1392,16 @@ namespace WindBot.Game.AI.Decks ...@@ -1226,14 +1392,16 @@ namespace WindBot.Game.AI.Decks
// exzone fo first // exzone fo first
foreach (ClientCard e_m in Bot.GetMonstersInExtraZone()) foreach (ClientCard e_m in Bot.GetMonstersInExtraZone())
{ {
if (e_m.Attack < 1900 && !targets.ContainsCardWithId(e_m.Id)) if (e_m.Attack < 1900 && !targets.ContainsCardWithId(e_m.Id) && e_m.IsFaceup())
{ {
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)) if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id) && m.IsFaceup())
{ {
targets.Add(m); targets.Add(m);
} }
...@@ -1286,9 +1454,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1286,9 +1454,10 @@ 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) if (Enemy.GetMonsterCount() == 0 || AI.Utils.GetProblematicEnemyMonster(2000) == null)
{ {
AI.SelectMaterials(material_list); AI.SelectMaterials(material_list);
return true; return true;
...@@ -1315,6 +1484,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1315,6 +1484,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");
else Logger.DebugWriteLine("***borrel:" + (AI.Utils.GetProblematicEnemyMonster(2000).Name ?? "unknown"));
if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000)) if (AI.Utils.GetProblematicEnemyMonster(2000) != null || (Enemy.GetMonsterCount() == 0 && Duel.Phase == DuelPhase.Main1 && Enemy.LifePoints <= 3000))
{ {
foreach(ClientCard e_m in Bot.GetMonstersInExtraZone()) foreach(ClientCard e_m in Bot.GetMonstersInExtraZone())
...@@ -1325,7 +1496,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1325,7 +1496,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)
{ {
...@@ -1355,7 +1529,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1355,7 +1529,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;
...@@ -1368,10 +1545,51 @@ namespace WindBot.Game.AI.Decks ...@@ -1368,10 +1545,51 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
public bool GraveCall_eff()
{
if (Duel.LastChainPlayer == 1)
{
Logger.DebugWriteLine(AI.Utils.GetLastChainCard().Name.ToString());
Logger.DebugWriteLine(AI.Utils.GetLastChainCard().IsMonster().ToString());
Logger.DebugWriteLine(Enemy.HasInGraveyard(AI.Utils.GetLastChainCard().Id).ToString());
if (AI.Utils.GetLastChainCard().IsMonster() && Enemy.HasInGraveyard(AI.Utils.GetLastChainCard().Id))
{
GraveCall_id = AI.Utils.GetLastChainCard().Id;
GraveCall_count = 2;
AI.SelectCard(GraveCall_id);
return true;
}
}
return false;
}
public bool DarkHole_eff()
{
if (Bot.GetMonsterCount() == 0)
{
int bestPower = -1;
foreach (ClientCard hand in Bot.Hand)
{
if (hand.IsMonster() && hand.Attack > bestPower) bestPower = hand.Attack;
}
int bestenemy = -1;
foreach (ClientCard enemy in Enemy.GetMonsters())
{
if (enemy.IsMonsterDangerous()) return true;
if (enemy.IsFaceup() && (enemy.GetDefensePower() > bestenemy)) bestenemy = enemy.GetDefensePower();
}
return (bestPower <= bestenemy);
}
return false;
}
public bool MonsterRepos() public bool MonsterRepos()
{ {
if (Card.Id == CardId.Eater && Card.IsAttack()) return false; if (Card.Id == CardId.Eater && Card.IsAttack()) return false;
if (IsTrickstar(Card.Id) && !white_eff_used && Bot.HasInHand(CardId.White) && Card.IsAttack() && Duel.Phase == DuelPhase.Main1) return false;
if (Card.IsFaceup() && Card.IsDefense() && Card.Attack == 0) if (Card.IsFaceup() && Card.IsDefense() && Card.Attack == 0)
return false; return false;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
...@@ -1399,6 +1617,60 @@ namespace WindBot.Game.AI.Decks ...@@ -1399,6 +1617,60 @@ namespace WindBot.Game.AI.Decks
red_ss_count = 0; red_ss_count = 0;
white_eff_used = false; white_eff_used = false;
lockbird_useful = false; lockbird_useful = false;
lockbird_used = false;
if (GraveCall_count > 0)
{
if (--GraveCall_count <= 0)
{
GraveCall_id = 0;
}
}
}
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 (!defender.IsMonsterHasPreventActivationEffectInBattle() && !attacker.IsDisabled())
{
if ((attacker.Id == CardId.Eater && !defender.HasType(CardType.Token) && GraveCall_id != CardId.Eater) || attacker.Id == CardId.borrel) return AI.Attack(attacker, defender);
}
if (!OnPreBattleBetween(attacker, defender))
continue;
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)
...@@ -1407,8 +1679,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1407,8 +1679,6 @@ namespace WindBot.Game.AI.Decks
{ {
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)
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