Commit b2d7083a authored by xiaoye's avatar xiaoye

Update Earth_408Executor.cs

parent 7d8d5956
Pipeline #32373 passed with stage
in 42 seconds
...@@ -39,22 +39,26 @@ namespace WindBot.Game.AI.Decks ...@@ -39,22 +39,26 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.MonsterSet, OnSelectMonsterSet); AddExecutor(ExecutorType.MonsterSet, OnSelectMonsterSet);
} }
private bool chk_release_summon = false;
private int summonInTurn = 0; private class ChkCard
private int[] changePosInTurn = new int[] { 0, 0, 0, 0, 0, 0 }; {
private int[] attacked = new int[] { 0, 0, 0, 0, 0, 0 }; public static bool chk_release_summon = false;
public static int summonInTurn = 0;
public static int[] attacked = new int[] { 0, 0, 0, 0, 0, 0 };
public static int[] changePosInTurn = new int[] { 0, 0, 0, 0, 0, 0 };
}
public override void OnNewTurn() public override void OnNewTurn()
{ {
summonInTurn = 0; ChkCard.changePosInTurn = new int[] { 0, 0, 0, 0, 0, 0 };
changePosInTurn = new int[] { 0, 0, 0, 0, 0, 0 }; ChkCard.attacked = new int[] { 0, 0, 0, 0, 0, 0 };
attacked = new int[] { 0, 0, 0, 0, 0, 0 }; ChkCard.summonInTurn = 0;
} }
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders) public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{ {
if (attacker.CanDirectAttack) if (attacker.CanDirectAttack)
{ {
attacked[GetSequence(attacker)] = attacker.Id; ChkCard.attacked[GetSequence(attacker)] = attacker.Id;
return AI.Attack(attacker, null); return AI.Attack(attacker, null);
} }
if (attacker.IsCode(new[] { 37043180, 70074904 })) if (attacker.IsCode(new[] { 37043180, 70074904 }))
...@@ -68,9 +72,9 @@ namespace WindBot.Game.AI.Decks ...@@ -68,9 +72,9 @@ namespace WindBot.Game.AI.Decks
if (!OnPreBattleBetween(attacker, defender)) if (!OnPreBattleBetween(attacker, defender))
continue; continue;
if (attacker.RealPower < defender.RealPower && ((Bot.HasInMonstersZone(79575620) && attacked.Any(id => id == 79575620) && Bot.LifePoints > 2000) ? defender.RealPower - attacker.RealPower < Bot.LifePoints - 2000 : defender.RealPower - attacker.RealPower < Bot.LifePoints)) if (attacker.RealPower < defender.RealPower && ((Bot.HasInMonstersZone(79575620) && ChkCard.attacked.Any(id => id == 79575620) && Bot.LifePoints > 2000) ? defender.RealPower - attacker.RealPower < Bot.LifePoints - 2000 : defender.RealPower - attacker.RealPower < Bot.LifePoints))
{ {
attacked[GetSequence(attacker)] = attacker.Id; ChkCard.attacked[GetSequence(attacker)] = attacker.Id;
return AI.Attack(attacker, defender); return AI.Attack(attacker, defender);
} }
} }
...@@ -87,9 +91,9 @@ namespace WindBot.Game.AI.Decks ...@@ -87,9 +91,9 @@ namespace WindBot.Game.AI.Decks
if (!OnPreBattleBetween(attacker, defender)) if (!OnPreBattleBetween(attacker, defender))
continue; continue;
if ((attacker.RealPower >= defender.RealPower && defender.IsAttack()) || (attacker.RealPower > defender.RealPower && !GetZoneCards(CardLocation.MonsterZone, Bot).Any(c => c != null && !c.IsCode(79575620) && c.IsAttack() && (c.Attack > defender.RealPower || (c.IsCode(new[] { 37043180, 70074904 }) && defender.RealPower - c.Attack < Bot.LifePoints - 2000)) && attacked[GetSequence(c)] != c.Id) && defender.IsDefense() && defender.IsFaceup())) if ((attacker.RealPower >= defender.RealPower && defender.IsAttack()) || (attacker.RealPower > defender.RealPower && !GetZoneCards(CardLocation.MonsterZone, Bot).Any(c => c != null && !c.IsCode(79575620) && c.IsAttack() && (c.Attack > defender.RealPower || (c.IsCode(new[] { 37043180, 70074904 }) && defender.RealPower - c.Attack < Bot.LifePoints - 2000)) && ChkCard.attacked[GetSequence(c)] != c.Id) && defender.IsDefense() && defender.IsFaceup()))
{ {
attacked[GetSequence(attacker)] = attacker.Id; ChkCard.attacked[GetSequence(attacker)] = attacker.Id;
return AI.Attack(attacker, defender); return AI.Attack(attacker, defender);
} }
} }
...@@ -105,7 +109,7 @@ namespace WindBot.Game.AI.Decks ...@@ -105,7 +109,7 @@ namespace WindBot.Game.AI.Decks
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && attacker.IsLastAttacker && defender.IsAttack())) if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && attacker.IsLastAttacker && defender.IsAttack()))
{ {
attacked[GetSequence(attacker)] = attacker.Id; ChkCard.attacked[GetSequence(attacker)] = attacker.Id;
return AI.Attack(attacker, defender); return AI.Attack(attacker, defender);
} }
} }
...@@ -192,7 +196,7 @@ namespace WindBot.Game.AI.Decks ...@@ -192,7 +196,7 @@ namespace WindBot.Game.AI.Decks
} }
case 74131780: case 74131780:
{ {
return Util.CheckSelectCount(cards.Where(card => card != null && card.Controller == 1 && !cards.Any(c => c != null && card.Controller == 1 && c.Attack > card.Attack)).ToList(), cards, min, max); return Util.CheckSelectCount(cards.Where(card => card != null && card.Controller == 1 && !cards.Any(c => c != null && c.Controller == 1 && c.Attack > card.Attack)).ToList(), cards, min, max);
} }
case 79571449: case 79571449:
{ {
...@@ -298,9 +302,9 @@ namespace WindBot.Game.AI.Decks ...@@ -298,9 +302,9 @@ namespace WindBot.Game.AI.Decks
} }
} }
} }
if (chk_release_summon) if (ChkCard.chk_release_summon)
{ {
chk_release_summon = false; ChkCard.chk_release_summon = false;
List<ClientCard> res = cards.Where(card => card != null && !card.IsCode(new[] { 79575620, 97017120, 74131780 })).ToList(); List<ClientCard> res = cards.Where(card => card != null && !card.IsCode(new[] { 79575620, 97017120, 74131780 })).ToList();
if (Bot.LifePoints <= 2000 && cards.Any(card => card != null && !card.IsCode(79575620))) res.AddRange(cards.Where(card => card != null && !card.IsCode(79575620)).ToList()); if (Bot.LifePoints <= 2000 && cards.Any(card => card != null && !card.IsCode(79575620))) res.AddRange(cards.Where(card => card != null && !card.IsCode(79575620)).ToList());
res = res.Where(card => card != null && !res.Any(c => c != null && c.Attack < card.Attack)).ToList(); res = res.Where(card => card != null && !res.Any(c => c != null && c.Attack < card.Attack)).ToList();
...@@ -376,7 +380,7 @@ namespace WindBot.Game.AI.Decks ...@@ -376,7 +380,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Enemy.GetSpellCount() == 0) if (Enemy.GetSpellCount() == 0)
{ {
if ((Duel.Phase == DuelPhase.Main2 || !Duel.MainPhase.CanBattlePhase) || ((changePosInTurn[GetSequence(Card)] == Card.Id || summonInTurn == Card.Id) && !Card.IsAttack()) || !GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && card.GetDefensePower() < Card.Attack)) if ((Duel.Phase == DuelPhase.Main2 || !Duel.MainPhase.CanBattlePhase) || ((ChkCard.changePosInTurn[GetSequence(Card)] == Card.Id || ChkCard.summonInTurn == Card.Id) && !Card.IsAttack()) || !GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && card.GetDefensePower() < Card.Attack))
return GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget()); return GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget());
} }
else else
...@@ -466,12 +470,12 @@ namespace WindBot.Game.AI.Decks ...@@ -466,12 +470,12 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.IsCode(74131780) && GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget())) if (Card.IsCode(74131780) && GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget()))
{ {
summonInTurn = Card.Id; ChkCard.summonInTurn = Card.Id;
return true; return true;
} }
if (Card.IsCode(new[] { 37043180, 70074904 }) && Bot.GetMonsterCount() >= Enemy.GetMonsterCount() - 1) if (Card.IsCode(new[] { 37043180, 70074904 }) && Bot.GetMonsterCount() >= Enemy.GetMonsterCount() - 1)
{ {
summonInTurn = Card.Id; ChkCard.summonInTurn = Card.Id;
return true; return true;
} }
} }
...@@ -483,7 +487,7 @@ namespace WindBot.Game.AI.Decks ...@@ -483,7 +487,7 @@ namespace WindBot.Game.AI.Decks
{ {
if ((GetZoneCards(CardLocation.SpellZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget() && card.IsFacedown()) || GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget() && card.IsFacedown())) && GetZoneCards(CardLocation.MonsterZone, Bot).Any(card => card != null && (!card.IsCode(new[] { 79575620, 97017120, 74131780 }) || (Bot.LifePoints <= 2000 && card.IsCode(79575620))))) if ((GetZoneCards(CardLocation.SpellZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget() && card.IsFacedown()) || GetZoneCards(CardLocation.MonsterZone, Enemy).Any(card => card != null && !card.IsShouldNotBeTarget() && card.IsFacedown())) && GetZoneCards(CardLocation.MonsterZone, Bot).Any(card => card != null && (!card.IsCode(new[] { 79575620, 97017120, 74131780 }) || (Bot.LifePoints <= 2000 && card.IsCode(79575620)))))
{ {
chk_release_summon = true; ChkCard.chk_release_summon = true;
return true; return true;
} }
List<ClientCard> g = GetZoneCards(CardLocation.MonsterZone, Bot).Where(c => c != null && !c.IsCode(new[] { 73915052, 73915053, 73915054, 73915055 })).ToList(); List<ClientCard> g = GetZoneCards(CardLocation.MonsterZone, Bot).Where(c => c != null && !c.IsCode(new[] { 73915052, 73915053, 73915054, 73915055 })).ToList();
...@@ -492,7 +496,7 @@ namespace WindBot.Game.AI.Decks ...@@ -492,7 +496,7 @@ namespace WindBot.Game.AI.Decks
if (Bot.LifePoints > 2000 && g[0].IsCode(79575620)) atk = g[1].Attack; if (Bot.LifePoints > 2000 && g[0].IsCode(79575620)) atk = g[1].Attack;
if (Enemy.LifePoints > Util.GetBestAttack(Bot) && Enemy.LifePoints - Util.GetBestAttack(Bot) <= 2400 - atk && Enemy.GetMonsterCount() == 0 && !GetZoneCards(CardLocation.Hand, Bot).Any(c => c != null && c.Level < 5 && c.HasType(CardType.Monster)) && Duel.MainPhase.CanBattlePhase && GetZoneCards(CardLocation.SpellZone, Bot).Any(c => c != null && !c.IsShouldNotBeTarget() && !c.IsFaceup())) if (Enemy.LifePoints > Util.GetBestAttack(Bot) && Enemy.LifePoints - Util.GetBestAttack(Bot) <= 2400 - atk && Enemy.GetMonsterCount() == 0 && !GetZoneCards(CardLocation.Hand, Bot).Any(c => c != null && c.Level < 5 && c.HasType(CardType.Monster)) && Duel.MainPhase.CanBattlePhase && GetZoneCards(CardLocation.SpellZone, Bot).Any(c => c != null && !c.IsShouldNotBeTarget() && !c.IsFaceup()))
{ {
chk_release_summon = true; ChkCard.chk_release_summon = true;
return true; return true;
} }
return false; return false;
...@@ -510,7 +514,7 @@ namespace WindBot.Game.AI.Decks ...@@ -510,7 +514,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
} }
summonInTurn = Card.Id; ChkCard.summonInTurn = Card.Id;
return true; return true;
} }
return false; return false;
......
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