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
public const int Abyss = 9753964;
public const int Exterio = 99916754;
public const int Ultimate = 86221741;
public const int Cardian = 87460579;
public const int Missus = 3987233;
}
......@@ -88,6 +89,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Ring, Ring_act);
AddExecutor(ExecutorType.Activate, CardId.Abyss, Abyss_eff);
AddExecutor(ExecutorType.Activate, CardId.Exterio, Exterio_counter);
AddExecutor(ExecutorType.Activate, CardId.Cardian);
// spell clean
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock);
......@@ -95,36 +97,36 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Galaxy, GalaxyCyclone);
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);
// ex 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.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.SafeDra, Safedragon_ss);
AddExecutor(ExecutorType.Activate, CardId.Linkuri, Linkuri_eff);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuri, Linkuri_ss);
AddExecutor(ExecutorType.SpSummon, CardId.unicorn, Unicorn_ss);
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
AddExecutor(ExecutorType.Activate, CardId.Trans);
AddExecutor(ExecutorType.SpSummon, CardId.BF, BF_pos);
AddExecutor(ExecutorType.Activate, CardId.BF, BF_pos);
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);
// ts
......@@ -426,26 +428,26 @@ namespace WindBot.Game.AI.Decks
stage_locked = null;
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[]
{
CardId.Red,
CardId.Pink,
CardId.White,
CardId.Yellow,
CardId.White
CardId.Pink,
CardId.Red
});
stage_locked = null;
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[]
{
CardId.White,
CardId.Yellow,
CardId.Red,
CardId.Pink,
CardId.Red
CardId.Yellow,
CardId.White
});
stage_locked = null;
return true;
......@@ -536,6 +538,7 @@ namespace WindBot.Game.AI.Decks
{
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> targets = new List<ClientCard>();
if (Bot.SpellZone[5] != null && Bot.SpellZone[5].IsFacedown())
{
......@@ -550,17 +553,16 @@ namespace WindBot.Game.AI.Decks
targets.Add(e_c);
if (targets.Count >= 5)
{
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(targets);
return true;
}
}
Logger.DebugWriteLine("*** Eater use up the extra deck.");
foreach (ClientCard s_c in Bot.GetSpells())
{
targets.Add(s_c);
if (targets.Count >= 5)
{
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(targets);
return true;
}
......@@ -568,14 +570,25 @@ namespace WindBot.Game.AI.Decks
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()
{
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)
{
foreach (ClientCard m in Bot.GetMonsters())
{
if (AI.Utils.IsChainTarget(m))
if (AI.Utils.IsChainTarget(m) && IsTrickstar(m.Id))
{
red_ss_count += 1;
AI.SelectCard(m);
......@@ -593,9 +606,9 @@ namespace WindBot.Game.AI.Decks
ClientCard tosolve_enemy = AI.Utils.GetOneEnemyBetterThanMyBest();
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);
red_ss_count += 1;
......@@ -603,7 +616,7 @@ namespace WindBot.Game.AI.Decks
}
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);
AI.SelectCard(c);
......@@ -638,7 +651,6 @@ namespace WindBot.Game.AI.Decks
}
} else
{
if ((ChainContainsCard(53129443) || ChainContainsCard(99330325)) && ChainContainsCard(CardId.Red)) return false;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
if (!Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(1600, true))
......@@ -675,109 +687,110 @@ namespace WindBot.Game.AI.Decks
});
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[]
{
CardId.Pink,
CardId.Stage,
CardId.Red,
CardId.White,
CardId.Re,
CardId.Stage,
CardId.Crown,
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[]
{
CardId.Crown,
CardId.Red,
CardId.White,
CardId.Pink,
CardId.Re,
CardId.Stage,
CardId.Pink,
CardId.Red,
CardId.White,
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[]
{
CardId.White,
CardId.Red,
CardId.Pink,
CardId.Red,
CardId.White,
CardId.Re,
CardId.Stage,
CardId.Crown,
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[]
{
CardId.Crown,
CardId.Red,
CardId.Pink,
CardId.White,
CardId.Re,
CardId.Stage,
CardId.White,
CardId.Pink,
CardId.Yellow
});
}
else
else if (Bot.GetRemainingCount(CardId.White, 2) > 0 && Duel.LifePoints[1] <= 4000)
{
AI.SelectCard(new[]
{
CardId.White,
CardId.Red,
CardId.Pink,
CardId.Re,
CardId.Crown,
CardId.Stage,
CardId.White,
CardId.Crown,
CardId.Yellow
});
}
return true;
}
if (Duel.LifePoints[1] <= 1000)
{
if (Bot.GetRemainingCount(CardId.Pink,1) > 0 && !pink_ss)
else if (Bot.HasInGraveyard(CardId.White) && Bot.GetRemainingCount(CardId.Crown, 1) > 0)
{
AI.SelectCard(new[]
{
CardId.Crown,
CardId.Red,
CardId.Pink,
CardId.Re,
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)
}
else
{
AI.SelectCard(new[]
{
CardId.Crown,
CardId.Red,
CardId.Pink,
CardId.Re,
CardId.Crown,
CardId.Stage,
CardId.Red,
CardId.White,
CardId.Yellow
});
return true;
}
return true;
}
if (AI.Utils.GetProblematicEnemyMonster() != null)
{
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[]
{
......@@ -805,7 +818,8 @@ namespace WindBot.Game.AI.Decks
}
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[]
{
CardId.Re,
......@@ -836,6 +850,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
// from blackwing
/*
ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyATK = Enemy.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyDEF = Enemy.GetMonsters().GetHighestDefenseMonster();
......@@ -851,6 +866,15 @@ namespace WindBot.Game.AI.Decks
white_eff_used = 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;
} else
{
......@@ -864,24 +888,32 @@ namespace WindBot.Game.AI.Decks
ClientCard self_card = Bot.GetMonsters().GetHighestAttackMonster();
if (tosolve == null || self_card == null || (tosolve != null && self_card != null && !IsTrickstar(self_card.Id)))
{
if (Enemy.GetMonsters().GetLowestAttackMonster() == null ||
Enemy.GetMonsters().GetLowestDefenseMonster() == null ||
Enemy.GetMonsters().GetLowestAttackMonster().Attack < 2000 ||
Enemy.GetMonsters().GetLowestDefenseMonster().Defense < 2000)
if (Enemy.GetMonsters().GetHighestAttackMonster()== null ||
Enemy.GetMonsters().GetHighestDefenseMonster() == null ||
Enemy.GetMonsters().GetHighestAttackMonster().GetDefensePower() < 2000 ||
Enemy.GetMonsters().GetHighestDefenseMonster().GetDefensePower() < 2000)
{
white_eff_used = true;
return true;
}
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();
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;
}
else if (defender_power <= 2000)
{
white_eff_used = true;
return true;
}
}
}
return false;
......@@ -917,7 +949,11 @@ namespace WindBot.Game.AI.Decks
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))
{
AI.SelectCard(CardId.Pink);
......@@ -1024,7 +1060,7 @@ namespace WindBot.Game.AI.Decks
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 (Card.Id == CardId.Ghost && Bot.GetRemainingCount(CardId.Ghost, 2) <= 0) return false;
int count = 0;
......@@ -1051,7 +1087,18 @@ namespace WindBot.Game.AI.Decks
public bool Ring_act()
{
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()
......@@ -1100,7 +1147,9 @@ namespace WindBot.Game.AI.Decks
}
}
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)
......@@ -1153,12 +1202,13 @@ namespace WindBot.Game.AI.Decks
public bool Safedragon_ss()
{
if (AI.Utils.IsTurn1OrMain2()) return false;
ClientCard m = AI.Utils.GetProblematicEnemyMonster();
foreach(ClientCard ex_m in Bot.GetMonstersInExtraZone())
{
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)
{
......@@ -1166,9 +1216,9 @@ namespace WindBot.Game.AI.Decks
foreach(ClientCard monster in Bot.GetMonsters())
{
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);
return true;
......@@ -1186,10 +1236,11 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> targets = new List<ClientCard>();
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 (targets.Count >= 2) break;
if (targets.Count == 2) break;
}
if (targets.Count >= 2)
if (targets.Count == 2)
{
AI.SelectMaterials(targets);
return true;
......@@ -1205,7 +1256,9 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 1900 && Duel.Phase == DuelPhase.Main1)
{
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 (m_list.Count == 2) break;
......@@ -1220,27 +1273,30 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.Hand.Count == 0) return false;
IList<ClientCard> targets = new List<ClientCard>();
ClientCard ex_zone = null;
foreach (ClientCard s_m in Bot.GetMonsters())
List<ClientCard> main_list = new List<ClientCard>(Bot.GetMonstersInMainZone());
main_list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard s_m in main_list)
{
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;
}
else
targets.Add(s_m);
};
if (targets.Count == 2) break;
}
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))
{
targets.Add(s_m);
};
};
if (targets.Count >= 2) break;
}
if (targets.Count < 2)
{
targets.Add(ex_zone);
if (targets.Count == 2) break;
}
}
if (targets.Count < 2) return false;
AI.SelectMaterials(targets);
return true;
}
......@@ -1259,7 +1315,9 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Duel.LifePoints[1] <= 2200 && Duel.Phase == DuelPhase.Main1)
{
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)
{
......@@ -1282,9 +1340,11 @@ namespace WindBot.Game.AI.Decks
}
if (Bot.Hand.Count == 0) return false;
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))
{
......@@ -1334,7 +1394,9 @@ namespace WindBot.Game.AI.Decks
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())
{
......@@ -1389,6 +1451,7 @@ namespace WindBot.Game.AI.Decks
foreach(ClientCard monster in Bot.GetMonsters())
{
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 (Enemy.GetMonsterCount() == 0 || AI.Utils.GetProblematicEnemyMonster(2000) == null)
......@@ -1418,8 +1481,8 @@ namespace WindBot.Game.AI.Decks
{
bool already_link2 = false;
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==null ? "unknown" : AI.Utils.GetProblematicEnemyMonster(2000).Name));
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 && Duel.LifePoints[1] <= 3000))
{
foreach(ClientCard e_m in Bot.GetMonstersInExtraZone())
......@@ -1430,7 +1493,10 @@ namespace WindBot.Game.AI.Decks
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)
{
......@@ -1460,7 +1526,10 @@ namespace WindBot.Game.AI.Decks
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 WorstBot = Bot.GetMonsters().GetLowestAttackMonster();
if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false;
......@@ -1509,14 +1578,59 @@ namespace WindBot.Game.AI.Decks
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)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (IsTrickstar(attacker.Id) && Bot.HasInHand(CardId.White) && !white_eff_used)
attacker.RealPower = attacker.RealPower * 2;
else if (attacker.Id == CardId.Eater && !defender.HasType(CardType.Token))
attacker.RealPower = 99999;
}
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