Commit 7906809b authored by wind2009's avatar wind2009 Committed by GitHub

Update TrickstarExecutor.cs

Add Process of Droll & Lock Bird, トリックスター・マジカローラ and やぶ蛇
Saryuja Skull Dread use monsters in extrazone first.
parent db08e6e1
...@@ -21,6 +21,7 @@ namespace WindBot.Game.AI.Decks ...@@ -21,6 +21,7 @@ namespace WindBot.Game.AI.Decks
public const int MG = 23434538; public const int MG = 23434538;
public const int Tuner = 67441435; public const int Tuner = 67441435;
public const int Eater = 63845230; public const int Eater = 63845230;
public const int LockBird = 94145021;
public const int Feather = 18144506; public const int Feather = 18144506;
public const int Galaxy = 5133471; public const int Galaxy = 5133471;
...@@ -34,20 +35,20 @@ namespace WindBot.Game.AI.Decks ...@@ -34,20 +35,20 @@ namespace WindBot.Game.AI.Decks
public const int Ring = 83555666; public const int Ring = 83555666;
public const int Strike = 40605147; public const int Strike = 40605147;
public const int Warn = 84749824; public const int Warn = 84749824;
public const int Grass = 10813327;
public const int Linkuri = 41999284; public const int Linkuri = 41999284;
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 downer = 77058170;
public const int phoneix = 2857636; public const int phoneix = 2857636;
public const int unicorn = 38342335; public const int unicorn = 38342335;
public const int firewall = 5043010;
public const int snake = 74997493; public const int snake = 74997493;
public const int borrel = 31833038; public const int borrel = 31833038;
public const int boomer = 5821478;
public const int TG = 98558751; public const int TG = 98558751;
public const int Beelze = 34408491;
public const int Abyss = 9753964;
} }
public int getLinkMarker(int id) public int getLinkMarker(int id)
...@@ -65,6 +66,8 @@ namespace WindBot.Game.AI.Decks ...@@ -65,6 +66,8 @@ namespace WindBot.Game.AI.Decks
bool tuner_eff_used = false; bool tuner_eff_used = false;
bool crystal_eff_used = false; bool crystal_eff_used = false;
int red_ss_count = 0; int red_ss_count = 0;
bool white_eff_used = false;
bool lockbird_useful = false;
public TrickstarExecutor(GameAI ai, Duel duel) public TrickstarExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
...@@ -73,9 +76,11 @@ namespace WindBot.Game.AI.Decks ...@@ -73,9 +76,11 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.MG, G_act); AddExecutor(ExecutorType.Activate, CardId.MG, G_act);
AddExecutor(ExecutorType.Activate, CardId.Strike, DefaultSolemnStrike); AddExecutor(ExecutorType.Activate, CardId.Strike, DefaultSolemnStrike);
AddExecutor(ExecutorType.Activate, CardId.Warn, DefaultSolemnWarning); AddExecutor(ExecutorType.Activate, CardId.Warn, DefaultSolemnWarning);
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, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.Abyss, Abyss_eff);
// spell clean // spell clean
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock); AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_Lock);
...@@ -84,6 +89,7 @@ namespace WindBot.Game.AI.Decks ...@@ -84,6 +89,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.TG, TG_eff); AddExecutor(ExecutorType.Activate, CardId.TG, TG_eff);
// ex_monster act // ex_monster act
AddExecutor(ExecutorType.Activate, CardId.Beelze);
AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff); AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff);
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);
...@@ -108,14 +114,16 @@ namespace WindBot.Game.AI.Decks ...@@ -108,14 +114,16 @@ namespace WindBot.Game.AI.Decks
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);
AddExecutor(ExecutorType.Activate, CardId.LockBird, LockBird_act);
// ts // ts
AddExecutor(ExecutorType.Activate, CardId.Stage, Stage_act); 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.Red, Red_ss); AddExecutor(ExecutorType.Activate, CardId.Red, Red_ss);
AddExecutor(ExecutorType.Activate, CardId.Yellow, Yellow_eff); AddExecutor(ExecutorType.Activate, CardId.Yellow, Yellow_eff);
AddExecutor(ExecutorType.Activate, CardId.White, White_eff); AddExecutor(ExecutorType.Activate, CardId.White, White_eff);
AddExecutor(ExecutorType.Activate, CardId.Re, Reincarnation); AddExecutor(ExecutorType.Activate, CardId.Crown, Crown_eff);
AddExecutor(ExecutorType.Summon, CardId.Yellow, Yellow_sum); AddExecutor(ExecutorType.Summon, CardId.Yellow, Yellow_sum);
AddExecutor(ExecutorType.Summon, CardId.Red, Red_sum); AddExecutor(ExecutorType.Summon, CardId.Red, Red_sum);
AddExecutor(ExecutorType.Summon, CardId.Pink, Pink_sum); AddExecutor(ExecutorType.Summon, CardId.Pink, Pink_sum);
...@@ -130,7 +138,6 @@ namespace WindBot.Game.AI.Decks ...@@ -130,7 +138,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SummonOrSet, CardId.Red); AddExecutor(ExecutorType.SummonOrSet, CardId.Red);
AddExecutor(ExecutorType.SummonOrSet, CardId.Pink); AddExecutor(ExecutorType.SummonOrSet, CardId.Pink);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet); AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
} }
public bool Has_down_arrow(int id) public bool Has_down_arrow(int id)
...@@ -147,8 +154,9 @@ namespace WindBot.Game.AI.Decks ...@@ -147,8 +154,9 @@ namespace WindBot.Game.AI.Decks
{ {
return new[] return new[]
{ {
CardId.Crown,
CardId.Tuner, CardId.Tuner,
CardId.Grass,
CardId.Crown,
CardId.Pink, CardId.Pink,
CardId.Pot, CardId.Pot,
CardId.BF, CardId.BF,
...@@ -171,6 +179,52 @@ namespace WindBot.Game.AI.Decks ...@@ -171,6 +179,52 @@ namespace WindBot.Game.AI.Decks
}; };
} }
public bool Grass_ss()
{
if (Bot.ExtraDeck.Count > 0)
{
IList<ClientCard> ex = Bot.ExtraDeck;
ClientCard ex_best = null;
foreach (ClientCard ex_card in ex)
{
if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card;
}
if (ex_best != null) {
AI.SelectCard(ex_best);
}
return true;
}
return true;
}
public bool Abyss_eff()
{
// tuner ss
if (ActivateDescription == -1)
{
AI.SelectCard(new[]
{
CardId.Ghost,
CardId.TG,
CardId.Tuner,
CardId.Urara,
CardId.BF
});
return true;
};
// counter
if (!Enemy.HasInMonstersZone(CardId.Ghost) || Enemy.GetHandCount() <= 1)
{
ClientCard tosolve = AI.Utils.GetProblematicEnemyCard();
if (tosolve != null)
{
AI.SelectCard(tosolve);
return true;
}
}
return false;
}
public bool Stage_Lock() public bool Stage_Lock()
{ {
if (Card.Location != CardLocation.SpellZone) return false; if (Card.Location != CardLocation.SpellZone) return false;
...@@ -224,14 +278,9 @@ namespace WindBot.Game.AI.Decks ...@@ -224,14 +278,9 @@ namespace WindBot.Game.AI.Decks
public bool Feather_Act() public bool Feather_Act()
{ {
List<ClientCard> spells = Enemy.GetSpells(); if (AI.Utils.GetProblematicEnemySpell() != null)
foreach (ClientCard card in spells)
{
// 有常用贴纸
if (card.Id == 5851097 || card.Id == 30241314 || card.Id == 81674782 || card.Id == 58921041 || card.Id == 59305593)
{ {
List<ClientCard> grave = Bot.GetGraveyardSpells(); List<ClientCard> grave = Bot.GetGraveyardSpells();
// 墓地有银河旋风则不发动
foreach (ClientCard self_card in grave) foreach (ClientCard self_card in grave)
{ {
if (self_card.Id == CardId.Galaxy) if (self_card.Id == CardId.Galaxy)
...@@ -239,9 +288,8 @@ namespace WindBot.Game.AI.Decks ...@@ -239,9 +288,8 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
} }
} // activate when more than 2 cards
// 2张以上才发动 if (Enemy.GetSpellCount() <= 1)
if (spells.Count <= 1)
return false; return false;
return true; return true;
} }
...@@ -250,7 +298,7 @@ namespace WindBot.Game.AI.Decks ...@@ -250,7 +298,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)) return true; if (LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (GetLastChainCard().Id == CardId.Feather && !Bot.HasInSpellZone(CardId.Grass)))) return true;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2) if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{ {
int total_atk = 0; int total_atk = 0;
...@@ -516,6 +564,7 @@ namespace WindBot.Game.AI.Decks ...@@ -516,6 +564,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInHand(CardId.White) && c.Attack * 2 < tosolve_enemy.Attack) if (Bot.HasInHand(CardId.White) && c.Attack * 2 < tosolve_enemy.Attack)
{ {
if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c); AI.SelectCard(c);
red_ss_count += 1; red_ss_count += 1;
return true; return true;
...@@ -528,6 +577,7 @@ namespace WindBot.Game.AI.Decks ...@@ -528,6 +577,7 @@ namespace WindBot.Game.AI.Decks
} }
if (!Bot.HasInHand(CardId.White) && c.Attack < tosolve_enemy.Attack) if (!Bot.HasInHand(CardId.White) && c.Attack < tosolve_enemy.Attack)
{ {
if (tosolve_enemy.Attack > 1600) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c); AI.SelectCard(c);
red_ss_count += 1; red_ss_count += 1;
return true; return true;
...@@ -538,6 +588,7 @@ namespace WindBot.Game.AI.Decks ...@@ -538,6 +588,7 @@ 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))
...@@ -700,23 +751,37 @@ namespace WindBot.Game.AI.Decks ...@@ -700,23 +751,37 @@ namespace WindBot.Game.AI.Decks
if (bestMy == null || (bestEnemyATK == null && bestEnemyDEF == null)) if (bestMy == null || (bestEnemyATK == null && bestEnemyDEF == null))
return false; return false;
if (bestEnemyATK != null && bestMy.Attack <= bestEnemyATK.Attack && bestMy.Attack * 2 >= bestEnemyATK.Attack) if (bestEnemyATK != null && bestMy.Attack <= bestEnemyATK.Attack && bestMy.Attack * 2 >= bestEnemyATK.Attack)
{
white_eff_used = true;
return true; return true;
}
if (bestEnemyDEF != null && bestMy.Attack <= bestEnemyDEF.Defense && bestMy.Attack * 2 >= bestEnemyDEF.Defense) if (bestEnemyDEF != null && bestMy.Attack <= bestEnemyDEF.Defense && bestMy.Attack * 2 >= bestEnemyDEF.Defense)
{
white_eff_used = true;
return true; return true;
}
return false; return false;
} else } else
{ {
if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2()) return true; if (Enemy.GetMonsterCount() == 0 && !AI.Utils.IsTurn1OrMain2()) {
white_eff_used = true;
return true;
}
else if (Enemy.GetMonsterCount() != 0) else if (Enemy.GetMonsterCount() != 0)
{ {
ClientCard tosolve = AI.Utils.GetBestEnemyMonster(true); ClientCard tosolve = AI.Utils.GetBestEnemyMonster(true);
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)))
{ {
return (Enemy.GetMonsters().GetLowestAttackMonster() == null || if (Enemy.GetMonsters().GetLowestAttackMonster() == null ||
Enemy.GetMonsters().GetLowestDefenseMonster() == null || Enemy.GetMonsters().GetLowestDefenseMonster() == null ||
Enemy.GetMonsters().GetLowestAttackMonster().Attack < 2000 || Enemy.GetMonsters().GetLowestAttackMonster().Attack < 2000 ||
Enemy.GetMonsters().GetLowestDefenseMonster().Defense < 2000); Enemy.GetMonsters().GetLowestDefenseMonster().Defense < 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))
{ {
...@@ -732,12 +797,53 @@ namespace WindBot.Game.AI.Decks ...@@ -732,12 +797,53 @@ namespace WindBot.Game.AI.Decks
} }
} }
public bool LockBird_act()
{
if (Duel.Player == 0) return false;
lockbird_useful = true;
if (Bot.HasInSpellZone(CardId.Re)) return ChainContainsCard(CardId.Re);
return false;
}
public bool Reincarnation() public bool Reincarnation()
{ {
if (Card.Location == CardLocation.Grave) return Ts_reborn(); if (Card.Location == CardLocation.Grave) return Ts_reborn();
if (Bot.HasInHand(CardId.LockBird))
{
if (lockbird_useful || AI.Utils.IsChainTarget(Card) || (Duel.Player == 1 && ChainContainsCard(CardId.Feather))) {
lockbird_useful = false;
return true;
}
return false;
}
return true; return true;
} }
public bool Crown_eff()
{
if (Card.Location == CardLocation.Hand) return Ts_reborn();
if (Bot.HasInHand(CardId.Pink))
{
AI.SelectCard(CardId.Pink);
return true;
}
if (Enemy.GetMonsterCount() == 0)
{
foreach(ClientCard hand in Bot.Hand)
{
if (hand.IsMonster() && IsTrickstar(hand.Id))
{
if (hand.Attack >= Duel.LifePoints[1]) return true;
if (hand.Id != CardId.Yellow)
{
if (AI.Utils.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true;
}
}
}
}
return false;
}
public bool Ts_reborn() public bool Ts_reborn()
{ {
bool can_summon = (Duel.Player == 0 && NormalSummoned); bool can_summon = (Duel.Player == 0 && NormalSummoned);
...@@ -977,7 +1083,7 @@ namespace WindBot.Game.AI.Decks ...@@ -977,7 +1083,7 @@ namespace WindBot.Game.AI.Decks
{ {
targets.Add(ex_zone); targets.Add(ex_zone);
} }
AI.SelectCard(targets); AI.SelectMaterials(targets);
return true; return true;
} }
...@@ -1009,7 +1115,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1009,7 +1115,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (link_count < 3) return false; if (link_count < 3) return false;
AI.SelectCard(targets); AI.SelectMaterials(targets);
return true; return true;
} }
...@@ -1025,20 +1131,32 @@ namespace WindBot.Game.AI.Decks ...@@ -1025,20 +1131,32 @@ namespace WindBot.Game.AI.Decks
public bool Snake_ss() public bool Snake_ss()
{ {
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard m in Bot.GetMonsters()) int total_atk = 0;
// exzone fo first
foreach (ClientCard e_m in Bot.GetMonstersInExtraZone())
{
if (e_m.Attack < 1900 && !targets.ContainsCardWithId(e_m.Id))
{
total_atk += e_m.Attack;
targets.Add(e_m);
}
}
foreach (ClientCard m in Bot.GetMonstersInMainZone())
{ {
if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id)) if (m.Attack < 1900 && !targets.ContainsCardWithId(m.Id))
{ {
total_atk += m.Attack;
targets.Add(m); targets.Add(m);
} }
}
if (targets.Count >= 4) if (targets.Count >= 4)
{ {
if (Duel.LifePoints[1] <= total_atk && Enemy.GetMonsterCount() == 0) return false;
AI.SelectCard(targets); AI.SelectMaterials(targets);
AI.SelectYesNo(true);
snake_four_s = true; snake_four_s = true;
return true; return true;
} }
}
return false; return false;
} }
...@@ -1075,8 +1193,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1075,8 +1193,10 @@ namespace WindBot.Game.AI.Decks
public bool MonsterRepos() public bool MonsterRepos()
{ {
if (Card.Id == CardId.Eater) return false; if (Card.Id == CardId.Eater && Card.IsAttack()) return false;
if (Card.Id == CardId.Sheep + 1) return false;
if (Card.IsFaceup() && Card.IsDefense() && Card.Attack == 0)
return false;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
...@@ -1100,13 +1220,15 @@ namespace WindBot.Game.AI.Decks ...@@ -1100,13 +1220,15 @@ namespace WindBot.Game.AI.Decks
snake_four_s = false; snake_four_s = false;
crystal_eff_used = false; crystal_eff_used = false;
red_ss_count = 0; red_ss_count = 0;
white_eff_used = false;
lockbird_useful = false;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand(CardId.White)) if (attacker.Attribute == (int)CardAttribute.Light && Bot.HasInHand(CardId.White) && !white_eff_used)
attacker.RealPower = attacker.RealPower * 2; attacker.RealPower = attacker.RealPower * 2;
else if (attacker.Id == CardId.Eater) else if (attacker.Id == CardId.Eater)
attacker.RealPower = 99999; attacker.RealPower = 99999;
......
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