Commit 82d2241f authored by wind2009's avatar wind2009 Committed by mercury233

Update TrickstarExecutor.cs

Fix borreload dragon's effect.
Fix Eater of Millions' repos.
parent 8763f440
...@@ -43,10 +43,10 @@ namespace WindBot.Game.AI.Decks ...@@ -43,10 +43,10 @@ namespace WindBot.Game.AI.Decks
public const int Linkspi = 98978921; public const int Linkspi = 98978921;
public const int SafeDra = 99111753; public const int SafeDra = 99111753;
public const int Crystal = 50588353; public const int Crystal = 50588353;
public const int phoneix = 2857636; public const int Phoneix = 2857636;
public const int unicorn = 38342335; public const int Unicorn = 38342335;
public const int snake = 74997493; public const int Snake = 74997493;
public const int borrel = 31833038; public const int Borrel = 31833038;
public const int TG = 98558751; public const int TG = 98558751;
public const int Beelze = 34408491; public const int Beelze = 34408491;
...@@ -60,10 +60,10 @@ namespace WindBot.Game.AI.Decks ...@@ -60,10 +60,10 @@ 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 || id == CardId.Cardian) return 5; else if (id == CardId.Abyss || id == CardId.Beelze || id == CardId.Exterio || id == CardId.Ultimate || id == CardId.Cardian) 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;
} }
...@@ -108,26 +108,26 @@ namespace WindBot.Game.AI.Decks ...@@ -108,26 +108,26 @@ namespace WindBot.Game.AI.Decks
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.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.snake, Snake_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.SafeDra, DefaultCompulsoryEvacuationDevice); AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.Linkuri, Linkuri_eff); 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.Unicorn, Unicorn_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Linkspi); AddExecutor(ExecutorType.SpSummon, CardId.Linkspi);
// ex_monster act // ex_monster act
AddExecutor(ExecutorType.Activate, CardId.Beelze); AddExecutor(ExecutorType.Activate, CardId.Beelze);
AddExecutor(ExecutorType.Activate, CardId.Missus, Missus_eff); AddExecutor(ExecutorType.Activate, CardId.Missus, Missus_eff);
AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff); AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff);
AddExecutor(ExecutorType.Activate, CardId.phoneix, Phoneix_eff); AddExecutor(ExecutorType.Activate, CardId.Phoneix, Phoneix_eff);
AddExecutor(ExecutorType.Activate, CardId.unicorn, Unicorn_eff); AddExecutor(ExecutorType.Activate, CardId.Unicorn, Unicorn_eff);
AddExecutor(ExecutorType.Activate, CardId.snake, Snake_eff); AddExecutor(ExecutorType.Activate, CardId.Snake, Snake_eff);
AddExecutor(ExecutorType.Activate, CardId.borrel, Borrel_eff); AddExecutor(ExecutorType.Activate, CardId.Borrel, Borrel_eff);
// normal act // normal act
AddExecutor(ExecutorType.Activate, CardId.Trans); AddExecutor(ExecutorType.Activate, CardId.Trans);
...@@ -168,7 +168,7 @@ namespace WindBot.Game.AI.Decks ...@@ -168,7 +168,7 @@ namespace WindBot.Game.AI.Decks
public bool Has_down_arrow(int id) public bool Has_down_arrow(int id)
{ {
return (id == CardId.Linkuri || id == CardId.Linkspi || id == CardId.unicorn); return (id == CardId.Linkuri || id == CardId.Linkspi || id == CardId.Unicorn);
} }
public bool IsTrickstar(int id) public bool IsTrickstar(int id)
...@@ -223,7 +223,7 @@ namespace WindBot.Game.AI.Decks ...@@ -223,7 +223,7 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonstersExtraZoneCount() > 1) judge = false; // exlink if (Enemy.GetMonstersExtraZoneCount() > 1) judge = false; // exlink
if (Bot.GetMonstersExtraZoneCount() >= 1) if (Bot.GetMonstersExtraZoneCount() >= 1)
{ {
foreach(ClientCard card in Bot.GetMonstersInExtraZone()) foreach (ClientCard card in Bot.GetMonstersInExtraZone())
{ {
if (getLinkMarker(card.Id) == 5) judge = false; if (getLinkMarker(card.Id) == 5) judge = false;
} }
...@@ -236,14 +236,17 @@ namespace WindBot.Game.AI.Decks ...@@ -236,14 +236,17 @@ namespace WindBot.Game.AI.Decks
ClientCard ex_best = null; ClientCard ex_best = null;
foreach (ClientCard ex_card in ex) foreach (ClientCard ex_card in ex)
{ {
if (!fornextss) { if (!fornextss)
{
if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card; if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card;
} else }
else
{ {
if (getLinkMarker(ex_card.Id) != 5 && (ex_best == null || ex_card.Attack > ex_best.Attack)) ex_best = ex_card; if (getLinkMarker(ex_card.Id) != 5 && (ex_best == null || ex_card.Attack > ex_best.Attack)) ex_best = ex_card;
} }
} }
if (ex_best != null) { if (ex_best != null)
{
AI.SelectCard(ex_best); AI.SelectCard(ex_best);
} }
} }
...@@ -252,10 +255,11 @@ namespace WindBot.Game.AI.Decks ...@@ -252,10 +255,11 @@ namespace WindBot.Game.AI.Decks
// cannot ss from exdeck or have more than 1 grass in chain // cannot ss from exdeck or have more than 1 grass in chain
int[] secondselect = new[] int[] secondselect = new[]
{ {
CardId.borrel, CardId.Borrel,
CardId.Ultimate, CardId.Ultimate,
CardId.Abyss, CardId.Abyss,
CardId.Cardian, CardId.Cardian,
CardId.Exterio,
CardId.Ghost, CardId.Ghost,
CardId.White, CardId.White,
CardId.Red, CardId.Red,
...@@ -661,17 +665,14 @@ namespace WindBot.Game.AI.Decks ...@@ -661,17 +665,14 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> monster_list = Bot.GetMonsters(); List<ClientCard> monster_list = Bot.GetMonsters();
monster_list.Sort(AIFunctions.CompareCardAttack); monster_list.Sort(AIFunctions.CompareCardAttack);
monster_list.Reverse(); monster_list.Reverse();
ClientCard self_best = null;
foreach(ClientCard card in monster_list) foreach(ClientCard card in monster_list)
{ {
if (IsTrickstar(card.Id) && card != return_card && card.HasPosition(CardPosition.Attack)) if (IsTrickstar(card.Id) && card != return_card && card.HasPosition(CardPosition.Attack))
{ {
self_best = card; int this_power = (Bot.HasInHand(CardId.White) && !white_eff_used) ? (card.RealPower + card.Attack) : card.RealPower;
break; if (this_power >= self_power) self_power = this_power;
} } else if (card.RealPower >= self_power) self_power = card.RealPower;
} }
if (self_best != null) self_power = (Bot.HasInHand(CardId.White)) ? (self_best.Attack + self_best.RealPower) : self_best.Attack;
} }
ClientCard bestenemy = AI.Utils.GetOneEnemyBetterThanValue(self_power, true); ClientCard bestenemy = AI.Utils.GetOneEnemyBetterThanValue(self_power, true);
if (bestenemy != null) AI.SelectPosition(CardPosition.FaceUpDefence); if (bestenemy != null) AI.SelectPosition(CardPosition.FaceUpDefence);
...@@ -1510,8 +1511,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1510,8 +1511,8 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
return true; return true;
} }
//if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 2)) return true; //if (ActivateDescription == AI.Utils.GetStringId(CardId.Snake, 2)) return true;
if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 1)) if (ActivateDescription == AI.Utils.GetStringId(CardId.Snake, 1))
{ {
foreach(ClientCard hand in Bot.Hand) foreach(ClientCard hand in Bot.Hand)
{ {
...@@ -1546,7 +1547,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1546,7 +1547,7 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectMaterials(material_list); AI.SelectMaterials(material_list);
return true; return true;
} else if (AI.Utils.GetProblematicEnemyMonster(2000) != null && Bot.HasInExtra(CardId.borrel) && !Bot.HasInMonstersZone(CardId.Missus)) } else if (AI.Utils.GetProblematicEnemyMonster(2000) != null && Bot.HasInExtra(CardId.Borrel) && !Bot.HasInMonstersZone(CardId.Missus))
{ {
AI.SelectMaterials(material_list); AI.SelectMaterials(material_list);
return true; return true;
...@@ -1560,7 +1561,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1560,7 +1561,7 @@ namespace WindBot.Game.AI.Decks
{ {
CardId.MG, CardId.MG,
CardId.Missus, CardId.Missus,
CardId.snake CardId.Snake
}); });
return true; return true;
} }
...@@ -1620,7 +1621,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1620,7 +1621,7 @@ namespace WindBot.Game.AI.Decks
{ {
return (Card.Attack - enemy_monster.Attack < Enemy.LifePoints); return (Card.Attack - enemy_monster.Attack < Enemy.LifePoints);
} }
else return false; return true;
}; };
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true); ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true);
ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster(); ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster();
...@@ -1670,15 +1671,30 @@ namespace WindBot.Game.AI.Decks ...@@ -1670,15 +1671,30 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
public bool IsAllEnemyBetter()
{
int bestPower = -1;
for (int i = 0; i < 7; ++i)
{
ClientCard card = Bot.MonsterZone[i];
if (card == null || card.Data == null) continue;
int newPower = card.Attack;
if (IsTrickstar(card.Id) && Bot.HasInHand(CardId.White) && !white_eff_used) newPower += card.RealPower;
if (newPower > bestPower)
bestPower = newPower;
}
return AI.Utils.IsAllEnemyBetterThanValue(bestPower,true);
}
public bool MonsterRepos() public bool MonsterRepos()
{ {
if (Card.Id == CardId.Eater && Card.HasPosition(CardPosition.Attack)) return false; if (Card.Id == CardId.Eater) return (!Card.HasPosition(CardPosition.Attack));
if (IsTrickstar(Card.Id) && !white_eff_used && Bot.HasInHand(CardId.White) && Card.IsAttack() && Duel.Phase == DuelPhase.Main1) 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 = IsAllEnemyBetter();
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
...@@ -1731,7 +1747,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1731,7 +1747,8 @@ namespace WindBot.Game.AI.Decks
if (!defender.IsMonsterHasPreventActivationEffectInBattle() && !attacker.IsDisabled()) 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 ((attacker.Id == CardId.Eater && !defender.HasType(CardType.Token)) || attacker.Id == CardId.Borrel) return AI.Attack(attacker, defender);
if ((attacker.Id == CardId.Ultimate || attacker.Id == CardId.Cardian) && attacker.RealPower > defender.RealPower) return AI.Attack(attacker, defender);
} }
if (!OnPreBattleBetween(attacker, defender)) if (!OnPreBattleBetween(attacker, defender))
...@@ -1752,7 +1769,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1752,7 +1769,7 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < attackers.Count; ++i) for (int i = 0; i < attackers.Count; ++i)
{ {
ClientCard attacker = attackers[i]; ClientCard attacker = attackers[i];
if (attacker.Id == CardId.borrel || attacker.Id == CardId.Eater) return attacker; if (attacker.Id == CardId.Borrel || attacker.Id == CardId.Eater) return attacker;
} }
return null; return null;
} }
......
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