Commit f8435d17 authored by mercury233's avatar mercury233 Committed by GitHub

add ClientCard.IsCode, fix ClientCard.Alias support (#97)

parent 48df4873
...@@ -335,12 +335,12 @@ namespace WindBot.Game.AI ...@@ -335,12 +335,12 @@ namespace WindBot.Game.AI
public bool ChainContainsCard(int id) public bool ChainContainsCard(int id)
{ {
return Duel.CurrentChain.Any(card => card.Id == id); return Duel.CurrentChain.Any(card => card.IsCode(id));
} }
public bool ChainContainsCard(int[] ids) public bool ChainContainsCard(int[] ids)
{ {
return Duel.CurrentChain.Any(card => ids.Contains(card.Id)); return Duel.CurrentChain.Any(card => card.IsCode(ids));
} }
public int ChainCountPlayer(int player) public int ChainCountPlayer(int player)
...@@ -385,7 +385,7 @@ namespace WindBot.Game.AI ...@@ -385,7 +385,7 @@ namespace WindBot.Game.AI
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card.Id== preferred && selected.Count < max) if (card.IsCode(preferred) && selected.Count < max)
selected.Add(card); selected.Add(card);
} }
...@@ -420,7 +420,7 @@ namespace WindBot.Game.AI ...@@ -420,7 +420,7 @@ namespace WindBot.Game.AI
{ {
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card.Id == id && selected.Count < max && selected.IndexOf(card) <= 0) if (card.IsCode(id) && selected.Count < max && selected.IndexOf(card) <= 0)
selected.Add(card); selected.Add(card);
} }
if (selected.Count >= max) if (selected.Count >= max)
......
...@@ -47,12 +47,12 @@ namespace WindBot.Game.AI ...@@ -47,12 +47,12 @@ namespace WindBot.Game.AI
public static bool ContainsCardWithId(this IEnumerable<ClientCard> cards, int id) public static bool ContainsCardWithId(this IEnumerable<ClientCard> cards, int id)
{ {
return cards.Where(card => card?.Data != null).Any(card => card.Id == id); return cards.Where(card => card?.Data != null).Any(card => card.IsCode(id));
} }
public static int GetCardCount(this IEnumerable<ClientCard> cards, int id) public static int GetCardCount(this IEnumerable<ClientCard> cards, int id)
{ {
return cards.Where(card => card?.Data != null).Count(card => card.Id == id); return cards.Where(card => card?.Data != null).Count(card => card.IsCode(id));
} }
public static List<ClientCard> GetMonsters(this IEnumerable<ClientCard> cards) public static List<ClientCard> GetMonsters(this IEnumerable<ClientCard> cards)
......
...@@ -68,13 +68,13 @@ namespace WindBot.Game.AI ...@@ -68,13 +68,13 @@ namespace WindBot.Game.AI
break; break;
case SelectType.Id: case SelectType.Id:
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
if (card.Id == _id) if (card.IsCode(_id))
result.Add(card); result.Add(card);
break; break;
case SelectType.Ids: case SelectType.Ids:
foreach (int id in _ids) foreach (int id in _ids)
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
if (card.Id == id && !result.Contains(card)) if (card.IsCode(id) && !result.Contains(card))
result.Add(card); result.Add(card);
break; break;
case SelectType.Location: case SelectType.Location:
......
...@@ -215,6 +215,12 @@ namespace WindBot.Game.AI.Decks ...@@ -215,6 +215,12 @@ namespace WindBot.Game.AI.Decks
|| id == CardId.Manifestation || id == CardId.Silquitous); || id == CardId.Manifestation || id == CardId.Silquitous);
} }
public bool isAltergeist(ClientCard card)
{
return card.IsCode(CardId.Marionetter, CardId.Hexstia, CardId.Protocol, CardId.Multifaker, CardId.Meluseek,
CardId.Kunquery, CardId.Manifestation, CardId.Silquitous);
}
public int GetSequence(ClientCard card) public int GetSequence(ClientCard card)
{ {
if (Card.Location != CardLocation.MonsterZone) return -1; if (Card.Location != CardLocation.MonsterZone) return -1;
...@@ -239,10 +245,10 @@ namespace WindBot.Game.AI.Decks ...@@ -239,10 +245,10 @@ namespace WindBot.Game.AI.Decks
ClientCard self_card = Duel.CurrentChain[Duel.CurrentChain.Count - 2]; ClientCard self_card = Duel.CurrentChain[Duel.CurrentChain.Count - 2];
if (self_card?.Controller != 0 if (self_card?.Controller != 0
|| !(self_card.Location == CardLocation.MonsterZone || self_card.Location == CardLocation.SpellZone) || !(self_card.Location == CardLocation.MonsterZone || self_card.Location == CardLocation.SpellZone)
|| !isAltergeist(self_card.Id)) return true; || !isAltergeist(self_card)) return true;
ClientCard enemy_card = Duel.CurrentChain[Duel.CurrentChain.Count - 1]; ClientCard enemy_card = Duel.CurrentChain[Duel.CurrentChain.Count - 1];
if (enemy_card?.Controller != 1 if (enemy_card?.Controller != 1
|| !normal_counter.Contains(enemy_card.Id)) return true; || !enemy_card.IsCode(normal_counter)) return true;
return false; return false;
} }
...@@ -253,10 +259,10 @@ namespace WindBot.Game.AI.Decks ...@@ -253,10 +259,10 @@ namespace WindBot.Game.AI.Decks
ClientCard self_card = Duel.CurrentChain[Duel.CurrentChain.Count - 2]; ClientCard self_card = Duel.CurrentChain[Duel.CurrentChain.Count - 2];
if (self_card?.Controller != 0 if (self_card?.Controller != 0
|| !(self_card.Location == CardLocation.MonsterZone || self_card.Location == CardLocation.SpellZone) || !(self_card.Location == CardLocation.MonsterZone || self_card.Location == CardLocation.SpellZone)
|| !isAltergeist(self_card.Id)) return false; || !isAltergeist(self_card)) return false;
ClientCard enemy_card = Duel.CurrentChain[Duel.CurrentChain.Count - 1]; ClientCard enemy_card = Duel.CurrentChain[Duel.CurrentChain.Count - 1];
if (enemy_card?.Controller != 1 if (enemy_card?.Controller != 1
|| !normal_counter.Contains(enemy_card.Id)) return false; || !enemy_card.IsCode(normal_counter)) return false;
return true; return true;
} }
...@@ -264,7 +270,7 @@ namespace WindBot.Game.AI.Decks ...@@ -264,7 +270,7 @@ namespace WindBot.Game.AI.Decks
{ {
ClientCard last_card = AI.Utils.GetLastChainCard(); ClientCard last_card = AI.Utils.GetLastChainCard();
if (last_card != null if (last_card != null
&& last_card.Controller == 1 && should_not_negate.Contains(last_card.Id)) && last_card.Controller == 1 && last_card.IsCode(should_not_negate))
return true; return true;
return false; return false;
} }
...@@ -297,7 +303,7 @@ namespace WindBot.Game.AI.Decks ...@@ -297,7 +303,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.Protocol && card.IsFaceup() && !card.IsDisabled() && !Duel.CurrentChain.Contains(card)) return true; if (card.IsCode(CardId.Protocol) && card.IsFaceup() && !card.IsDisabled() && !Duel.CurrentChain.Contains(card)) return true;
} }
return false; return false;
} }
...@@ -417,7 +423,7 @@ namespace WindBot.Game.AI.Decks ...@@ -417,7 +423,7 @@ namespace WindBot.Game.AI.Decks
if (place == 2 || place == 4) if (place == 2 || place == 4)
{ {
int last_place = place - 1; int last_place = place - 1;
return (Bot.MonsterZone[last_place] != null && Bot.MonsterZone[last_place].Id == CardId.Hexstia); return (Bot.MonsterZone[last_place] != null && Bot.MonsterZone[last_place].IsCode(CardId.Hexstia));
} }
if (place == 1 || place == 3) if (place == 1 || place == 3)
{ {
...@@ -431,8 +437,8 @@ namespace WindBot.Game.AI.Decks ...@@ -431,8 +437,8 @@ namespace WindBot.Game.AI.Decks
last_place_1 = 2; last_place_1 = 2;
last_place_2 = 6; last_place_2 = 6;
} }
if (Bot.MonsterZone[last_place_1] != null && Bot.MonsterZone[last_place_1].Id == CardId.Hexstia) return true; if (Bot.MonsterZone[last_place_1] != null && Bot.MonsterZone[last_place_1].IsCode(CardId.Hexstia)) return true;
if (Bot.MonsterZone[last_place_2] != null && Bot.MonsterZone[last_place_2].Id == CardId.Hexstia) return true; if (Bot.MonsterZone[last_place_2] != null && Bot.MonsterZone[last_place_2].IsCode(CardId.Hexstia)) return true;
return false; return false;
} }
return false; return false;
...@@ -442,7 +448,8 @@ namespace WindBot.Game.AI.Decks ...@@ -442,7 +448,8 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card != null && card.IsFloodgate() && card.IsFaceup() && (card.Id != CardId.Anti_Spell && card.Id != CardId.ImperialOrder) if (card != null && card.IsFloodgate() && card.IsFaceup() &&
!card.IsCode(CardId.Anti_Spell, CardId.ImperialOrder)
&& (!is_bounce || card.IsTrap()) && (!is_bounce || card.IsTrap())
&& (!canBeTarget || !card.IsShouldNotBeTarget())) && (!canBeTarget || !card.IsShouldNotBeTarget()))
return card; return card;
...@@ -475,7 +482,7 @@ namespace WindBot.Game.AI.Decks ...@@ -475,7 +482,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (target.HasType(CardType.Fusion) || target.HasType(CardType.Ritual) || target.HasType(CardType.Synchro) || target.HasType(CardType.Xyz) || (target.HasType(CardType.Link) && target.LinkCount >= 2) ) if (target.HasType(CardType.Fusion) || target.HasType(CardType.Ritual) || target.HasType(CardType.Synchro) || target.HasType(CardType.Xyz) || (target.HasType(CardType.Link) && target.LinkCount >= 2) )
{ {
if (target.Id == CardId.Kagari || target.Id == CardId.Shizuku) continue; if (target.IsCode(CardId.Kagari, CardId.Shizuku)) continue;
if (!canBeTarget || !(target.IsShouldNotBeTarget() || target.IsShouldNotBeMonsterTarget())) return target; if (!canBeTarget || !(target.IsShouldNotBeTarget() || target.IsShouldNotBeMonsterTarget())) return target;
} }
} }
...@@ -520,7 +527,7 @@ namespace WindBot.Game.AI.Decks ...@@ -520,7 +527,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Player != 0) return false; if (Duel.Player != 0) return false;
foreach(ClientCard card in Bot.GetMonsters()) foreach(ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.Meluseek && !card.IsDisabled() && !card.Attacked) return true; if (card.IsCode(CardId.Meluseek) && !card.IsDisabled() && !card.Attacked) return true;
} }
if (Bot.HasInMonstersZone(CardId.Meluseek)) return true; if (Bot.HasInMonstersZone(CardId.Meluseek)) return true;
if (Bot.HasInMonstersZone(CardId.Marionetter) && !Marionetter_reborn && Bot.HasInGraveyard(CardId.Meluseek)) return true; if (Bot.HasInMonstersZone(CardId.Marionetter) && !Marionetter_reborn && Bot.HasInGraveyard(CardId.Meluseek)) return true;
...@@ -534,17 +541,17 @@ namespace WindBot.Game.AI.Decks ...@@ -534,17 +541,17 @@ namespace WindBot.Game.AI.Decks
public bool SpellSet() public bool SpellSet()
{ {
if (Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster() && Duel.Turn > 1) return false; if (Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster() && Duel.Turn > 1) return false;
if (Card.Id == CardId.EvenlyMatched && !Bot.HasInHandOrInSpellZone(CardId.Spoofing) if (Card.IsCode(CardId.EvenlyMatched) && !Bot.HasInHandOrInSpellZone(CardId.Spoofing)
&& !Bot.HasInHandOrInSpellZone(CardId.Protocol) && !Bot.HasInHandOrInSpellZone(CardId.ImperialOrder)) return false; && !Bot.HasInHandOrInSpellZone(CardId.Protocol) && !Bot.HasInHandOrInSpellZone(CardId.ImperialOrder)) return false;
if (Card.Id == CardId.EvenlyMatched && Bot.HasInSpellZone(CardId.EvenlyMatched)) return false; if (Card.IsCode(CardId.EvenlyMatched) && Bot.HasInSpellZone(CardId.EvenlyMatched)) return false;
if (Card.Id == CardId.SolemnStrike && Bot.LifePoints <= 1500) return false; if (Card.IsCode(CardId.SolemnStrike) && Bot.LifePoints <= 1500) return false;
if (Card.Id == CardId.Spoofing && Bot.HasInSpellZone(CardId.Spoofing)) return false; if (Card.IsCode(CardId.Spoofing) && Bot.HasInSpellZone(CardId.Spoofing)) return false;
if (Card.Id == CardId.Manifestation && Bot.HasInHandOrInSpellZone(CardId.Spoofing)) if (Card.IsCode(CardId.Manifestation) && Bot.HasInHandOrInSpellZone(CardId.Spoofing))
{ {
bool can_activate = false; bool can_activate = false;
foreach(ClientCard g in Bot.GetGraveyardMonsters()) foreach(ClientCard g in Bot.GetGraveyardMonsters())
{ {
if (g.IsMonster() && isAltergeist(g.Id)) if (g.IsMonster() && isAltergeist(g))
{ {
can_activate = true; can_activate = true;
break; break;
...@@ -567,7 +574,7 @@ namespace WindBot.Game.AI.Decks ...@@ -567,7 +574,7 @@ namespace WindBot.Game.AI.Decks
} }
if (Bot.HasInHand(CardId.Impermanence)) if (Bot.HasInHand(CardId.Impermanence))
{ {
if (Card.Id == CardId.Impermanence) if (Card.IsCode(CardId.Impermanence))
{ {
AI.SelectPlace(Impermanence_set); AI.SelectPlace(Impermanence_set);
return true; return true;
...@@ -584,7 +591,7 @@ namespace WindBot.Game.AI.Decks ...@@ -584,7 +591,7 @@ namespace WindBot.Game.AI.Decks
} }
else if (Enemy.HasInSpellZone(CardId.Anti_Spell, true) || Bot.HasInSpellZone(CardId.Anti_Spell, true)) else if (Enemy.HasInSpellZone(CardId.Anti_Spell, true) || Bot.HasInSpellZone(CardId.Anti_Spell, true))
{ {
if (Card.IsSpell() && (Card.Id != CardId.OneForOne || Bot.GetRemainingCount(CardId.Meluseek,3) > 0)) if (Card.IsSpell() && (!Card.IsCode(CardId.OneForOne) || Bot.GetRemainingCount(CardId.Meluseek,3) > 0))
{ {
AI.SelectPlace(SelectSTPlace()); AI.SelectPlace(SelectSTPlace());
return true; return true;
...@@ -598,7 +605,7 @@ namespace WindBot.Game.AI.Decks ...@@ -598,7 +605,7 @@ namespace WindBot.Game.AI.Decks
if (Card.HasPosition(CardPosition.FaceDown) && Card.HasType(CardType.Field) && Card.Location == CardLocation.SpellZone) if (Card.HasPosition(CardPosition.FaceDown) && Card.HasType(CardType.Field) && Card.Location == CardLocation.SpellZone)
{ {
// field spells that forbid other fields' activate // field spells that forbid other fields' activate
return (Card.Id != 71650854 && Card.Id != 78082039); return !Card.IsCode(71650854, 78082039);
} }
return false; return false;
} }
...@@ -624,7 +631,7 @@ namespace WindBot.Game.AI.Decks ...@@ -624,7 +631,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.Anti_Spell && card.IsFaceup() && Duel.LastChainPlayer == 0) return false; if (card.IsCode(CardId.Anti_Spell) && card.IsFaceup() && Duel.LastChainPlayer == 0) return false;
} }
return true; return true;
} }
...@@ -632,12 +639,12 @@ namespace WindBot.Game.AI.Decks ...@@ -632,12 +639,12 @@ namespace WindBot.Game.AI.Decks
public bool SecretVillage_activate() public bool SecretVillage_activate()
{ {
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
if (Bot.SpellZone[5] != null && Bot.SpellZone[5].IsFaceup() && Bot.SpellZone[5].Id == CardId.SecretVillage && Bot.SpellZone[5].Disabled==0) return false; if (Bot.SpellZone[5] != null && Bot.SpellZone[5].IsFaceup() && Bot.SpellZone[5].IsCode(CardId.SecretVillage) && Bot.SpellZone[5].Disabled==0) return false;
if (Multifaker_can_ss() && Bot.HasInHand(CardId.Multifaker)) return true; if (Multifaker_can_ss() && Bot.HasInHand(CardId.Multifaker)) return true;
foreach(ClientCard card in Bot.GetMonsters()) foreach(ClientCard card in Bot.GetMonsters())
{ {
if (card != null && card.IsFaceup() && (card.Race & (int)CardRace.SpellCaster) != 0 && card.Id != CardId.Meluseek) return true; if (card != null && card.IsFaceup() && (card.Race & (int)CardRace.SpellCaster) != 0 && !card.IsCode(CardId.Meluseek)) return true;
} }
return false; return false;
} }
...@@ -744,7 +751,7 @@ namespace WindBot.Game.AI.Decks ...@@ -744,7 +751,7 @@ namespace WindBot.Game.AI.Decks
} }
if ( (this_seq * that_seq >= 0 && this_seq + that_seq == 4) if ( (this_seq * that_seq >= 0 && this_seq + that_seq == 4)
|| (AI.Utils.IsChainTarget(Card)) || (AI.Utils.IsChainTarget(Card))
|| (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.Id == _CardId.HarpiesFeatherDuster) || (LastChainCard != null && LastChainCard.Controller == 1 && LastChainCard.IsCode(_CardId.HarpiesFeatherDuster))
|| (Duel.Player == 1 && Duel.Phase > DuelPhase.Main2 && Bot.HasInHand(CardId.Multifaker) && Multifaker_candeckss() && !Multifaker_ssfromhand)) || (Duel.Player == 1 && Duel.Phase > DuelPhase.Main2 && Bot.HasInHand(CardId.Multifaker) && Multifaker_candeckss() && !Multifaker_ssfromhand))
{ {
List<ClientCard> enemy_monsters = Enemy.GetMonsters(); List<ClientCard> enemy_monsters = Enemy.GetMonsters();
...@@ -802,7 +809,7 @@ namespace WindBot.Game.AI.Decks ...@@ -802,7 +809,7 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff() public bool Hand_act_eff()
{ {
if (Card.Id == CardId.GO_SR && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GO_SR)) return false; if (Card.IsCode(CardId.GO_SR) && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GO_SR)) return false;
return (Duel.LastChainPlayer == 1); return (Duel.LastChainPlayer == 1);
} }
...@@ -813,7 +820,7 @@ namespace WindBot.Game.AI.Decks ...@@ -813,7 +820,7 @@ namespace WindBot.Game.AI.Decks
bool has_skystriker = false; bool has_skystriker = false;
foreach(ClientCard card in Enemy.Graveyard) foreach(ClientCard card in Enemy.Graveyard)
{ {
if (card != null && SkyStrike_list.Contains(card.Id)) if (card != null && card.IsCode(SkyStrike_list))
{ {
has_skystriker = true; has_skystriker = true;
break; break;
...@@ -823,7 +830,7 @@ namespace WindBot.Game.AI.Decks ...@@ -823,7 +830,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card != null && SkyStrike_list.Contains(card.Id)) if (card != null && card.IsCode(SkyStrike_list))
{ {
has_skystriker = true; has_skystriker = true;
break; break;
...@@ -834,7 +841,7 @@ namespace WindBot.Game.AI.Decks ...@@ -834,7 +841,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card != null && SkyStrike_list.Contains(card.Id)) if (card != null && card.IsCode(SkyStrike_list))
{ {
has_skystriker = true; has_skystriker = true;
break; break;
...@@ -890,11 +897,11 @@ namespace WindBot.Game.AI.Decks ...@@ -890,11 +897,11 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard card in Enemy.MonsterZone) foreach (ClientCard card in Enemy.MonsterZone)
{ {
if (card == null) continue; if (card == null) continue;
if (card.Id == CardId.Kagari || card.Id == CardId.Shizuku || card.Id == CardId.Hayate || card.Id == CardId.Raye || card.Id == CardId.Drones_Token) has_skystriker_acer = true; if (card.IsCode(CardId.Kagari, CardId.Shizuku, CardId.Hayate, CardId.Raye, CardId.Drones_Token)) has_skystriker_acer = true;
if (card.HasType(CardType.Pendulum)) pendulum_count ++; if (card.HasType(CardType.Pendulum)) pendulum_count ++;
if ((card.Race & (int)CardRace.Warrior) != 0) warrior_count ++; if ((card.Race & (int)CardRace.Warrior) != 0) warrior_count ++;
if (card.IsTuner() && (Enemy.GetMonsterCount() >= 2)) has_tuner = true; if (card.IsTuner() && (Enemy.GetMonsterCount() >= 2)) has_tuner = true;
if (isAltergeist(card.Id)) altergeis_count++; if (isAltergeist(card)) altergeis_count++;
if (!card.HasType(CardType.Link) && !card.HasType(CardType.Xyz) && card.Level == 1) has_level_1 = true; if (!card.HasType(CardType.Link) && !card.HasType(CardType.Xyz) && card.Level == 1) has_level_1 = true;
link_count += (card.HasType(CardType.Link) ? card.LinkCount : 1); link_count += (card.HasType(CardType.Link) ? card.LinkCount : 1);
} }
...@@ -1031,7 +1038,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1031,7 +1038,7 @@ namespace WindBot.Game.AI.Decks
if (Duel.Phase == DuelPhase.End if (Duel.Phase == DuelPhase.End
|| activate_immediately >= 2 || activate_immediately >= 2
|| (AI.Utils.IsChainTarget(Card) || (AI.Utils.IsChainTarget(Card)
|| (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Controller == 1 && AI.Utils.GetLastChainCard().Id == _CardId.HarpiesFeatherDuster))) || (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Controller == 1 && AI.Utils.GetLastChainCard().IsCode(_CardId.HarpiesFeatherDuster))))
{ {
if (select_list.Count > 0) if (select_list.Count > 0)
{ {
...@@ -1119,7 +1126,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1119,7 +1126,7 @@ namespace WindBot.Game.AI.Decks
bool can_choose_other = false; bool can_choose_other = false;
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if (card.IsFaceup() && isAltergeist(card.Id)) if (card.IsFaceup() && isAltergeist(card))
{ {
can_choose_other = true; can_choose_other = true;
break; break;
...@@ -1128,7 +1135,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1128,7 +1135,7 @@ namespace WindBot.Game.AI.Decks
if (!can_choose_other){ if (!can_choose_other){
foreach(ClientCard card in Bot.GetMonsters()) foreach(ClientCard card in Bot.GetMonsters())
{ {
if (card.IsFaceup() && card != Card && isAltergeist(card.Id)) if (card.IsFaceup() && card != Card && isAltergeist(card))
{ {
can_choose_other = true; can_choose_other = true;
} }
...@@ -1175,15 +1182,15 @@ namespace WindBot.Game.AI.Decks ...@@ -1175,15 +1182,15 @@ namespace WindBot.Game.AI.Decks
int alter_count = 0; int alter_count = 0;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (isAltergeist(card.Id) && (card.IsTrap() || (!summoned && card.IsMonster()))) alter_count ++; if (isAltergeist(card) && (card.IsTrap() || (!summoned && card.IsMonster()))) alter_count ++;
} }
foreach (ClientCard s in Bot.GetSpells()) foreach (ClientCard s in Bot.GetSpells())
{ {
if (isAltergeist(s.Id)) alter_count++; if (isAltergeist(s)) alter_count++;
} }
foreach(ClientCard m in Bot.GetMonsters()) foreach(ClientCard m in Bot.GetMonsters())
{ {
if (isAltergeist(m.Id) && m != Card) alter_count++; if (isAltergeist(m) && m != Card) alter_count++;
} }
if (alter_count > 0) if (alter_count > 0)
{ {
...@@ -1196,11 +1203,11 @@ namespace WindBot.Game.AI.Decks ...@@ -1196,11 +1203,11 @@ namespace WindBot.Game.AI.Decks
int Protocol_count = 0; int Protocol_count = 0;
foreach (ClientCard h in Bot.Hand) foreach (ClientCard h in Bot.Hand)
{ {
if (h.Id == CardId.Protocol) Protocol_count++; if (h.IsCode(CardId.Protocol)) Protocol_count++;
} }
foreach (ClientCard s in Bot.GetSpells()) foreach (ClientCard s in Bot.GetSpells())
{ {
if (s.Id == CardId.Protocol) Protocol_count += (s.IsFaceup() ? 11 : 1); if (s.IsCode(CardId.Protocol)) Protocol_count += (s.IsFaceup() ? 11 : 1);
} }
if (Protocol_count >= 12) if (Protocol_count >= 12)
{ {
...@@ -1214,7 +1221,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1214,7 +1221,7 @@ namespace WindBot.Game.AI.Decks
list.Sort(AIFunctions.CompareCardAttack); list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard card in list) foreach (ClientCard card in list)
{ {
if (isAltergeist(card.Id) && !(choose_other && card == Card)) if (isAltergeist(card) && !(choose_other && card == Card))
{ {
AI.SelectCard(card); AI.SelectCard(card);
AI.SelectNextCard(next_card); AI.SelectNextCard(next_card);
...@@ -1245,7 +1252,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1245,7 +1252,7 @@ namespace WindBot.Game.AI.Decks
if (this_seq != -1) if (this_seq != -1)
{ {
ClientCard linked_card = Bot.MonsterZone[this_seq]; ClientCard linked_card = Bot.MonsterZone[this_seq];
if (linked_card != null && linked_card.Id == CardId.Hexstia) if (linked_card != null && linked_card.IsCode(CardId.Hexstia))
{ {
int next_seq = get_Hexstia_linkzone(this_seq); int next_seq = get_Hexstia_linkzone(this_seq);
if (next_seq != -1 && Bot.MonsterZone[next_seq] != null && isAltergeist(Bot.MonsterZone[next_seq].Id)) return false; if (next_seq != -1 && Bot.MonsterZone[next_seq] != null && isAltergeist(Bot.MonsterZone[next_seq].Id)) return false;
...@@ -1335,7 +1342,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1335,7 +1342,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard set_card in Bot.GetSpells()) foreach(ClientCard set_card in Bot.GetSpells())
{ {
if (set_card.IsFacedown() && set_card.Id != CardId.WakingtheDragon) if (set_card.IsFacedown() && !set_card.IsCode(CardId.WakingtheDragon))
{ {
AI.SelectCard(CardId.Multifaker); AI.SelectCard(CardId.Multifaker);
return true; return true;
...@@ -1445,7 +1452,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1445,7 +1452,7 @@ namespace WindBot.Game.AI.Decks
ClientCard selected_target = null; ClientCard selected_target = null;
foreach (ClientCard spell in Bot.GetSpells()) foreach (ClientCard spell in Bot.GetSpells())
{ {
if (spell.Id == CardId.Protocol) if (spell.IsCode(CardId.Protocol))
{ {
if (spell.IsFaceup()) if (spell.IsFaceup())
{ {
...@@ -1456,8 +1463,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1456,8 +1463,8 @@ namespace WindBot.Game.AI.Decks
Protocol_count++; Protocol_count++;
} }
} }
if (spell.Id == CardId.Manifestation && spell.IsFaceup()) faceup_Manifestation = spell; if (spell.IsCode(CardId.Manifestation) && spell.IsFaceup()) faceup_Manifestation = spell;
if (Duel.LastChainPlayer != 0 && AI.Utils.IsChainTarget(spell) && spell.IsFaceup() && isAltergeist(spell.Id)) if (Duel.LastChainPlayer != 0 && AI.Utils.IsChainTarget(spell) && spell.IsFaceup() && isAltergeist(spell))
{ {
selected_target = spell; selected_target = spell;
} }
...@@ -1478,14 +1485,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1478,14 +1485,14 @@ namespace WindBot.Game.AI.Decks
monster_list.Sort(AIFunctions.CompareCardAttack); monster_list.Sort(AIFunctions.CompareCardAttack);
foreach(ClientCard card in monster_list) foreach(ClientCard card in monster_list)
{ {
if (card.IsFaceup() && isAltergeist(card.Id) && card != Card) if (card.IsFaceup() && isAltergeist(card) && card != Card)
{ {
if (Duel.LastChainPlayer != 0 && AI.Utils.IsChainTarget(card) && card.IsFaceup()) if (Duel.LastChainPlayer != 0 && AI.Utils.IsChainTarget(card) && card.IsFaceup())
{ {
selected_target = card; selected_target = card;
} }
if (faceup_Multifaker == null && card.Id == CardId.Multifaker) faceup_Multifaker = card; if (faceup_Multifaker == null && card.IsCode(CardId.Multifaker)) faceup_Multifaker = card;
if (faceup_monster == null && card.Id != CardId.Hexstia) faceup_monster = card; if (faceup_monster == null && !card.IsCode(CardId.Hexstia)) faceup_monster = card;
} }
} }
if (bounce_self == null) if (bounce_self == null)
...@@ -1574,7 +1581,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1574,7 +1581,7 @@ namespace WindBot.Game.AI.Decks
else else
{ {
if (AI.Utils.ChainContainsCard(CardId.Manifestation) || AI.Utils.ChainContainsCard(CardId.Spoofing)) return false; if (AI.Utils.ChainContainsCard(CardId.Manifestation) || AI.Utils.ChainContainsCard(CardId.Spoofing)) return false;
if (Duel.LastChainPlayer == 0 && !(AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.Hexstia)) return false; if (Duel.LastChainPlayer == 0 && !(AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.Hexstia))) return false;
if (Bot.HasInMonstersZone(CardId.Hexstia)) if (Bot.HasInMonstersZone(CardId.Hexstia))
{ {
...@@ -1582,7 +1589,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1582,7 +1589,7 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
ClientCard target = Bot.MonsterZone[i]; ClientCard target = Bot.MonsterZone[i];
if (target != null && target.Id == CardId.Hexstia) if (target != null && target.IsCode(CardId.Hexstia))
{ {
int next_id = get_Hexstia_linkzone(i); int next_id = get_Hexstia_linkzone(i);
if (next_id != -1) if (next_id != -1)
...@@ -1655,7 +1662,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1655,7 +1662,7 @@ namespace WindBot.Game.AI.Decks
if (Should_activate_Protocol()) return false; if (Should_activate_Protocol()) return false;
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.Protocol && card.IsFaceup() && card != Card if (card.IsCode(CardId.Protocol) && card.IsFaceup() && card != Card
&& (Card.IsFacedown() || !Card.IsDisabled())) && (Card.IsFacedown() || !Card.IsDisabled()))
{ {
AI.SelectCard(card); AI.SelectCard(card);
...@@ -1667,9 +1674,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1667,9 +1674,9 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
ClientCard target = Bot.MonsterZone[i]; ClientCard target = Bot.MonsterZone[i];
if (target != null && isAltergeist(target.Id) && target.IsFaceup()) if (target != null && isAltergeist(target) && target.IsFaceup())
{ {
if (target.Id == CardId.Hexstia) if (target.IsCode(CardId.Hexstia))
{ {
int next_index = get_Hexstia_linkzone(i); int next_index = get_Hexstia_linkzone(i);
if (next_index != -1 && Bot.MonsterZone[next_index] != null && Bot.MonsterZone[next_index].IsFaceup() && isAltergeist(Bot.MonsterZone[next_index].Id)) continue; if (next_index != -1 && Bot.MonsterZone[next_index] != null && Bot.MonsterZone[next_index].IsFaceup() && isAltergeist(Bot.MonsterZone[next_index].Id)) continue;
...@@ -1694,13 +1701,13 @@ namespace WindBot.Game.AI.Decks ...@@ -1694,13 +1701,13 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
ClientCard card = Bot.MonsterZone[i]; ClientCard card = Bot.MonsterZone[i];
if (card != null && card.Id == CardId.Hexstia) if (card != null && card.IsCode(CardId.Hexstia))
{ {
int nextzone = get_Hexstia_linkzone(i); int nextzone = get_Hexstia_linkzone(i);
if (nextzone != -1) if (nextzone != -1)
{ {
ClientCard linkedcard = Bot.MonsterZone[nextzone]; ClientCard linkedcard = Bot.MonsterZone[nextzone];
if (linkedcard == null || !isAltergeist(linkedcard.Id)) if (linkedcard == null || !isAltergeist(linkedcard))
{ {
cost_list.Add(CardId.Hexstia); cost_list.Add(CardId.Hexstia);
} }
...@@ -1732,7 +1739,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1732,7 +1739,7 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
if (i == 4) continue; if (i == 4) continue;
if (Bot.MonsterZone[i] != null && Bot.MonsterZone[i].Id == CardId.Hexstia) if (Bot.MonsterZone[i] != null && Bot.MonsterZone[i].IsCode(CardId.Hexstia))
{ {
int next_id = get_Hexstia_linkzone(i); int next_id = get_Hexstia_linkzone(i);
if (next_id != -1) if (next_id != -1)
...@@ -1746,10 +1753,10 @@ namespace WindBot.Game.AI.Decks ...@@ -1746,10 +1753,10 @@ namespace WindBot.Game.AI.Decks
bool should_disnegate = false; bool should_disnegate = false;
foreach(ClientCard card in Bot.GetMonsters()) foreach(ClientCard card in Bot.GetMonsters())
{ {
if (isAltergeist(card.Id)) if (isAltergeist(card))
{ {
if (card.Id == CardId.Silquitous && card.IsFaceup() && !Silquitous_bounced) can_bounce += 10; if (card.IsCode(CardId.Silquitous) && card.IsFaceup() && !Silquitous_bounced) can_bounce += 10;
else if (card.IsFaceup() && card.Id != CardId.Hexstia) can_bounce++; else if (card.IsFaceup() && !card.IsCode(CardId.Hexstia)) can_bounce++;
if (card.IsDisabled() && !Protocol_activing()) should_disnegate = true; if (card.IsDisabled() && !Protocol_activing()) should_disnegate = true;
} }
} }
...@@ -1766,7 +1773,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1766,7 +1773,7 @@ namespace WindBot.Game.AI.Decks
if (card != null if (card != null
&& card.Location == CardLocation.SpellZone && card.Controller == 0 && card.IsFaceup()) && card.Location == CardLocation.SpellZone && card.Controller == 0 && card.IsFaceup())
{ {
if (card.Id == CardId.Manifestation) if (card.IsCode(CardId.Manifestation))
{ {
AI.SelectCard(card); AI.SelectCard(card);
return; return;
...@@ -1777,7 +1784,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1777,7 +1784,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (int id in list) foreach (int id in list)
{ {
if (card?.Id == id && !(id == CardId.Multifaker && AI.Utils.GetLastChainCard() == card)) if (card.IsCode(id) && !(id == CardId.Multifaker && AI.Utils.GetLastChainCard() == card))
{ {
AI.SelectCard(card); AI.SelectCard(card);
return; return;
...@@ -1788,7 +1795,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1788,7 +1795,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (int id in list) foreach (int id in list)
{ {
if (card.IsFaceup() && card.Id == id) if (card.IsFaceup() && card.IsCode(id))
{ {
AI.SelectCard(card); AI.SelectCard(card);
return; return;
...@@ -1799,7 +1806,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1799,7 +1806,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (int id in list) foreach (int id in list)
{ {
if (card.IsFaceup() && card.Id == id) if (card.IsFaceup() && card.IsCode(id))
{ {
AI.SelectCard(card); AI.SelectCard(card);
return; return;
...@@ -1824,7 +1831,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1824,7 +1831,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in Bot.Hand) foreach(ClientCard card in Bot.Hand)
{ {
if (isAltergeist(card.Id)) if (isAltergeist(card))
{ {
has_cost = true; has_cost = true;
break; break;
...@@ -1834,7 +1841,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1834,7 +1841,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if (isAltergeist(card.Id) && card.IsFaceup()) if (isAltergeist(card) && card.IsFaceup())
{ {
has_cost = true; has_cost = true;
break; break;
...@@ -1845,7 +1852,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1845,7 +1852,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in Bot.GetMonsters()) foreach(ClientCard card in Bot.GetMonsters())
{ {
if (isAltergeist(card.Id) && card.IsFaceup()) if (isAltergeist(card) && card.IsFaceup())
{ {
has_cost = true; has_cost = true;
break; break;
...@@ -1856,7 +1863,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1856,7 +1863,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (isAltergeist(card.Id) && card.IsFaceup()) if (isAltergeist(card) && card.IsFaceup())
{ {
has_cost = true; has_cost = true;
break; break;
...@@ -1873,7 +1880,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1873,7 +1880,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card.Id == CardId.Silquitous) if (card.IsCode(CardId.Silquitous))
{ {
AI.SelectCard(card); AI.SelectCard(card);
AI.SelectNextCard(new[] { AI.SelectNextCard(new[] {
...@@ -1916,8 +1923,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1916,8 +1923,7 @@ namespace WindBot.Game.AI.Decks
if (!Multifaker_ssfromhand && Multifaker_candeckss() && can_ss_Multifaker) if (!Multifaker_ssfromhand && Multifaker_candeckss() && can_ss_Multifaker)
{ {
Spoofing_select(new[] Spoofing_select(new[]{
{
CardId.Silquitous, CardId.Silquitous,
CardId.Manifestation, CardId.Manifestation,
CardId.Kunquery, CardId.Kunquery,
...@@ -1941,7 +1947,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1941,7 +1947,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card.Id == CardId.Silquitous) if (card.IsCode(CardId.Silquitous))
{ {
AI.SelectCard(card); AI.SelectCard(card);
AI.SelectNextCard(new[]{ AI.SelectNextCard(new[]{
...@@ -1979,7 +1985,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1979,7 +1985,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card.Id == CardId.Silquitous) if (card.IsCode(CardId.Silquitous))
{ {
AI.SelectCard(card); AI.SelectCard(card);
AI.SelectNextCard(new[]{ AI.SelectNextCard(new[]{
...@@ -2017,7 +2023,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2017,7 +2023,7 @@ namespace WindBot.Game.AI.Decks
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if ( (AI.Utils.ChainContainsCard(_CardId.HarpiesFeatherDuster) || AI.Utils.IsChainTarget(card)) if ( (AI.Utils.ChainContainsCard(_CardId.HarpiesFeatherDuster) || AI.Utils.IsChainTarget(card))
&& card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card.Id)) && card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card))
{ {
AI.SelectCard(card); AI.SelectCard(card);
go = true; go = true;
...@@ -2029,7 +2035,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2029,7 +2035,7 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if ( (AI.Utils.IsChainTarget(card) || AI.Utils.ChainContainsCard(CardId.DarkHole) || (!Protocol_activing() && card.IsDisabled())) if ( (AI.Utils.IsChainTarget(card) || AI.Utils.ChainContainsCard(CardId.DarkHole) || (!Protocol_activing() && card.IsDisabled()))
&& card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card.Id)) && card.IsFaceup() && Duel.LastChainPlayer != 0 && isAltergeist(card))
{ {
Logger.DebugWriteLine("Spoofing target:" + card?.Name); Logger.DebugWriteLine("Spoofing target:" + card?.Name);
AI.SelectCard(card); AI.SelectCard(card);
...@@ -2102,7 +2108,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2102,7 +2108,7 @@ namespace WindBot.Game.AI.Decks
if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 800) return true; if (Enemy.GetMonsterCount() == 0 && Enemy.LifePoints <= 800) return true;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (isAltergeist(card.Id) && card.IsTrap()) if (isAltergeist(card) && card.IsTrap())
{ {
can_summon = true; can_summon = true;
break; break;
...@@ -2110,7 +2116,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2110,7 +2116,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach(ClientCard card in Bot.GetMonstersInMainZone()) foreach(ClientCard card in Bot.GetMonstersInMainZone())
{ {
if (isAltergeist(card.Id)) if (isAltergeist(card))
{ {
can_summon = true; can_summon = true;
break; break;
...@@ -2118,7 +2124,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2118,7 +2124,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach(ClientCard card in Bot.GetSpells()) foreach(ClientCard card in Bot.GetSpells())
{ {
if (isAltergeist(card.Id)) if (isAltergeist(card))
{ {
can_summon = true; can_summon = true;
break; break;
...@@ -2170,7 +2176,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2170,7 +2176,7 @@ namespace WindBot.Game.AI.Decks
AI.SelectPlace(Zones.z1); AI.SelectPlace(Zones.z1);
ss_other_monster = true; ss_other_monster = true;
return true; return true;
} else if (self_card_1.Id == CardId.Meluseek) } else if (self_card_1.IsCode(CardId.Meluseek))
{ {
AI.SelectMaterials(self_card_1); AI.SelectMaterials(self_card_1);
AI.SelectPlace(Zones.z1); AI.SelectPlace(Zones.z1);
...@@ -2188,7 +2194,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2188,7 +2194,7 @@ namespace WindBot.Game.AI.Decks
ss_other_monster = true; ss_other_monster = true;
return true; return true;
} }
else if (self_card_2.Id == CardId.Meluseek) else if (self_card_2.IsCode(CardId.Meluseek))
{ {
AI.SelectMaterials(self_card_2); AI.SelectMaterials(self_card_2);
AI.SelectPlace(Zones.z3); AI.SelectPlace(Zones.z3);
...@@ -2271,7 +2277,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2271,7 +2277,7 @@ namespace WindBot.Game.AI.Decks
ClientCard enemy_card = Enemy.BattlingMonster; ClientCard enemy_card = Enemy.BattlingMonster;
if (enemy_card == null) return false; if (enemy_card == null) return false;
ClientCard self_card = Bot.BattlingMonster; ClientCard self_card = Bot.BattlingMonster;
if (self_card == null) return (enemy_card.Id != CardId.Hayate); if (self_card == null) return (!enemy_card.IsCode(CardId.Hayate));
return (enemy_card.Attack > self_card.GetDefensePower()); return (enemy_card.Attack > self_card.GetDefensePower());
} }
} }
...@@ -2321,8 +2327,8 @@ namespace WindBot.Game.AI.Decks ...@@ -2321,8 +2327,8 @@ namespace WindBot.Game.AI.Decks
int altergeist_count = 0; int altergeist_count = 0;
foreach (ClientCard card in list) foreach (ClientCard card in list)
{ {
if (isAltergeist(card.Id)) altergeist_count++; if (isAltergeist(card)) altergeist_count++;
if (card.Id == CardId.Meluseek && targets.Count < 2 && card.IsFaceup()) if (card.IsCode(CardId.Meluseek) && targets.Count < 2 && card.IsFaceup())
{ {
if ((!Meluseek_searched || !Meluseek_selected) && (!summoned || Duel.Phase == DuelPhase.Main2)) if ((!Meluseek_searched || !Meluseek_selected) && (!summoned || Duel.Phase == DuelPhase.Main2))
{ {
...@@ -2330,7 +2336,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2330,7 +2336,7 @@ namespace WindBot.Game.AI.Decks
targets.Add(card); targets.Add(card);
} }
} }
else if (card.Id == CardId.Silquitous && targets.Count < 2 && card.IsFaceup() && !Bot.HasInGraveyard(CardId.Silquitous)) else if (card.IsCode(CardId.Silquitous) && targets.Count < 2 && card.IsFaceup() && !Bot.HasInGraveyard(CardId.Silquitous))
{ {
if (!Silquitous_recycled || !Silquitous_selected) if (!Silquitous_recycled || !Silquitous_selected)
{ {
...@@ -2338,7 +2344,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2338,7 +2344,7 @@ namespace WindBot.Game.AI.Decks
targets.Add(card); targets.Add(card);
} }
} }
else if (card.Id == CardId.Hexstia && targets.Count < 2 && card.IsFaceup()) else if (card.IsCode(CardId.Hexstia) && targets.Count < 2 && card.IsFaceup())
{ {
if ((!Hexstia_searched || !Hexstia_selected) && !summoned && !Bot.HasInHand(CardId.Marionetter) && Bot.GetRemainingCount(CardId.Marionetter, 3) > 0) if ((!Hexstia_searched || !Hexstia_selected) && !summoned && !Bot.HasInHand(CardId.Marionetter) && Bot.GetRemainingCount(CardId.Marionetter, 3) > 0)
{ {
...@@ -2346,8 +2352,8 @@ namespace WindBot.Game.AI.Decks ...@@ -2346,8 +2352,8 @@ namespace WindBot.Game.AI.Decks
targets.Add(card); targets.Add(card);
} }
} }
else if (isAltergeist(card.Id) && targets.Count < 2 && card.IsFaceup()) targets.Add(card); else if (isAltergeist(card) && targets.Count < 2 && card.IsFaceup()) targets.Add(card);
else if (card.Id == CardId.Silquitous && targets.Count < 2 && card.IsFaceup()) else if (card.IsCode(CardId.Silquitous) && targets.Count < 2 && card.IsFaceup())
{ {
if (!Silquitous_recycled || !Silquitous_selected) if (!Silquitous_recycled || !Silquitous_selected)
{ {
...@@ -2405,7 +2411,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2405,7 +2411,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in Bot.GetMonsters()) foreach(ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.Needlefiber) if (card.IsCode(CardId.Needlefiber))
{ {
list.Add(card); list.Add(card);
link_count += 2; link_count += 2;
...@@ -2592,13 +2598,13 @@ namespace WindBot.Game.AI.Decks ...@@ -2592,13 +2598,13 @@ 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.Meluseek && !attacker.IsDisabled()) if (attacker.IsCode(CardId.Meluseek) && !attacker.IsDisabled())
{ {
if (Enemy.GetMonsterCount() > 0) return attacker; if (Enemy.GetMonsterCount() > 0) return attacker;
// Meluseek attack first even in direct attack // Meluseek attack first even in direct attack
else Meluseek_list.Add(attacker); else Meluseek_list.Add(attacker);
} }
if (attacker.Id == CardId.Borrelsword && !attacker.IsDisabled()) return attacker; if (attacker.IsCode(CardId.Borrelsword) && !attacker.IsDisabled()) return attacker;
} }
if (Meluseek_list.Count > 0) if (Meluseek_list.Count > 0)
{ {
...@@ -2636,12 +2642,12 @@ namespace WindBot.Game.AI.Decks ...@@ -2636,12 +2642,12 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Attack == 0) return (Card.IsAttack()); if (Card.Attack == 0) return (Card.IsAttack());
if (Card.Id == CardId.Meluseek || Bot.HasInMonstersZone(CardId.Meluseek)) if (Card.IsCode(CardId.Meluseek) || Bot.HasInMonstersZone(CardId.Meluseek))
{ {
return Card.HasPosition(CardPosition.Defence); return Card.HasPosition(CardPosition.Defence);
} }
if (isAltergeist(Card.Id) && Bot.HasInHandOrInSpellZone(CardId.Protocol) && Card.IsFacedown()) return true; if (isAltergeist(Card) && Bot.HasInHandOrInSpellZone(CardId.Protocol) && Card.IsFacedown()) return true;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
...@@ -2694,7 +2700,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2694,7 +2700,7 @@ namespace WindBot.Game.AI.Decks
ClientCard defender = defenders[i]; ClientCard defender = defenders[i];
attacker.RealPower = attacker.Attack; attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower(); defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender) && !(attacker.Id == CardId.Borrelsword && !attacker.IsDisabled())) if (!OnPreBattleBetween(attacker, defender) && !(attacker.IsCode(CardId.Borrelsword) && !attacker.IsDisabled()))
continue; continue;
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()))
return AI.Attack(attacker, defender); return AI.Attack(attacker, defender);
...@@ -2711,12 +2717,12 @@ namespace WindBot.Game.AI.Decks ...@@ -2711,12 +2717,12 @@ namespace WindBot.Game.AI.Decks
int HIINT_TOGRAVE = 504; int HIINT_TOGRAVE = 504;
if (max == 1 && cards[0].Location == CardLocation.Deck if (max == 1 && cards[0].Location == CardLocation.Deck
&& AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == 23002292 && Bot.GetRemainingCount(CardId.WakingtheDragon,1) > 0) && AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(23002292) && Bot.GetRemainingCount(CardId.WakingtheDragon,1) > 0)
{ {
IList<ClientCard> result = new List<ClientCard>(); IList<ClientCard> result = new List<ClientCard>();
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (card.Id == CardId.WakingtheDragon) if (card.IsCode(CardId.WakingtheDragon))
{ {
result.Add(card); result.Add(card);
AI.SelectPlace(SelectSetPlace()); AI.SelectPlace(SelectSetPlace());
...@@ -2725,14 +2731,14 @@ namespace WindBot.Game.AI.Decks ...@@ -2725,14 +2731,14 @@ namespace WindBot.Game.AI.Decks
} }
if (result.Count > 0) return result; if (result.Count > 0) return result;
} }
else if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.EvenlyMatched && Duel.LastChainPlayer != 0) else if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.EvenlyMatched) && Duel.LastChainPlayer != 0)
{ {
Logger.DebugWriteLine("EvenlyMatched: min=" + min.ToString() + ", max=" + max.ToString()); Logger.DebugWriteLine("EvenlyMatched: min=" + min.ToString() + ", max=" + max.ToString());
} }
else if (cards[0].Location == CardLocation.Hand && cards[cards.Count - 1].Location == CardLocation.Hand else if (cards[0].Location == CardLocation.Hand && cards[cards.Count - 1].Location == CardLocation.Hand
&& (hint == 501 || hint == HIINT_TOGRAVE) && min == max) && (hint == 501 || hint == HIINT_TOGRAVE) && min == max)
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.OneForOne) return null; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.OneForOne)) return null;
Logger.DebugWriteLine("Hand drop except OneForOne"); Logger.DebugWriteLine("Hand drop except OneForOne");
int todrop = min; int todrop = min;
IList<ClientCard> result = new List<ClientCard>(); IList<ClientCard> result = new List<ClientCard>();
...@@ -2755,7 +2761,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2755,7 +2761,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard card in ToRemove) foreach(ClientCard card in ToRemove)
{ {
if (card.Id == throw_id) if (card.IsCode(throw_id))
{ {
result.Add(card); result.Add(card);
if (--todrop <= 0) return result; if (--todrop <= 0) return result;
...@@ -2807,7 +2813,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2807,7 +2813,7 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
if (i == 4) continue; if (i == 4) continue;
if (Bot.MonsterZone[i] != null && Bot.MonsterZone[i].Id == CardId.Hexstia) if (Bot.MonsterZone[i] != null && Bot.MonsterZone[i].IsCode(CardId.Hexstia))
{ {
int next_index = get_Hexstia_linkzone(i); int next_index = get_Hexstia_linkzone(i);
if (next_index != -1 && (available & (int)(System.Math.Pow(2, next_index))) > 0) if (next_index != -1 && (available & (int)(System.Math.Pow(2, next_index))) > 0)
......
...@@ -111,7 +111,7 @@ namespace WindBot.Game.AI.Decks ...@@ -111,7 +111,7 @@ namespace WindBot.Game.AI.Decks
{ {
List<ClientCard> monster = Bot.GetMonsters(); List<ClientCard> monster = Bot.GetMonsters();
foreach (ClientCard card in monster) foreach (ClientCard card in monster)
if (card != null && card.Id == CardId.KrisTheCrackOfDawn || card.Id == CardId.KalutTheMoonShadow || card.Id == CardId.GaleTheWhirlwind || card.Id == CardId.BoraTheSpear || card.Id == CardId.SiroccoTheDawn || card.Id == CardId.ShuraTheBlueFlame || card.Id == CardId.BlizzardTheFarNorth) if (card != null && card.IsCode(CardId.KrisTheCrackOfDawn, CardId.KalutTheMoonShadow, CardId.GaleTheWhirlwind, CardId.BoraTheSpear, CardId.SiroccoTheDawn, CardId.ShuraTheBlueFlame, CardId.BlizzardTheFarNorth))
return true; return true;
return false; return false;
} }
...@@ -119,7 +119,7 @@ namespace WindBot.Game.AI.Decks ...@@ -119,7 +119,7 @@ namespace WindBot.Game.AI.Decks
private bool KalutTheMoonShadowSummon() private bool KalutTheMoonShadowSummon()
{ {
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
if (card != null && card.Id == CardId.KrisTheCrackOfDawn || card.Id == CardId.GaleTheWhirlwind || card.Id == CardId.BoraTheSpear || card.Id == CardId.SiroccoTheDawn || card.Id == CardId.ShuraTheBlueFlame || card.Id == CardId.BlizzardTheFarNorth) if (card != null && card.IsCode(CardId.KrisTheCrackOfDawn, CardId.GaleTheWhirlwind, CardId.BoraTheSpear, CardId.SiroccoTheDawn, CardId.ShuraTheBlueFlame, CardId.BlizzardTheFarNorth))
return false; return false;
return true; return true;
} }
...@@ -127,7 +127,7 @@ namespace WindBot.Game.AI.Decks ...@@ -127,7 +127,7 @@ namespace WindBot.Game.AI.Decks
private bool BlizzardTheFarNorthSummon() private bool BlizzardTheFarNorthSummon()
{ {
foreach (ClientCard card in Bot.Graveyard) foreach (ClientCard card in Bot.Graveyard)
if (card != null && card.Id == CardId.KalutTheMoonShadow || card.Id == CardId.BoraTheSpear || card.Id == CardId.ShuraTheBlueFlame || card.Id == CardId.KrisTheCrackOfDawn) if (card != null && card.IsCode(CardId.KalutTheMoonShadow, CardId.BoraTheSpear, CardId.ShuraTheBlueFlame, CardId.KrisTheCrackOfDawn))
return true; return true;
return false; return false;
} }
...@@ -138,7 +138,7 @@ namespace WindBot.Game.AI.Decks ...@@ -138,7 +138,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> monster = Bot.GetMonsters(); List<ClientCard> monster = Bot.GetMonsters();
foreach (ClientCard card in monster) foreach (ClientCard card in monster)
if (card != null && card.Id == CardId.KrisTheCrackOfDawn || card.Id == CardId.KalutTheMoonShadow || card.Id == CardId.GaleTheWhirlwind || card.Id == CardId.BoraTheSpear || card.Id == CardId.SiroccoTheDawn || card.Id == CardId.ShuraTheBlueFlame || card.Id == CardId.BlizzardTheFarNorth) if (card != null && card.IsCode(CardId.KrisTheCrackOfDawn, CardId.KalutTheMoonShadow, CardId.GaleTheWhirlwind, CardId.BoraTheSpear, CardId.SiroccoTheDawn, CardId.ShuraTheBlueFlame, CardId.BlizzardTheFarNorth))
Count++; Count++;
if (Count == 3) if (Count == 3)
......
...@@ -141,8 +141,8 @@ namespace WindBot.Game.AI.Decks ...@@ -141,8 +141,8 @@ namespace WindBot.Game.AI.Decks
Logger.DebugWriteLine("OnSelectCard MelodyOfAwakeningDragon"); Logger.DebugWriteLine("OnSelectCard MelodyOfAwakeningDragon");
List<ClientCard> result = new List<ClientCard>(); List<ClientCard> result = new List<ClientCard>();
if (!Bot.HasInHand(CardId.WhiteDragon)) if (!Bot.HasInHand(CardId.WhiteDragon))
result.AddRange(cards.Where(card => card.Id == CardId.WhiteDragon).Take(1)); result.AddRange(cards.Where(card => card.IsCode(CardId.WhiteDragon)).Take(1));
result.AddRange(cards.Where(card => card.Id == CardId.AlternativeWhiteDragon)); result.AddRange(cards.Where(card => card.IsCode(CardId.AlternativeWhiteDragon)));
return AI.Utils.CheckSelectCount(result, cards, min, max); return AI.Utils.CheckSelectCount(result, cards, min, max);
} }
Logger.DebugWriteLine("Use default."); Logger.DebugWriteLine("Use default.");
...@@ -883,23 +883,16 @@ namespace WindBot.Game.AI.Decks ...@@ -883,23 +883,16 @@ namespace WindBot.Game.AI.Decks
return true; return true;
if (Card.IsDefense() && !enemyBetter && Card.Attack >= Card.Defense) if (Card.IsDefense() && !enemyBetter && Card.Attack >= Card.Defense)
return true; return true;
if (Card.IsDefense() && ( if (Card.IsDefense() && Card.IsCode(CardId.BlueEyesSpiritDragon, CardId.AzureEyesSilverDragon))
Card.Id == CardId.BlueEyesSpiritDragon
|| Card.Id == CardId.AzureEyesSilverDragon
))
return true; return true;
if (Card.IsAttack() && ( if (Card.IsAttack() && Card.IsCode(CardId.SageWithEyesOfBlue, CardId.WhiteStoneOfAncients, CardId.WhiteStoneOfLegend))
Card.Id == CardId.SageWithEyesOfBlue
|| Card.Id == CardId.WhiteStoneOfAncients
|| Card.Id == CardId.WhiteStoneOfLegend
))
return true; return true;
return false; return false;
} }
private bool SpellSet() private bool SpellSet()
{ {
return (Card.IsTrap() || (Card.Id==CardId.SilversCry)) && Bot.GetSpellCountWithoutField() < 4; return (Card.IsTrap() || Card.IsCode(CardId.SilversCry)) && Bot.GetSpellCountWithoutField() < 4;
} }
private bool HasTwoInHand(int id) private bool HasTwoInHand(int id)
...@@ -907,7 +900,7 @@ namespace WindBot.Game.AI.Decks ...@@ -907,7 +900,7 @@ namespace WindBot.Game.AI.Decks
int num = 0; int num = 0;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card != null && card.Id == id) if (card != null && card.IsCode(id))
num++; num++;
} }
return num >= 2; return num >= 2;
......
...@@ -104,17 +104,17 @@ namespace WindBot.Game.AI.Decks ...@@ -104,17 +104,17 @@ namespace WindBot.Game.AI.Decks
MaxDragon_count = 0; MaxDragon_count = 0;
foreach (ClientCard check in Bot.Hand) foreach (ClientCard check in Bot.Hand)
{ {
if (check.Id == CardId.AdvancedRitualArt) if (check.IsCode(CardId.AdvancedRitualArt))
RitualArt_count++; RitualArt_count++;
if (check.Id == CardId.ChaosForm) if (check.IsCode(CardId.ChaosForm))
ChaosForm_count++; ChaosForm_count++;
if (check.Id == CardId.DevirrtualCandoll) if (check.IsCode(CardId.DevirrtualCandoll))
Candoll_count++; Candoll_count++;
if (check.Id == CardId.DeviritualTalismandra) if (check.IsCode(CardId.DeviritualTalismandra))
Talismandra_count++; Talismandra_count++;
if (check.Id == CardId.BlueEyesChaosMaxDragon) if (check.IsCode(CardId.BlueEyesChaosMaxDragon))
MaxDragon_count++; MaxDragon_count++;
if (check.Id == CardId.TheMelodyOfAwakeningDragon) if (check.IsCode(CardId.TheMelodyOfAwakeningDragon))
TheMelody_count++; TheMelody_count++;
} }
} }
...@@ -129,28 +129,28 @@ namespace WindBot.Game.AI.Decks ...@@ -129,28 +129,28 @@ namespace WindBot.Game.AI.Decks
if(Duel.LastChainPlayer==1) if(Duel.LastChainPlayer==1)
{ {
ClientCard lastCard = AI.Utils.GetLastChainCard(); ClientCard lastCard = AI.Utils.GetLastChainCard();
if (lastCard.Id==CardId.MaxxC) if (lastCard.IsCode(CardId.MaxxC))
{ {
AI.SelectCard(CardId.MaxxC); AI.SelectCard(CardId.MaxxC);
if(AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if(AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon }); AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (lastCard.Id == CardId.LockBird) if (lastCard.IsCode(CardId.LockBird))
{ {
AI.SelectCard(CardId.LockBird); AI.SelectCard(CardId.LockBird);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon }); AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (lastCard.Id == CardId.Ghost) if (lastCard.IsCode(CardId.Ghost))
{ {
AI.SelectCard(CardId.Ghost); AI.SelectCard(CardId.Ghost);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon }); AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell(); return UniqueFaceupSpell();
} }
if (lastCard.Id == CardId.AshBlossom) if (lastCard.IsCode(CardId.AshBlossom))
{ {
AI.SelectCard(CardId.AshBlossom); AI.SelectCard(CardId.AshBlossom);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon)) if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
...@@ -216,13 +216,13 @@ namespace WindBot.Game.AI.Decks ...@@ -216,13 +216,13 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard m in Bot.Hand) foreach (ClientCard m in Bot.Hand)
{ {
if (m.Id == CardId.AdvancedRitualArt) if (m.IsCode(CardId.AdvancedRitualArt))
AI.SelectCard(m); AI.SelectCard(m);
} }
} }
foreach(ClientCard m in Bot.Hand) foreach(ClientCard m in Bot.Hand)
{ {
if (m.Id != CardId.AdvancedRitualArt) if (!m.IsCode(CardId.AdvancedRitualArt))
AI.SelectCard(m); AI.SelectCard(m);
} }
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon }); AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
...@@ -329,15 +329,13 @@ namespace WindBot.Game.AI.Decks ...@@ -329,15 +329,13 @@ namespace WindBot.Game.AI.Decks
ClientCard check = null; ClientCard check = null;
foreach (ClientCard m in Bot.GetGraveyardMonsters()) foreach (ClientCard m in Bot.GetGraveyardMonsters())
{ {
if (m.Id == CardId.BlueEyesAlternativeWhiteDragon || if (m.IsCode(CardId.BlueEyesAlternativeWhiteDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesWhiteDragon))
m.Id == CardId.BlueEyesChaosMaxDragon ||
m.Id == CardId.BlueEyesWhiteDragon)
check = m; check = m;
} }
foreach (ClientCard m in Bot.Hand) foreach (ClientCard m in Bot.Hand)
{ {
if (m.Id == CardId.BlueEyesWhiteDragon) if (m.IsCode(CardId.BlueEyesWhiteDragon))
check = m; check = m;
} }
if (check != null) if (check != null)
...@@ -351,7 +349,7 @@ namespace WindBot.Game.AI.Decks ...@@ -351,7 +349,7 @@ namespace WindBot.Game.AI.Decks
private bool DeviritualCheck() private bool DeviritualCheck()
{ {
Count_check(); Count_check();
if(Card.Id==CardId.DeviritualTalismandra || Card.Id==CardId.DevirrtualCandoll) if(Card.IsCode(CardId.DeviritualTalismandra, CardId.DevirrtualCandoll))
{ {
if (Card.Location == CardLocation.MonsterZone) if (Card.Location == CardLocation.MonsterZone)
{ {
...@@ -367,12 +365,12 @@ namespace WindBot.Game.AI.Decks ...@@ -367,12 +365,12 @@ namespace WindBot.Game.AI.Decks
} }
if(Card.Location==CardLocation.Hand) if(Card.Location==CardLocation.Hand)
{ {
if(Card.Id==CardId.DevirrtualCandoll) if(Card.IsCode(CardId.DevirrtualCandoll))
{ {
if (MaxDragon_count >= 2 && Talismandra_count >= 1 || Candoll_used) if (MaxDragon_count >= 2 && Talismandra_count >= 1 || Candoll_used)
return false; return false;
} }
if(Card.Id==CardId.DeviritualTalismandra) if(Card.IsCode(CardId.DeviritualTalismandra))
{ {
if (RitualArt_count + ChaosForm_count >= 2 && Candoll_count >= 1 || Talismandra_used) if (RitualArt_count + ChaosForm_count >= 2 && Candoll_count >= 1 || Talismandra_used)
return false; return false;
...@@ -402,9 +400,7 @@ namespace WindBot.Game.AI.Decks ...@@ -402,9 +400,7 @@ namespace WindBot.Game.AI.Decks
ClientCard check = null; ClientCard check = null;
foreach(ClientCard m in Bot.Graveyard) foreach(ClientCard m in Bot.Graveyard)
{ {
if (m.Id == CardId.BlueEyesAlternativeWhiteDragon || if (m.IsCode(CardId.BlueEyesAlternativeWhiteDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesWhiteDragon))
m.Id == CardId.BlueEyesChaosMaxDragon ||
m.Id == CardId.BlueEyesWhiteDragon)
check = m; check = m;
} }
...@@ -417,7 +413,7 @@ namespace WindBot.Game.AI.Decks ...@@ -417,7 +413,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach(ClientCard m in Bot.Hand) foreach(ClientCard m in Bot.Hand)
{ {
if (m.Id == CardId.BlueEyesWhiteDragon) if (m.IsCode(CardId.BlueEyesWhiteDragon))
check = m; check = m;
} }
if (check != null) if (check != null)
...@@ -461,7 +457,7 @@ namespace WindBot.Game.AI.Decks ...@@ -461,7 +457,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard c in Bot.GetMonsters()) foreach (ClientCard c in Bot.GetMonsters())
{ {
if (c.Id != CardId.Linkuriboh && c.Level == 1) if (!c.IsCode(CardId.Linkuriboh) && c.Level == 1)
{ {
AI.SelectMaterials(c); AI.SelectMaterials(c);
return true; return true;
...@@ -472,7 +468,7 @@ namespace WindBot.Game.AI.Decks ...@@ -472,7 +468,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
private bool BirrelswordDragonsp() private bool BirrelswordDragonsp()
...@@ -481,7 +477,7 @@ namespace WindBot.Game.AI.Decks ...@@ -481,7 +477,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (m.Id == CardId.MissusRadiant) if (m.IsCode(CardId.MissusRadiant))
{ {
material_list.Add(m); material_list.Add(m);
break; break;
...@@ -489,7 +485,7 @@ namespace WindBot.Game.AI.Decks ...@@ -489,7 +485,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (m.Id == CardId.Linkuriboh || m.Level==1) if (m.IsCode(CardId.Linkuriboh) || m.Level==1)
{ {
material_list.Add(m); material_list.Add(m);
if (material_list.Count == 3) if (material_list.Count == 3)
...@@ -541,11 +537,11 @@ namespace WindBot.Game.AI.Decks ...@@ -541,11 +537,11 @@ namespace WindBot.Game.AI.Decks
} }
private bool SpellSet() private bool SpellSet()
{ {
if (Card.Id == CardId.InfiniteImpermanence) if (Card.IsCode(CardId.InfiniteImpermanence))
return !Bot.IsFieldEmpty(); return !Bot.IsFieldEmpty();
if (Card.Id == CardId.RecklessGreed) if (Card.IsCode(CardId.RecklessGreed))
return true; return true;
if (Card.Id == CardId.Scapegoat) if (Card.IsCode(CardId.Scapegoat))
return true; return true;
return false; return false;
} }
...@@ -555,7 +551,7 @@ namespace WindBot.Game.AI.Decks ...@@ -555,7 +551,7 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.RecklessGreed) if (card.IsCode(CardId.RecklessGreed))
count++; count++;
} }
if (DefaultOnBecomeTarget()) return true; if (DefaultOnBecomeTarget()) return true;
...@@ -589,7 +585,7 @@ namespace WindBot.Game.AI.Decks ...@@ -589,7 +585,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.BlueEyesChaosMaxDragon) if (attacker.IsCode(CardId.BlueEyesChaosMaxDragon))
{ {
Logger.DebugWriteLine(attacker.Name); Logger.DebugWriteLine(attacker.Name);
return attacker; return attacker;
...@@ -599,7 +595,7 @@ namespace WindBot.Game.AI.Decks ...@@ -599,7 +595,7 @@ namespace WindBot.Game.AI.Decks
} }
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders) public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{ {
if(attacker.Id==CardId.BlueEyesChaosMaxDragon && !attacker.IsDisabled() && if(attacker.IsCode(CardId.BlueEyesChaosMaxDragon) && !attacker.IsDisabled() &&
Enemy.HasInMonstersZone(new[] {CardId.DeviritualTalismandra,CardId.DevirrtualCandoll })) Enemy.HasInMonstersZone(new[] {CardId.DeviritualTalismandra,CardId.DevirrtualCandoll }))
{ {
for (int i = 0; i < defenders.Count; i++) for (int i = 0; i < defenders.Count; i++)
...@@ -609,7 +605,7 @@ namespace WindBot.Game.AI.Decks ...@@ -609,7 +605,7 @@ namespace WindBot.Game.AI.Decks
defender.RealPower = defender.GetDefensePower(); defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender)) if (!OnPreBattleBetween(attacker, defender))
continue; continue;
if (defender.Id == CardId.DevirrtualCandoll || defender.Id == CardId.DeviritualTalismandra) if (defender.IsCode(CardId.DevirrtualCandoll, CardId.DeviritualTalismandra))
{ {
return AI.Attack(attacker, defender); return AI.Attack(attacker, defender);
} }
......
...@@ -108,7 +108,7 @@ namespace WindBot.Game.AI.Decks ...@@ -108,7 +108,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.Marshmallon || card.Id == CardId.SpiritReaper) if (card.IsCode(CardId.Marshmallon, CardId.SpiritReaper))
{ {
return false; return false;
} }
...@@ -134,9 +134,9 @@ namespace WindBot.Game.AI.Decks ...@@ -134,9 +134,9 @@ namespace WindBot.Game.AI.Decks
private bool ReposEverything() private bool ReposEverything()
{ {
if (Card.Id == CardId.ReflectBounder) if (Card.IsCode(CardId.ReflectBounder))
return Card.IsDefense(); return Card.IsDefense();
if (Card.Id == CardId.FencingFireFerret) if (Card.IsCode(CardId.FencingFireFerret))
return DefaultMonsterRepos(); return DefaultMonsterRepos();
if (Card.IsAttack()) if (Card.IsAttack())
return true; return true;
......
...@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks ...@@ -227,7 +227,7 @@ namespace WindBot.Game.AI.Decks
{ {
return (id == CardId.SandaionTheTimelord || return (id == CardId.SandaionTheTimelord ||
id == CardId.BattleFader || id == CardId.BattleFader ||
id ==CardId.MichionTimelord id == CardId.MichionTimelord
); );
} }
bool no_sp = false; bool no_sp = false;
...@@ -322,49 +322,49 @@ namespace WindBot.Game.AI.Decks ...@@ -322,49 +322,49 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> check = Bot.GetSpells(); IList<ClientCard> check = Bot.GetSpells();
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.AccuulatedFortune) if (card.IsCode(CardId.AccuulatedFortune))
HasAccuulatedFortune++; HasAccuulatedFortune++;
} }
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.SecretBlast) if (card.IsCode(CardId.SecretBlast))
blast_count++; blast_count++;
} }
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.SectetBarrel) if (card.IsCode(CardId.SectetBarrel))
barrel_count++; barrel_count++;
} }
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.JustDesserts) if (card.IsCode(CardId.JustDesserts))
just_count++; just_count++;
} }
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.ChainStrike) if (card.IsCode(CardId.ChainStrike))
strike_count++; strike_count++;
} }
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.RecklessGreed) if (card.IsCode(CardId.RecklessGreed))
greed_count++; greed_count++;
} }
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.Waboku) if (card.IsCode(CardId.Waboku))
Waboku_count++; Waboku_count++;
} }
foreach (ClientCard card in check) foreach (ClientCard card in check)
{ {
if (card.Id == CardId.ThreateningRoar) if (card.IsCode(CardId.ThreateningRoar))
Roar_count++; Roar_count++;
} }
...@@ -418,7 +418,7 @@ namespace WindBot.Game.AI.Decks ...@@ -418,7 +418,7 @@ namespace WindBot.Game.AI.Decks
if (AI.Utils.IsChainTarget(Card)) return true; if (AI.Utils.IsChainTarget(Card)) return true;
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card.Id == CardId.HarpiesFeatherDuster&&card.IsFaceup()) if (card.IsCode(CardId.HarpiesFeatherDuster)&&card.IsFaceup())
{ {
return true; return true;
} }
...@@ -432,7 +432,7 @@ namespace WindBot.Game.AI.Decks ...@@ -432,7 +432,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool BrunSpellSet() private bool BrunSpellSet()
{ {
if (Card.Id == CardId.OjamaTrio && Bot.HasInSpellZone(CardId.OjamaTrio))return false; if (Card.IsCode(CardId.OjamaTrio) && Bot.HasInSpellZone(CardId.OjamaTrio))return false;
return (Card.IsTrap() || Card.HasType(CardType.QuickPlay)) && Bot.GetSpellCountWithoutField() < 5; return (Card.IsTrap() || Card.HasType(CardType.QuickPlay)) && Bot.GetSpellCountWithoutField() < 5;
} }
private bool MichionTimelordsummon() private bool MichionTimelordsummon()
...@@ -565,7 +565,7 @@ namespace WindBot.Game.AI.Decks ...@@ -565,7 +565,7 @@ namespace WindBot.Game.AI.Decks
int count=0; int count=0;
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.RecklessGreed) if (card.IsCode(CardId.RecklessGreed))
count++; count++;
} }
...@@ -668,7 +668,7 @@ namespace WindBot.Game.AI.Decks ...@@ -668,7 +668,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.CardcarD && card.IsFaceup()) if (card.IsCode(CardId.CardcarD) && card.IsFaceup())
return false; return false;
} }
if (Bot.GetHandCount() == 1 && Bot.GetSpellCountWithoutField() <= 3) if (Bot.GetHandCount() == 1 && Bot.GetSpellCountWithoutField() <= 3)
...@@ -694,7 +694,7 @@ namespace WindBot.Game.AI.Decks ...@@ -694,7 +694,7 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.DiceJar && card.IsFacedown()) if (card.IsCode(CardId.DiceJar) && card.IsFacedown())
return true; return true;
break; break;
} }
...@@ -725,24 +725,24 @@ namespace WindBot.Game.AI.Decks ...@@ -725,24 +725,24 @@ namespace WindBot.Game.AI.Decks
if (GetTotalATK(newlist) / 2 >= Enemy.LifePoints && Bot.HasInSpellZone(CardId.BlazingMirrorForce)) if (GetTotalATK(newlist) / 2 >= Enemy.LifePoints && Bot.HasInSpellZone(CardId.BlazingMirrorForce))
return false; return false;
if (AI.Utils.GetLastChainCard() == null) return true; if (AI.Utils.GetLastChainCard() == null) return true;
if (AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false; if (AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
public bool MonsterRepos() public bool MonsterRepos()
{ {
if (Card.IsFacedown() && Card.Id!=CardId.DiceJar) if (Card.IsFacedown() && !Card.IsCode(CardId.DiceJar))
return true; return true;
return base.DefaultMonsterRepos(); return base.DefaultMonsterRepos();
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (attacker.Id == CardId.Linkuriboh && defender.IsFacedown()) return false; if (attacker.IsCode(CardId.Linkuriboh) && defender.IsFacedown()) return false;
if (attacker.Id == CardId.SandaionTheTimelord && !attacker.IsDisabled()) if (attacker.IsCode(CardId.SandaionTheTimelord) && !attacker.IsDisabled())
{ {
attacker.RealPower = 9999; attacker.RealPower = 9999;
return true; return true;
} }
if(attacker.Id==CardId.MichionTimelord && !attacker.IsDisabled()) if(attacker.IsCode(CardId.MichionTimelord) && !attacker.IsDisabled())
{ {
attacker.RealPower = 9999; attacker.RealPower = 9999;
return true; return true;
...@@ -771,49 +771,49 @@ namespace WindBot.Game.AI.Decks ...@@ -771,49 +771,49 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> check = Bot.GetSpells(); IList<ClientCard> check = Bot.GetSpells();
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.AccuulatedFortune) if (card1.IsCode(CardId.AccuulatedFortune))
HasAccuulatedFortune++; HasAccuulatedFortune++;
} }
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.SecretBlast) if (card1.IsCode(CardId.SecretBlast))
blast_count++; blast_count++;
} }
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.SectetBarrel) if (card1.IsCode(CardId.SectetBarrel))
barrel_count++; barrel_count++;
} }
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.JustDesserts) if (card1.IsCode(CardId.JustDesserts))
just_count++; just_count++;
} }
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.ChainStrike) if (card1.IsCode(CardId.ChainStrike))
strike_count++; strike_count++;
} }
foreach (ClientCard card1 in Bot.GetSpells()) foreach (ClientCard card1 in Bot.GetSpells())
{ {
if (card1.Id == CardId.RecklessGreed) if (card1.IsCode(CardId.RecklessGreed))
greed_count++; greed_count++;
} }
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.Waboku) if (card1.IsCode(CardId.Waboku))
Waboku_count++; Waboku_count++;
} }
foreach (ClientCard card1 in check) foreach (ClientCard card1 in check)
{ {
if (card1.Id == CardId.ThreateningRoar) if (card1.IsCode(CardId.ThreateningRoar))
Roar_count++; Roar_count++;
} }
......
...@@ -169,7 +169,7 @@ namespace WindBot.Game.AI.Decks ...@@ -169,7 +169,7 @@ namespace WindBot.Game.AI.Decks
int BotZone = 0; int BotZone = 0;
for (int i = 0; i <= 6; i++) for (int i = 0; i <= 6; i++)
{ {
if (Enemy.MonsterZone[i] != null && Enemy.MonsterZone[i].Id == CardId.MekkKnightMorningStar) if (Enemy.MonsterZone[i] != null && Enemy.MonsterZone[i].IsCode(CardId.MekkKnightMorningStar))
{ {
MekkKnightZone = i; MekkKnightZone = i;
break; break;
...@@ -242,7 +242,7 @@ namespace WindBot.Game.AI.Decks ...@@ -242,7 +242,7 @@ namespace WindBot.Game.AI.Decks
ApprenticeLllusionMagician_count = 0; ApprenticeLllusionMagician_count = 0;
foreach (ClientCard count in Bot.GetMonsters()) foreach (ClientCard count in Bot.GetMonsters())
{ {
if (count.Id == CardId.ApprenticeLllusionMagician && count.IsFaceup()) if (count.IsCode(CardId.ApprenticeLllusionMagician) && count.IsFaceup())
ApprenticeLllusionMagician_count++; ApprenticeLllusionMagician_count++;
} }
foreach (ClientCard dangerous in Enemy.GetMonsters()) foreach (ClientCard dangerous in Enemy.GetMonsters())
...@@ -352,7 +352,7 @@ namespace WindBot.Game.AI.Decks ...@@ -352,7 +352,7 @@ namespace WindBot.Game.AI.Decks
int ghost_count = 0; int ghost_count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.Ghost) if (check.IsCode(CardId.Ghost))
ghost_count++; ghost_count++;
} }
if (ghost_count != ghost_done) if (ghost_count != ghost_done)
...@@ -502,7 +502,7 @@ namespace WindBot.Game.AI.Decks ...@@ -502,7 +502,7 @@ namespace WindBot.Game.AI.Decks
private bool ChainEnemy() private bool ChainEnemy()
{ {
if (AI.Utils.GetLastChainCard() != null && if (AI.Utils.GetLastChainCard() != null &&
AI.Utils.GetLastChainCard().Id == CardId.UpstartGoblin) AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
...@@ -577,7 +577,7 @@ namespace WindBot.Game.AI.Decks ...@@ -577,7 +577,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard c in Bot.GetMonsters()) foreach (ClientCard c in Bot.GetMonsters())
{ {
if (c.Id != CardId.WindwitchSnowBell && c.Level == 1 && c.Id != CardId.LinkSpider && c.Id != CardId.Linkuriboh) if (!c.IsCode(CardId.WindwitchSnowBell) && c.Level == 1 && !c.IsCode(CardId.LinkSpider) && !c.IsCode(CardId.Linkuriboh))
{ {
AI.SelectCard(c); AI.SelectCard(c);
return true; return true;
...@@ -589,7 +589,7 @@ namespace WindBot.Game.AI.Decks ...@@ -589,7 +589,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false; if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false;
return true; return true;
} }
...@@ -636,7 +636,7 @@ namespace WindBot.Game.AI.Decks ...@@ -636,7 +636,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> magician = new List<ClientCard>(); IList<ClientCard> magician = new List<ClientCard>();
foreach (ClientCard check in grave) foreach (ClientCard check in grave)
{ {
if (check.Id == CardId.DarkMagician) if (check.IsCode(CardId.DarkMagician))
{ {
magician.Add(check); magician.Add(check);
} }
...@@ -653,7 +653,7 @@ namespace WindBot.Game.AI.Decks ...@@ -653,7 +653,7 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard target in Duel.ChainTargets) foreach (ClientCard target in Duel.ChainTargets)
{ {
if ((target.Id == CardId.DarkMagician || target.Id == CardId.DarkMagicianTheDragonKnight) if ((target.IsCode(CardId.DarkMagician, CardId.DarkMagicianTheDragonKnight))
&& Card.IsFacedown()) && Card.IsFacedown())
{ {
AI.SelectYesNo(false); AI.SelectYesNo(false);
...@@ -793,7 +793,7 @@ namespace WindBot.Game.AI.Decks ...@@ -793,7 +793,7 @@ namespace WindBot.Game.AI.Decks
bool soul_faceup = false; bool soul_faceup = false;
foreach (ClientCard check in Bot.GetSpells()) foreach (ClientCard check in Bot.GetSpells())
{ {
if (check.Id == CardId.EternalSoul && check.IsFaceup()) if (check.IsCode(CardId.EternalSoul) && check.IsFaceup())
{ {
soul_faceup = true; soul_faceup = true;
} }
...@@ -940,7 +940,7 @@ namespace WindBot.Game.AI.Decks ...@@ -940,7 +940,7 @@ namespace WindBot.Game.AI.Decks
//AI.SelectPlace(Zones.z2, 2); //AI.SelectPlace(Zones.z2, 2);
foreach (ClientCard m in Bot.GetSpells()) foreach (ClientCard m in Bot.GetSpells())
{ {
if (m.Id == CardId.EternalSoul && m.IsFaceup()) if (m.IsCode(CardId.EternalSoul) && m.IsFaceup())
soul_exist = true; soul_exist = true;
} }
if (!soul_used && soul_exist) if (!soul_used && soul_exist)
...@@ -957,12 +957,12 @@ namespace WindBot.Game.AI.Decks ...@@ -957,12 +957,12 @@ namespace WindBot.Game.AI.Decks
int ghost_count = 0; int ghost_count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.Ghost) if (check.IsCode(CardId.Ghost))
ghost_count++; ghost_count++;
} }
if (ghost_count != ghost_done) if (ghost_count != ghost_done)
{ {
if (Duel.CurrentChain.Count >= 2 && AI.Utils.GetLastChainCard().Id == 0) if (Duel.CurrentChain.Count >= 2 && AI.Utils.GetLastChainCard().IsCode(0))
{ {
AI.SelectCard(CardId.MagiciansRod); AI.SelectCard(CardId.MagiciansRod);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician }); AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
...@@ -981,7 +981,7 @@ namespace WindBot.Game.AI.Decks ...@@ -981,7 +981,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (count == 0) return false; if (count == 0) return false;
if ((target.Id == CardId.WindwitchGlassBell || target.Id == CardId.WindwitchIceBell) && if ((target.IsCode(CardId.WindwitchGlassBell, CardId.WindwitchIceBell)) &&
Bot.HasInMonstersZone(CardId.WindwitchIceBell) && Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchGlassBell)) Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
return false; return false;
...@@ -1077,7 +1077,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1077,7 +1077,7 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard check in Bot.GetMonsters()) foreach (ClientCard check in Bot.GetMonsters())
{ {
if (check.Id != CardId.CrystalWingSynchroDragon) if (!check.IsCode(CardId.CrystalWingSynchroDragon))
count++; count++;
} }
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%SpellCaster= " + count); Logger.DebugWriteLine("%%%%%%%%%%%%%%%%SpellCaster= " + count);
...@@ -1118,7 +1118,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1118,7 +1118,7 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard check in Bot.GetMonsters()) foreach (ClientCard check in Bot.GetMonsters())
{ {
if (check.Id != CardId.CrystalWingSynchroDragon) if (!check.IsCode(CardId.CrystalWingSynchroDragon))
count++; count++;
} }
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%SpellCaster= " + count); Logger.DebugWriteLine("%%%%%%%%%%%%%%%%SpellCaster= " + count);
...@@ -1208,7 +1208,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1208,7 +1208,7 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard check in Bot.Hand) foreach (ClientCard check in Bot.Hand)
{ {
if (check.Id == CardId.WonderWand) if (check.IsCode(CardId.WonderWand))
count++; count++;
} }
if (count >= 2) if (count >= 2)
...@@ -1241,7 +1241,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1241,7 +1241,7 @@ namespace WindBot.Game.AI.Decks
int Navigation_count = 0; int Navigation_count = 0;
foreach (ClientCard Navigation in Bot.Hand) foreach (ClientCard Navigation in Bot.Hand)
{ {
if (Navigation.Id == CardId.MagicianNavigation) if (Navigation.IsCode(CardId.MagicianNavigation))
Navigation_count++; Navigation_count++;
} }
if (Navigation_count >= 2) if (Navigation_count >= 2)
...@@ -1619,7 +1619,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1619,7 +1619,7 @@ namespace WindBot.Game.AI.Decks
int rod_count = 0; int rod_count = 0;
foreach (ClientCard rod in Bot.GetMonsters()) foreach (ClientCard rod in Bot.GetMonsters())
{ {
if (rod.Id == CardId.MagiciansRod) if (rod.IsCode(CardId.MagiciansRod))
rod_count++; rod_count++;
} }
if (rod_count >= 2) if (rod_count >= 2)
...@@ -1716,7 +1716,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1716,7 +1716,7 @@ namespace WindBot.Game.AI.Decks
int maxxc_count = 0; int maxxc_count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.MaxxC) if (check.IsCode(CardId.MaxxC))
maxxc_count++; maxxc_count++;
} }
if (maxxc_count != maxxc_done) if (maxxc_count != maxxc_done)
...@@ -1727,7 +1727,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1727,7 +1727,7 @@ namespace WindBot.Game.AI.Decks
int lockbird_count = 0; int lockbird_count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.LockBird) if (check.IsCode(CardId.LockBird))
lockbird_count++; lockbird_count++;
} }
if (lockbird_count != lockbird_done) if (lockbird_count != lockbird_done)
...@@ -1738,7 +1738,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1738,7 +1738,7 @@ namespace WindBot.Game.AI.Decks
int ghost_count = 0; int ghost_count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.Ghost) if (check.IsCode(CardId.Ghost))
ghost_count++; ghost_count++;
} }
if (ghost_count != ghost_done) if (ghost_count != ghost_done)
...@@ -1766,21 +1766,21 @@ namespace WindBot.Game.AI.Decks ...@@ -1766,21 +1766,21 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.MaxxC) if (check.IsCode(CardId.MaxxC))
count++; count++;
} }
maxxc_done = count; maxxc_done = count;
count = 0; count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.LockBird) if (check.IsCode(CardId.LockBird))
count++; count++;
} }
lockbird_done = count; lockbird_done = count;
count = 0; count = 0;
foreach (ClientCard check in Enemy.Graveyard) foreach (ClientCard check in Enemy.Graveyard)
{ {
if (check.Id == CardId.Ghost) if (check.IsCode(CardId.Ghost))
count++; count++;
} }
ghost_done = count; ghost_done = count;
...@@ -1800,7 +1800,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1800,7 +1800,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b] != null && if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b] != null &&
SameMonsterColumn(a, b) && SameMonsterColumn(a, b) &&
Bot.MonsterZone[a].Id == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id) Bot.MonsterZone[a].IsCode(attacker.Id) && Enemy.MonsterZone[b].IsCode(defender.Id))
{ {
attackerzone = a; attackerzone = a;
defenderzone = b; defenderzone = b;
...@@ -1820,27 +1820,23 @@ namespace WindBot.Game.AI.Decks ...@@ -1820,27 +1820,23 @@ namespace WindBot.Game.AI.Decks
if (Duel.Player == 0 && Bot.GetMonsterCount() >= 2 && plan_C) if (Duel.Player == 0 && Bot.GetMonsterCount() >= 2 && plan_C)
{ {
Logger.DebugWriteLine("*********dangerous********************* "); Logger.DebugWriteLine("*********dangerous********************* ");
if (attacker.Id == CardId.OddEyesAbsoluteDragon || attacker.Id == CardId.OddEyesWingDragon) if (attacker.IsCode(CardId.OddEyesAbsoluteDragon, CardId.OddEyesWingDragon))
attacker.RealPower = 9999; attacker.RealPower = 9999;
} }
if ((attacker.Id == CardId.DarkMagician || if ((attacker.IsCode(CardId.DarkMagician, CardId.MagiciansRod, CardId.BigEye, CardId.ApprenticeWitchling)) &&
attacker.Id == CardId.MagiciansRod ||
attacker.Id == CardId.BigEye ||
attacker.Id == CardId.ApprenticeWitchling) &&
Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician)) Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{ {
attacker.RealPower += 2000; attacker.RealPower += 2000;
} }
if (attacker.Id == CardId.ApprenticeLllusionMagician && ApprenticeLllusionMagician_count >= 2) if (attacker.IsCode(CardId.ApprenticeLllusionMagician) && ApprenticeLllusionMagician_count >= 2)
{ {
attacker.RealPower += 2000; attacker.RealPower += 2000;
} }
if ((attacker.Id == CardId.DarkMagician || attacker.Id == CardId.DarkMagicianTheDragonKnight) if (attacker.IsCode(CardId.DarkMagician, CardId.DarkMagicianTheDragonKnight) && Bot.HasInSpellZone(CardId.EternalSoul))
&& Bot.HasInSpellZone(CardId.EternalSoul))
{ {
return true; return true;
} }
if (attacker.Id == CardId.CrystalWingSynchroDragon) if (attacker.IsCode(CardId.CrystalWingSynchroDragon))
{ {
if (defender.Level >= 5) if (defender.Level >= 5)
attacker.RealPower = 9999; attacker.RealPower = 9999;
...@@ -1853,10 +1849,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1853,10 +1849,9 @@ namespace WindBot.Game.AI.Decks
big_attack_used = true; big_attack_used = true;
return true; return true;
} }
if (attacker.Id == CardId.ApprenticeLllusionMagician) if (attacker.IsCode(CardId.ApprenticeLllusionMagician))
Logger.DebugWriteLine("@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= " + attacker.RealPower); Logger.DebugWriteLine("@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= " + attacker.RealPower);
if (Bot.HasInSpellZone(CardId.EternalSoul) && if (Bot.HasInSpellZone(CardId.EternalSoul) && attacker.IsCode(CardId.DarkMagician, CardId.DarkMagicianTheDragonKnight, CardId.MagicianOfLllusion))
(attacker.Id == CardId.DarkMagician || attacker.Id == CardId.DarkMagicianTheDragonKnight || attacker.Id == CardId.MagicianOfLllusion))
return true; return true;
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
} }
...@@ -1872,7 +1867,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1872,7 +1867,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Enemy.MonsterZone[b] != null && if (Enemy.MonsterZone[b] != null &&
SameMonsterColumn(attackerzone, b) && SameMonsterColumn(attackerzone, b) &&
Bot.MonsterZone[attackerzone].Id == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id) Bot.MonsterZone[attackerzone].IsCode(attacker.Id) && Enemy.MonsterZone[b].IsCode(defender.Id))
{ {
defenderzone = b; defenderzone = b;
} }
...@@ -1907,7 +1902,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1907,7 +1902,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b]!=null && if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b]!=null &&
SameMonsterColumn(a,b) && SameMonsterColumn(a,b) &&
Bot.MonsterZone[a].Id==attacker.Id && Enemy.MonsterZone[b].Id == defender.Id) Bot.MonsterZone[a].IsCode(attacker.Id) && Enemy.MonsterZone[b].IsCode(defender.Id))
{ {
attackerzone = a; attackerzone = a;
defenderzone = b; defenderzone = b;
......
...@@ -136,7 +136,7 @@ namespace WindBot.Game.AI.Decks ...@@ -136,7 +136,7 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card.Id == CardId.DragunityDux) if (card.IsCode(CardId.DragunityDux))
++count; ++count;
} }
if (count >= 2) if (count >= 2)
...@@ -164,7 +164,7 @@ namespace WindBot.Game.AI.Decks ...@@ -164,7 +164,7 @@ namespace WindBot.Game.AI.Decks
/*bool hasRealMonster = false; /*bool hasRealMonster = false;
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id != CardId.AssaultBeast) if (!card.IsCode(CardId.AssaultBeast))
{ {
hasRealMonster = true; hasRealMonster = true;
break; break;
...@@ -184,13 +184,13 @@ namespace WindBot.Game.AI.Decks ...@@ -184,13 +184,13 @@ namespace WindBot.Game.AI.Decks
int remaining = 3; int remaining = 3;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
if (card.Id == needId) if (card.IsCode(needId))
remaining--; remaining--;
foreach (ClientCard card in Bot.Graveyard) foreach (ClientCard card in Bot.Graveyard)
if (card.Id == needId) if (card.IsCode(needId))
remaining--; remaining--;
foreach (ClientCard card in Bot.Banished) foreach (ClientCard card in Bot.Banished)
if (card.Id == needId) if (card.IsCode(needId))
remaining--; remaining--;
if (remaining <= 0) if (remaining <= 0)
return false; return false;
...@@ -262,8 +262,7 @@ namespace WindBot.Game.AI.Decks ...@@ -262,8 +262,7 @@ namespace WindBot.Game.AI.Decks
ClientCard card = cards[i]; ClientCard card = cards[i];
if (card.Attack < 2000) if (card.Attack < 2000)
break; break;
if (card.Id == (int) CardId.StardustDragonAssaultMode || if (card.IsCode(CardId.StardustDragonAssaultMode, CardId.FiveHeadedDragon))
card.Id == (int) CardId.FiveHeadedDragon)
continue; continue;
if (card.IsMonster()) if (card.IsMonster())
{ {
...@@ -298,7 +297,7 @@ namespace WindBot.Game.AI.Decks ...@@ -298,7 +297,7 @@ namespace WindBot.Game.AI.Decks
int phalanxCount = 0; int phalanxCount = 0;
foreach (ClientCard card in Bot.Graveyard) foreach (ClientCard card in Bot.Graveyard)
{ {
if (card.Id == (int) CardId.DragunityPhalanx) if (card.IsCode(CardId.DragunityPhalanx))
{ {
phalanxCount++; phalanxCount++;
break; break;
...@@ -315,7 +314,7 @@ namespace WindBot.Game.AI.Decks ...@@ -315,7 +314,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.Graveyard) foreach (ClientCard card in Bot.Graveyard)
{ {
if (card.Id == (int) CardId.DragunityPhalanx) if (card.IsCode(CardId.DragunityPhalanx))
{ {
phalanxCount--; phalanxCount--;
tributes.Add(card); tributes.Add(card);
...@@ -462,7 +461,7 @@ namespace WindBot.Game.AI.Decks ...@@ -462,7 +461,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.StardustDragon && monster.Attacked) if (monster.IsCode(CardId.StardustDragon) && monster.Attacked)
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
......
...@@ -147,7 +147,7 @@ namespace WindBot.Game.AI.Decks ...@@ -147,7 +147,7 @@ namespace WindBot.Game.AI.Decks
if (AI.Utils.IsOneEnemyBetterThanValue(atk, true)) if (AI.Utils.IsOneEnemyBetterThanValue(atk, true))
return false; return false;
if (Card.Id == CardId.SwapFrog) if (Card.IsCode(CardId.SwapFrog))
m_swapFrogSummoned = Duel.Turn; m_swapFrogSummoned = Duel.Turn;
return true; return true;
} }
...@@ -200,7 +200,7 @@ namespace WindBot.Game.AI.Decks ...@@ -200,7 +200,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> spells = Bot.GetSpells(); List<ClientCard> spells = Bot.GetSpells();
foreach (ClientCard spell in spells) foreach (ClientCard spell in spells)
{ {
if (spell.Id == CardId.GravityBind && !spell.IsFacedown()) if (spell.IsCode(CardId.GravityBind) && !spell.IsFacedown())
return false; return false;
} }
return true; return true;
...@@ -208,9 +208,9 @@ namespace WindBot.Game.AI.Decks ...@@ -208,9 +208,9 @@ namespace WindBot.Game.AI.Decks
private bool FrogMonsterRepos() private bool FrogMonsterRepos()
{ {
if (Card.Id == CardId.Unifrog) if (Card.IsCode(CardId.Unifrog))
return Card.IsDefense(); return Card.IsDefense();
if (Card.Id == CardId.DewdarkOfTheIceBarrier) if (Card.IsCode(CardId.DewdarkOfTheIceBarrier))
return Card.IsDefense(); return Card.IsDefense();
bool enemyBetter = AI.Utils.IsOneEnemyBetterThanValue(Card.Attack + (Card.IsFacedown() ? GetSpellBonus() : 0), true); bool enemyBetter = AI.Utils.IsOneEnemyBetterThanValue(Card.Attack + (Card.IsFacedown() ? GetSpellBonus() : 0), true);
...@@ -222,10 +222,10 @@ namespace WindBot.Game.AI.Decks ...@@ -222,10 +222,10 @@ namespace WindBot.Game.AI.Decks
if (Card.IsDefense() && !enemyBetter) if (Card.IsDefense() && !enemyBetter)
result = true; result = true;
if (!result && Card.Id == CardId.FlipFlopFrog && Enemy.GetMonsterCount() > 0 && Card.IsFacedown()) if (!result && Card.IsCode(CardId.FlipFlopFrog) && Enemy.GetMonsterCount() > 0 && Card.IsFacedown())
result = true; result = true;
if (Card.Id == CardId.FlipFlopFrog && Card.IsFacedown() && result) if (Card.IsCode(CardId.FlipFlopFrog) && Card.IsFacedown() && result)
m_flipFlopFrogSummoned = Duel.Turn; m_flipFlopFrogSummoned = Duel.Turn;
return result; return result;
...@@ -242,7 +242,7 @@ namespace WindBot.Game.AI.Decks ...@@ -242,7 +242,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == CardId.Solidarity) if (card.IsCode(CardId.Solidarity))
atk += 800; atk += 800;
} }
} }
......
...@@ -251,21 +251,21 @@ namespace WindBot.Game.AI.Decks ...@@ -251,21 +251,21 @@ namespace WindBot.Game.AI.Decks
private bool DarkBribeeff() private bool DarkBribeeff()
{ {
if (AI.Utils.GetLastChainCard()!=null && AI.Utils.GetLastChainCard().Id == CardId.UpstartGoblin) if (AI.Utils.GetLastChainCard()!=null && AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
return true; return true;
} }
private bool ImperialOrderfirst() private bool ImperialOrderfirst()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.UpstartGoblin) if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
return DefaultOnBecomeTarget() && AI.Utils.GetLastChainCard().HasType(CardType.Spell); return DefaultOnBecomeTarget() && AI.Utils.GetLastChainCard().HasType(CardType.Spell);
} }
private bool ImperialOrdereff() private bool ImperialOrdereff()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.UpstartGoblin) if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
if (Duel.LastChainPlayer == 1) if (Duel.LastChainPlayer == 1)
{ {
...@@ -437,7 +437,7 @@ namespace WindBot.Game.AI.Decks ...@@ -437,7 +437,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (monster.Id ==CardId.MissusRadiant || monster.Id==CardId.LinkSpider || monster.Id==CardId.Linkuriboh) if (monster.IsCode(CardId.MissusRadiant, CardId.LinkSpider, CardId.Linkuriboh))
material_list.Add(monster); material_list.Add(monster);
if (material_list.Count == 3) break; if (material_list.Count == 3) break;
} }
...@@ -454,10 +454,7 @@ namespace WindBot.Game.AI.Decks ...@@ -454,10 +454,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if ((monster.Id == CardId.MissusRadiant || if (monster.IsCode(CardId.MissusRadiant, CardId.LinkSpider, CardId.Linkuriboh))
monster.Id == CardId.LinkSpider ||
monster.Id == CardId.Linkuriboh )&&
monster.Id!=CardId.EaterOfMillions)
material_list.Add(monster); material_list.Add(monster);
if (material_list.Count == 3) break; if (material_list.Count == 3) break;
} }
...@@ -559,7 +556,7 @@ namespace WindBot.Game.AI.Decks ...@@ -559,7 +556,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (monster.HasAttribute(CardAttribute.Earth) && monster.Level==1 && monster.Id!=CardId.EaterOfMillions) if (monster.HasAttribute(CardAttribute.Earth) && monster.Level==1 && !monster.IsCode(CardId.EaterOfMillions))
material_list.Add(monster); material_list.Add(monster);
if (material_list.Count == 2) break; if (material_list.Count == 2) break;
} }
...@@ -587,7 +584,7 @@ namespace WindBot.Game.AI.Decks ...@@ -587,7 +584,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard c in Bot.GetMonsters()) foreach (ClientCard c in Bot.GetMonsters())
{ {
if (c.Id != CardId.EaterOfMillions && c.Id != CardId.Linkuriboh && c.Level==1 ) if (!c.IsCode(CardId.EaterOfMillions, CardId.Linkuriboh) && c.Level==1)
{ {
AI.SelectMaterials(c); AI.SelectMaterials(c);
return true; return true;
...@@ -598,12 +595,12 @@ namespace WindBot.Game.AI.Decks ...@@ -598,12 +595,12 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.EaterOfMillions && Card.IsAttack()) return false; if (Card.IsCode(CardId.EaterOfMillions) && Card.IsAttack()) return false;
return DefaultMonsterRepos(); return DefaultMonsterRepos();
} }
...@@ -612,29 +609,29 @@ namespace WindBot.Game.AI.Decks ...@@ -612,29 +609,29 @@ namespace WindBot.Game.AI.Decks
int count = 0; int count = 0;
foreach(ClientCard check in Bot.Hand) foreach(ClientCard check in Bot.Hand)
{ {
if (check.Id == CardId.CardOfDemise) if (check.IsCode(CardId.CardOfDemise))
count++; count++;
} }
if (count == 2 && Bot.Hand.Count == 2 && Bot.GetSpellCountWithoutField() <= 2) if (count == 2 && Bot.Hand.Count == 2 && Bot.GetSpellCountWithoutField() <= 2)
return true; return true;
if (Card.Id == CardId.MacroCosmos && Bot.HasInSpellZone(CardId.MacroCosmos)) return false; if (Card.IsCode(CardId.MacroCosmos) && Bot.HasInSpellZone(CardId.MacroCosmos)) return false;
if (Card.Id == CardId.AntiSpellFragrance && Bot.HasInSpellZone(CardId.AntiSpellFragrance)) return false; if (Card.IsCode(CardId.AntiSpellFragrance) && Bot.HasInSpellZone(CardId.AntiSpellFragrance)) return false;
if (CardOfDemiseeff_used)return true; if (CardOfDemiseeff_used)return true;
if (Card.Id == CardId.EvenlyMatched && (Enemy.GetFieldCount() - Bot.GetFieldCount()) < 0) return false; if (Card.IsCode(CardId.EvenlyMatched) && (Enemy.GetFieldCount() - Bot.GetFieldCount()) < 0) return false;
if (Card.Id == CardId.AntiSpellFragrance && Bot.HasInSpellZone(CardId.AntiSpellFragrance)) return false; if (Card.IsCode(CardId.AntiSpellFragrance) && Bot.HasInSpellZone(CardId.AntiSpellFragrance)) return false;
if (Card.Id == CardId.MacroCosmos && Bot.HasInSpellZone(CardId.MacroCosmos)) return false; if (Card.IsCode(CardId.MacroCosmos) && Bot.HasInSpellZone(CardId.MacroCosmos)) return false;
if (Duel.Turn > 1 && Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster()) if (Duel.Turn > 1 && Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster())
return false; return false;
if (Card.Id == CardId.InfiniteImpermanence) if (Card.IsCode(CardId.InfiniteImpermanence))
return Bot.GetFieldCount() > 0 && Bot.GetSpellCountWithoutField() < 4; return Bot.GetFieldCount() > 0 && Bot.GetSpellCountWithoutField() < 4;
if (Card.Id == CardId.Scapegoat) if (Card.IsCode(CardId.Scapegoat))
return true; return true;
if (Card.HasType(CardType.Trap)) if (Card.HasType(CardType.Trap))
return Bot.GetSpellCountWithoutField() < 4; return Bot.GetSpellCountWithoutField() < 4;
if(Bot.HasInSpellZone(CardId.AntiSpellFragrance,true)) if(Bot.HasInSpellZone(CardId.AntiSpellFragrance,true))
{ {
if (Card.Id == CardId.UpstartGoblin || Card.Id == CardId.PotOfDesires || Card.Id==CardId.PotOfDuality) return true; if (Card.IsCode(CardId.UpstartGoblin, CardId.PotOfDesires, CardId.PotOfDuality)) return true;
if (Card.Id == CardId.CardOfDemise && Bot.HasInSpellZone(CardId.CardOfDemise)) return false; if (Card.IsCode(CardId.CardOfDemise) && Bot.HasInSpellZone(CardId.CardOfDemise)) return false;
if (Card.HasType(CardType.Spell)) if (Card.HasType(CardType.Spell))
return Bot.GetSpellCountWithoutField() < 4; return Bot.GetSpellCountWithoutField() < 4;
} }
...@@ -642,12 +639,12 @@ namespace WindBot.Game.AI.Decks ...@@ -642,12 +639,12 @@ namespace WindBot.Game.AI.Decks
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (attacker.Id == _CardId.EaterOfMillions && (Bot.HasInMonstersZone(CardId.InspectBoarder) && eater_eff) && !attacker.IsDisabled()) if (attacker.IsCode(_CardId.EaterOfMillions) && (Bot.HasInMonstersZone(CardId.InspectBoarder) && eater_eff) && !attacker.IsDisabled())
{ {
attacker.RealPower = 9999; attacker.RealPower = 9999;
return true; return true;
} }
if (attacker.Id == _CardId.EaterOfMillions && !Bot.HasInMonstersZone(CardId.InspectBoarder) && !attacker.IsDisabled()) if (attacker.IsCode(_CardId.EaterOfMillions) && !Bot.HasInMonstersZone(CardId.InspectBoarder) && !attacker.IsDisabled())
{ {
attacker.RealPower = 9999; attacker.RealPower = 9999;
return true; return true;
...@@ -659,7 +656,7 @@ namespace WindBot.Game.AI.Decks ...@@ -659,7 +656,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.BirrelswordDragon || attacker.Id == CardId.EaterOfMillions) return attacker; if (attacker.IsCode(CardId.BirrelswordDragon, CardId.EaterOfMillions)) return attacker;
} }
return null; return null;
} }
......
...@@ -79,7 +79,7 @@ namespace WindBot.Game.AI.Decks ...@@ -79,7 +79,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
int remaining = 2; int remaining = 2;
foreach (ClientCard card in Bot.Banished) foreach (ClientCard card in Bot.Banished)
if (card.Id == CardId.WhiteNightDragon) if (card.IsCode(CardId.WhiteNightDragon))
remaining--; remaining--;
if (remaining > 0) if (remaining > 0)
{ {
...@@ -154,7 +154,7 @@ namespace WindBot.Game.AI.Decks ...@@ -154,7 +154,7 @@ namespace WindBot.Game.AI.Decks
// We should summon Horus the Black Flame Dragon LV6 if he can lvlup. // We should summon Horus the Black Flame Dragon LV6 if he can lvlup.
if (Enemy.GetMonsterCount() != 0 && !AI.Utils.IsAllEnemyBetterThanValue(2300 - 1, false)) if (Enemy.GetMonsterCount() != 0 && !AI.Utils.IsAllEnemyBetterThanValue(2300 - 1, false))
foreach (ClientCard card in Main.SummonableCards) foreach (ClientCard card in Main.SummonableCards)
if (card.Id == 11224103) if (card.IsCode(11224103))
return false; return false;
return DefaultTributeSummon(); return DefaultTributeSummon();
...@@ -197,7 +197,7 @@ namespace WindBot.Game.AI.Decks ...@@ -197,7 +197,7 @@ namespace WindBot.Game.AI.Decks
ClientCard monster = cards[i]; ClientCard monster = cards[i];
if (monster.Attack < 2300) if (monster.Attack < 2300)
return false; return false;
if (monster.Race == (int)CardRace.Dragon && monster.Id != CardId.HorusTheBlackFlameDragonLv8) if (monster.Race == (int)CardRace.Dragon && !monster.IsCode(CardId.HorusTheBlackFlameDragonLv8))
{ {
summonCard = monster; summonCard = monster;
break; break;
......
...@@ -110,7 +110,7 @@ namespace WindBot.Game.AI.Decks ...@@ -110,7 +110,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> result = new List<ClientCard>(); IList<ClientCard> result = new List<ClientCard>();
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
{ {
if (!result.Contains(card) && (!ClownUsed || card.Id != CardId.PerformageTrickClown)) if (!result.Contains(card) && (!ClownUsed || !card.IsCode(CardId.PerformageTrickClown)))
result.Add(card); result.Add(card);
if (result.Count >= max) if (result.Count >= max)
break; break;
......
...@@ -390,7 +390,7 @@ namespace WindBot.Game.AI.Decks ...@@ -390,7 +390,7 @@ namespace WindBot.Game.AI.Decks
Pillused = true; Pillused = true;
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.UltimateConductorTytanno && card.IsFaceup()) if (card.IsCode(CardId.UltimateConductorTytanno) && card.IsFaceup())
return false; return false;
} }
Ultimate_ss++; Ultimate_ss++;
...@@ -410,12 +410,12 @@ namespace WindBot.Game.AI.Decks ...@@ -410,12 +410,12 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.UltimateConductorTytanno && Card.IsFacedown()) return true; if (Card.IsCode(CardId.UltimateConductorTytanno) && Card.IsFacedown()) return true;
if (Card.Id == CardId.ElShaddollConstruct && Card.IsFacedown()) return true; if (Card.IsCode(CardId.ElShaddollConstruct) && Card.IsFacedown()) return true;
if (Card.Id == CardId.ElShaddollConstruct && Card.IsAttack()) return false; if (Card.IsCode(CardId.ElShaddollConstruct) && Card.IsAttack()) return false;
if (Card.Id == CardId.GlowUpBulb && Card.IsDefense()) return false; if (Card.IsCode(CardId.GlowUpBulb) && Card.IsDefense()) return false;
if (Card.Id == CardId.ShaddollDragon && Card.IsFacedown() && Enemy.GetMonsterCount() >= 0) return true; if (Card.IsCode(CardId.ShaddollDragon) && Card.IsFacedown() && Enemy.GetMonsterCount() >= 0) return true;
if (Card.Id == CardId.ShaddollSquamata && Card.IsFacedown() && Enemy.GetMonsterCount() >= 0) return true; if (Card.IsCode(CardId.ShaddollSquamata) && Card.IsFacedown() && Enemy.GetMonsterCount() >= 0) return true;
return base.DefaultMonsterRepos(); return base.DefaultMonsterRepos();
} }
...@@ -430,7 +430,7 @@ namespace WindBot.Game.AI.Decks ...@@ -430,7 +430,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetMonsters()) foreach (ClientCard card in Bot.GetMonsters())
{ {
if (card.Id == CardId.UltimateConductorTytanno && card.IsFaceup()) if (card.IsCode(CardId.UltimateConductorTytanno) && card.IsFaceup())
return false; return false;
} }
if (Pillused == true) return false; if (Pillused == true) return false;
...@@ -552,7 +552,7 @@ namespace WindBot.Game.AI.Decks ...@@ -552,7 +552,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> all = new List<ClientCard>(); IList<ClientCard> all = new List<ClientCard>();
foreach (ClientCard check in grave) foreach (ClientCard check in grave)
{ {
if (check.Id == CardId.GiantRex) if (check.IsCode(CardId.GiantRex))
{ {
all.Add(check); all.Add(check);
} }
...@@ -1030,8 +1030,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1030,8 +1030,8 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff() public bool Hand_act_eff()
{ {
//if (Card.Id == CardId.Urara && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false; //if (Card.IsCode(CardId.Urara) && Bot.HasInHand(CardId.LockBird) && Bot.HasInSpellZone(CardId.Re)) return false;
if (Card.Id == CardId.GhostOgre && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GhostOgre)) return false; if (Card.IsCode(CardId.GhostOgre) && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GhostOgre)) return false;
return (Duel.LastChainPlayer == 1); return (Duel.LastChainPlayer == 1);
} }
//other extra //other extra
...@@ -1128,14 +1128,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1128,14 +1128,8 @@ namespace WindBot.Game.AI.Decks
}; };
int count=0; int count=0;
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
if (monster.Id == CardId.GlowUpBulb || if (monster.IsCode(CardId.GlowUpBulb, CardId.FairyTailSnow, CardId.KeeperOfDragonicMagic,
monster.Id == CardId.FairyTailSnow || CardId.SouleatingOviraptor, CardId.GiantRex, CardId.Lumina, CardId.Raiden))
monster.Id == CardId.KeeperOfDragonicMagic ||
monster.Id == CardId.SouleatingOviraptor||
monster.Id == CardId.GiantRex||
monster.Id == CardId.Lumina||
monster.Id == CardId.Raiden
)
count++; count++;
if (!Bot.HasInMonstersZone(CardId.GlowUpBulb) || count<2) if (!Bot.HasInMonstersZone(CardId.GlowUpBulb) || count<2)
return false; return false;
...@@ -1150,7 +1144,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1150,7 +1144,7 @@ namespace WindBot.Game.AI.Decks
bool DarkHole = false; bool DarkHole = false;
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card.Id == 53129443 && card.IsFaceup()) if (card.IsCode(53129443) && card.IsFaceup())
{ {
DarkHole = true; DarkHole = true;
} }
...@@ -1222,12 +1216,12 @@ namespace WindBot.Game.AI.Decks ...@@ -1222,12 +1216,12 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard hand in Bot.Hand) foreach (ClientCard hand in Bot.Hand)
{ {
if (hand.Id == CardId.Red || hand.Id == CardId.Pink) if (hand.IsCode(CardId.Red, CardId.Pink))
{ {
AI.SelectCard(hand); AI.SelectCard(hand);
return true; return true;
} }
if (hand.Id == CardId.Urara || hand.Id == CardId.Ghost) if (hand.IsCode(CardId.Urara, CardId.Ghost))
{ {
if (Tuner_ss()) if (Tuner_ss())
{ {
...@@ -1304,9 +1298,9 @@ namespace WindBot.Game.AI.Decks ...@@ -1304,9 +1298,9 @@ namespace WindBot.Game.AI.Decks
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Id == CardId.ElShaddollConstruct && !attacker.IsDisabled()) // TODO: && defender.IsSpecialSummoned if (attacker.IsCode(CardId.ElShaddollConstruct) && !attacker.IsDisabled()) // TODO: && defender.IsSpecialSummoned
attacker.RealPower = 9999; attacker.RealPower = 9999;
if (attacker.Id == CardId.UltimateConductorTytanno && !attacker.IsDisabled() && defender.IsDefense()) if (attacker.IsCode(CardId.UltimateConductorTytanno) && !attacker.IsDisabled() && defender.IsDefense())
attacker.RealPower = 9999; attacker.RealPower = 9999;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
......
...@@ -106,9 +106,9 @@ namespace WindBot.Game.AI.Decks ...@@ -106,9 +106,9 @@ namespace WindBot.Game.AI.Decks
if (!Bot.HasInHand(NekrozRituelCard) || Bot.HasInHand(CardId.Shurit) || !Bot.HasInHand(NekrozSpellCard)) if (!Bot.HasInHand(NekrozRituelCard) || Bot.HasInHand(CardId.Shurit) || !Bot.HasInHand(NekrozSpellCard))
return true; return true;
foreach (ClientCard Card in Bot.Hand) foreach (ClientCard Card in Bot.Hand)
if (Card != null && Card.Id == CardId.Kaleidoscope && !Bot.HasInHand(CardId.Unicore)) if (Card != null && Card.IsCode(CardId.Kaleidoscope) && !Bot.HasInHand(CardId.Unicore))
return true; return true;
else if (Card.Id == CardId.Trishula || Card.Id == CardId.DecisiveArmor && !Bot.HasInHand(CardId.Mirror) || !Bot.HasInHand(CardId.Shurit)) else if (Card.IsCode(CardId.Trishula) || Card.IsCode(CardId.DecisiveArmor) && !Bot.HasInHand(CardId.Mirror) || !Bot.HasInHand(CardId.Shurit))
return true; return true;
return false; return false;
} }
...@@ -271,9 +271,9 @@ namespace WindBot.Game.AI.Decks ...@@ -271,9 +271,9 @@ namespace WindBot.Game.AI.Decks
List<int> NekrozCard = new List<int>(); List<int> NekrozCard = new List<int>();
try try
{ {
foreach (ClientCard Card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
if (Card != null && NekrozRituelCard.Contains((int)Card.Id)) if (card != null && card.IsCode(NekrozRituelCard))
NekrozCard.Add(Card.Id); NekrozCard.Add(card.Id);
foreach (int Id in NekrozCard) foreach (int Id in NekrozCard)
{ {
......
...@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks ...@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks
} }
if (AI.Utils.GetProblematicEnemyCard(9999,true)!=null) if (AI.Utils.GetProblematicEnemyCard(9999,true)!=null)
{ {
if (AI.Utils.GetProblematicEnemyCard(9999, true).Id == CardId.ElShaddollWinda && if (AI.Utils.GetProblematicEnemyCard(9999, true).IsCode(CardId.ElShaddollWinda) &&
!AI.Utils.GetProblematicEnemyCard(9999, true).IsDisabled()) !AI.Utils.GetProblematicEnemyCard(9999, true).IsDisabled())
return false; return false;
AI.SelectCard(AI.Utils.GetProblematicEnemyCard(9999, true)); AI.SelectCard(AI.Utils.GetProblematicEnemyCard(9999, true));
...@@ -349,7 +349,7 @@ namespace WindBot.Game.AI.Decks ...@@ -349,7 +349,7 @@ namespace WindBot.Game.AI.Decks
ClientCard target = null; ClientCard target = null;
foreach(ClientCard s in Bot.GetSpells()) foreach(ClientCard s in Bot.GetSpells())
{ {
if(s.Id==CardId.SeaStealthAttack && Card.IsFaceup()) if(s.IsCode(CardId.SeaStealthAttack) && Card.IsFaceup())
{ {
target = s; target = s;
break; break;
...@@ -388,7 +388,7 @@ namespace WindBot.Game.AI.Decks ...@@ -388,7 +388,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (m.Id == CardId.MissusRadiant) if (m.IsCode(CardId.MissusRadiant))
{ {
material_list.Add(m); material_list.Add(m);
break; break;
...@@ -396,7 +396,7 @@ namespace WindBot.Game.AI.Decks ...@@ -396,7 +396,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
if (m.Id == CardId.Linkuriboh || m.Id == CardId.LinkSpider) if (m.IsCode(CardId.Linkuriboh, CardId.LinkSpider))
{ {
material_list.Add(m); material_list.Add(m);
if (material_list.Count == 3) if (material_list.Count == 3)
...@@ -489,7 +489,7 @@ namespace WindBot.Game.AI.Decks ...@@ -489,7 +489,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> material_list = new List<ClientCard>(); IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (monster.HasAttribute(CardAttribute.Earth) && monster.Level == 1 && monster.Id != CardId.EaterOfMillions) if (monster.HasAttribute(CardAttribute.Earth) && monster.Level == 1 && !monster.IsCode(CardId.EaterOfMillions))
material_list.Add(monster); material_list.Add(monster);
if (material_list.Count == 2) break; if (material_list.Count == 2) break;
} }
...@@ -518,7 +518,7 @@ namespace WindBot.Game.AI.Decks ...@@ -518,7 +518,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard c in Bot.GetMonsters()) foreach (ClientCard c in Bot.GetMonsters())
{ {
if (c.Id != CardId.EaterOfMillions && c.Id != CardId.Linkuriboh && c.Level == 1) if (!c.IsCode(CardId.EaterOfMillions, CardId.Linkuriboh) && c.Level == 1)
{ {
AI.SelectMaterials(c); AI.SelectMaterials(c);
return true; return true;
...@@ -529,7 +529,7 @@ namespace WindBot.Game.AI.Decks ...@@ -529,7 +529,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
private bool SeaStealthAttackeff() private bool SeaStealthAttackeff()
...@@ -548,7 +548,7 @@ namespace WindBot.Game.AI.Decks ...@@ -548,7 +548,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard s in Bot.GetGraveyardSpells()) foreach (ClientCard s in Bot.GetGraveyardSpells())
{ {
if (s.Id == CardId.PacifisThePhantasmCity) if (s.IsCode(CardId.PacifisThePhantasmCity))
{ {
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectCard(s); AI.SelectCard(s);
...@@ -560,7 +560,7 @@ namespace WindBot.Game.AI.Decks ...@@ -560,7 +560,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard s in Bot.Hand) foreach (ClientCard s in Bot.Hand)
{ {
if (s.Id == CardId.PacifisThePhantasmCity) if (s.IsCode(CardId.PacifisThePhantasmCity))
{ {
AI.SelectYesNo(true); AI.SelectYesNo(true);
AI.SelectCard(s); AI.SelectCard(s);
...@@ -579,7 +579,7 @@ namespace WindBot.Game.AI.Decks ...@@ -579,7 +579,7 @@ namespace WindBot.Game.AI.Decks
ClientCard target = null; ClientCard target = null;
foreach(ClientCard s in Bot.GetSpells()) foreach(ClientCard s in Bot.GetSpells())
{ {
if (s.Id == CardId.PacifisThePhantasmCity) if (s.IsCode(CardId.PacifisThePhantasmCity))
target = s; target = s;
} }
if (target != null && AI.Utils.IsChainTarget(target)) if (target != null && AI.Utils.IsChainTarget(target))
...@@ -590,13 +590,13 @@ namespace WindBot.Game.AI.Decks ...@@ -590,13 +590,13 @@ namespace WindBot.Game.AI.Decks
target = AI.Utils.GetLastChainCard(); target = AI.Utils.GetLastChainCard();
if(target!=null) if(target!=null)
{ {
if(target.Id==CardId.BrandishSkillAfterburner) if(target.IsCode(CardId.BrandishSkillAfterburner))
{ {
AI.SelectCard(CardId.MegalosmasherX); AI.SelectCard(CardId.MegalosmasherX);
SeaStealthAttackeff_used = true; SeaStealthAttackeff_used = true;
return true; return true;
} }
if(Enemy.GetGraveyardSpells().Count>=3 && target.Id==CardId.BrandishSkillJammingWave) if(Enemy.GetGraveyardSpells().Count>=3 && target.IsCode(CardId.BrandishSkillJammingWave))
{ {
AI.SelectCard(CardId.MegalosmasherX); AI.SelectCard(CardId.MegalosmasherX);
SeaStealthAttackeff_used = true; SeaStealthAttackeff_used = true;
...@@ -675,7 +675,7 @@ namespace WindBot.Game.AI.Decks ...@@ -675,7 +675,7 @@ namespace WindBot.Game.AI.Decks
int zone_count = 5 - Bot.GetSpellCountWithoutField(); int zone_count = 5 - Bot.GetSpellCountWithoutField();
return zone_count- hand_spell_count >= 1; return zone_count- hand_spell_count >= 1;
} }
if(Card.Id==CardId.PhantasmSprialBattle || Card.Id==CardId.PhantasmSpiralPower) if(Card.IsCode(CardId.PhantasmSprialBattle, CardId.PhantasmSpiralPower))
{ {
if (Bot.HasInMonstersZone(CardId.MegalosmasherX) && if (Bot.HasInMonstersZone(CardId.MegalosmasherX) &&
!Bot.HasInHandOrInSpellZone(CardId.PacifisThePhantasmCity) && !Bot.HasInHandOrInSpellZone(CardId.PacifisThePhantasmCity) &&
...@@ -691,20 +691,20 @@ namespace WindBot.Game.AI.Decks ...@@ -691,20 +691,20 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard s in Bot.GetSpells()) foreach (ClientCard s in Bot.GetSpells())
{ {
if (s.IsFaceup() && s.Id == CardId.SeaStealthAttack && if (s.IsFaceup() && s.IsCode(CardId.SeaStealthAttack) &&
Bot.HasInSpellZone(CardId.PacifisThePhantasmCity) && Bot.HasInSpellZone(CardId.PacifisThePhantasmCity) &&
Card.IsAttack()) Card.IsAttack())
return false; return false;
} }
} }
if (Card.Id == CardId.EaterOfMillions && !Card.IsDisabled() && Card.IsAttack()) if (Card.IsCode(CardId.EaterOfMillions) && !Card.IsDisabled() && Card.IsAttack())
return false; return false;
return DefaultMonsterRepos(); return DefaultMonsterRepos();
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if(attacker.Id==CardId.PacifisThePhantasmCity+1 && defender.Id==CardId.EaterOfMillions) if(attacker.IsCode(CardId.PacifisThePhantasmCity+1) && defender.IsCode(CardId.EaterOfMillions))
{ {
if (attacker.RealPower >= defender.RealPower) return true; if (attacker.RealPower >= defender.RealPower) return true;
} }
...@@ -712,10 +712,10 @@ namespace WindBot.Game.AI.Decks ...@@ -712,10 +712,10 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard s in Bot.GetSpells()) foreach(ClientCard s in Bot.GetSpells())
{ {
if (s.IsFaceup() && s.Id == CardId.SeaStealthAttack && Bot.HasInSpellZone(CardId.PacifisThePhantasmCity)) if (s.IsFaceup() && s.IsCode(CardId.SeaStealthAttack) && Bot.HasInSpellZone(CardId.PacifisThePhantasmCity))
{ {
attacker.RealPower = 9999; attacker.RealPower = 9999;
if (defender.Id == CardId.EaterOfMillions) return true; if (defender.IsCode(CardId.EaterOfMillions)) return true;
} }
} }
...@@ -728,7 +728,7 @@ namespace WindBot.Game.AI.Decks ...@@ -728,7 +728,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.EaterOfMillions) return attacker; if (attacker.IsCode(CardId.EaterOfMillions)) return attacker;
} }
return null; return null;
} }
......
...@@ -141,7 +141,7 @@ namespace WindBot.Game.AI.Decks ...@@ -141,7 +141,7 @@ namespace WindBot.Game.AI.Decks
for (int i = 1; i <= max; ++i) for (int i = 1; i <= max; ++i)
{ {
ClientCard card = cards[cards.Count - i]; ClientCard card = cards[cards.Count - i];
if (card.Id != CardId.Scout || (card.Location == CardLocation.Extra && !Duel.IsNewRule)) if (!card.IsCode(CardId.Scout) || (card.Location == CardLocation.Extra && !Duel.IsNewRule))
selected.Add(card); selected.Add(card);
} }
if (selected.Count == 0) if (selected.Count == 0)
...@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks ...@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks
private bool NormalSummon() private bool NormalSummon()
{ {
if (Card.Id == CardId.Scout) if (Card.IsCode(CardId.Scout))
return false; return false;
if (Card.Level < 8) if (Card.Level < 8)
AI.SelectOption(1); AI.SelectOption(1);
...@@ -196,7 +196,7 @@ namespace WindBot.Game.AI.Decks ...@@ -196,7 +196,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == Card.Id) if (card.IsCode(Card.Id))
return false; return false;
} }
return TrapSetWhenZoneFree(); return TrapSetWhenZoneFree();
......
...@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks ...@@ -162,7 +162,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card2 in cards) foreach (ClientCard card2 in cards)
{ {
if (card1.Id == card2.Id && !card1.Equals(card2)) if (card1.IsCode(card2.Id) && !card1.Equals(card2))
{ {
result.Add(card1); result.Add(card1);
result.Add(card2); result.Add(card2);
......
...@@ -185,15 +185,15 @@ namespace WindBot.Game.AI.Decks ...@@ -185,15 +185,15 @@ namespace WindBot.Game.AI.Decks
int lv5Count = 0; int lv5Count = 0;
foreach (ClientCard card in Bot.Hand) foreach (ClientCard card in Bot.Hand)
{ {
if (card.Id == CardId.SolarWindJammer && Bot.GetMonsterCount() == 0) if (card.IsCode(CardId.SolarWindJammer) && Bot.GetMonsterCount() == 0)
++lv5Count; ++lv5Count;
if (card.Id == CardId.InstantFusion && !InstantFusionUsed) if (card.IsCode(CardId.InstantFusion) && !InstantFusionUsed)
++lv5Count; ++lv5Count;
if (card.Id == CardId.QuickdrawSynchron && Bot.Hand.ContainsMonsterWithLevel(4)) if (card.IsCode(CardId.QuickdrawSynchron) && Bot.Hand.ContainsMonsterWithLevel(4))
++lv5Count; ++lv5Count;
if (card.Id == CardId.MistArchfiend && !NormalSummoned) if (card.IsCode(CardId.MistArchfiend) && !NormalSummoned)
++lv5Count; ++lv5Count;
if (card.Id == CardId.DoubleSummon && DoubleSummonEffect()) if (card.IsCode(CardId.DoubleSummon) && DoubleSummonEffect())
++lv5Count; ++lv5Count;
} }
if (lv5Count >= 2) if (lv5Count >= 2)
...@@ -387,8 +387,8 @@ namespace WindBot.Game.AI.Decks ...@@ -387,8 +387,8 @@ namespace WindBot.Game.AI.Decks
if (monster.HasType(CardType.Monster) && if (monster.HasType(CardType.Monster) &&
!monster.HasType(CardType.Xyz) && !monster.HasType(CardType.Xyz) &&
(monster.Level == 5 (monster.Level == 5
|| monster.Id == CardId.StarDrawing || monster.IsCode(CardId.StarDrawing)
|| (monster.Id == CardId.WindUpSoldier) && !monster.Equals(Card))) || (monster.IsCode(CardId.WindUpSoldier)) && !monster.Equals(Card)))
return true; return true;
} }
return false; return false;
......
...@@ -284,7 +284,7 @@ namespace WindBot.Game.AI.Decks ...@@ -284,7 +284,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.BalancerLord) if (monster.IsCode(CardId.BalancerLord))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
selected = true; selected = true;
...@@ -404,7 +404,7 @@ namespace WindBot.Game.AI.Decks ...@@ -404,7 +404,7 @@ namespace WindBot.Game.AI.Decks
}; };
foreach (ClientCard monster in Bot.Hand) foreach (ClientCard monster in Bot.Hand)
{ {
if (targets.Contains(monster.Id)) if (monster.IsCode(targets))
{ {
AI.SelectCard(targets); AI.SelectCard(targets);
return true; return true;
...@@ -418,7 +418,7 @@ namespace WindBot.Game.AI.Decks ...@@ -418,7 +418,7 @@ namespace WindBot.Game.AI.Decks
}; };
foreach (ClientCard monster in Bot.GetMonsters()) foreach (ClientCard monster in Bot.GetMonsters())
{ {
if (targets2.Contains(monster.Id)) if (monster.IsCode(targets2))
{ {
AI.SelectCard(targets2); AI.SelectCard(targets2);
return true; return true;
......
...@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks ...@@ -152,7 +152,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Id == CardId.HiSpeedroidChanbara && !attacker.IsDisabled()) if (attacker.IsCode(CardId.HiSpeedroidChanbara) && !attacker.IsDisabled())
attacker.RealPower = attacker.RealPower + 200; attacker.RealPower = attacker.RealPower + 200;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
...@@ -399,7 +399,7 @@ namespace WindBot.Game.AI.Decks ...@@ -399,7 +399,7 @@ namespace WindBot.Game.AI.Decks
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
foreach(ClientCard card in Bot.GetGraveyardMonsters()) foreach(ClientCard card in Bot.GetGraveyardMonsters())
{ {
if (card.Id == CardId.Hayate || card.Id == CardId.Kagari || card.Id == CardId.Shizuku) if (card.IsCode(CardId.Hayate, CardId.Kagari, CardId.Shizuku))
targets.Add(card); targets.Add(card);
} }
if (targets.Count > 0) if (targets.Count > 0)
...@@ -451,7 +451,7 @@ namespace WindBot.Game.AI.Decks ...@@ -451,7 +451,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetMonsters()) foreach (ClientCard target in Bot.GetMonsters())
{ {
if (target.Id == CardId.Raye && Bot.GetMonstersExtraZoneCount() == 0) if (target.IsCode(CardId.Raye) && Bot.GetMonstersExtraZoneCount() == 0)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -459,7 +459,7 @@ namespace WindBot.Game.AI.Decks ...@@ -459,7 +459,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetSpells()) foreach (ClientCard target in Bot.GetSpells())
{ {
if (target.Id != CardId.AreaZero && target.Id != CardId.Multirole && target.Id != CardId.WidowAnchor && target.IsSpell()) if (!target.IsCode(CardId.AreaZero, CardId.Multirole, CardId.WidowAnchor) && target.IsSpell())
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -482,7 +482,7 @@ namespace WindBot.Game.AI.Decks ...@@ -482,7 +482,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetMonsters()) foreach (ClientCard target in Bot.GetMonsters())
{ {
if (target.Id == CardId.Raye && Bot.GetMonstersExtraZoneCount() == 0) if (target.IsCode(CardId.Raye) && Bot.GetMonstersExtraZoneCount() == 0)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -490,7 +490,7 @@ namespace WindBot.Game.AI.Decks ...@@ -490,7 +490,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetSpells()) foreach (ClientCard target in Bot.GetSpells())
{ {
if (target.Id == CardId.AreaZero) if (target.IsCode(CardId.AreaZero))
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -498,7 +498,7 @@ namespace WindBot.Game.AI.Decks ...@@ -498,7 +498,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetSpells()) foreach (ClientCard target in Bot.GetSpells())
{ {
if (target.Id != CardId.Multirole && target.Id != CardId.WidowAnchor && target.IsSpell()) if (!target.IsCode(CardId.Multirole, CardId.WidowAnchor) && target.IsSpell())
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
......
...@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks ...@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Id == CardId.SkyCavalryCentaurea && !attacker.IsDisabled() && attacker.HasXyzMaterial()) if (attacker.IsCode(CardId.SkyCavalryCentaurea) && !attacker.IsDisabled() && attacker.HasXyzMaterial())
attacker.RealPower = Bot.LifePoints + attacker.Attack; attacker.RealPower = Bot.LifePoints + attacker.Attack;
} }
return base.OnPreBattleBetween(attacker, defender); return base.OnPreBattleBetween(attacker, defender);
...@@ -315,7 +315,7 @@ namespace WindBot.Game.AI.Decks ...@@ -315,7 +315,7 @@ namespace WindBot.Game.AI.Decks
}; };
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (suitableCost.Contains(monster.Id)) if (monster.IsCode(suitableCost))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
...@@ -325,7 +325,7 @@ namespace WindBot.Game.AI.Decks ...@@ -325,7 +325,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.DupeFrog) if (monster.IsCode(CardId.DupeFrog))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
...@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks ...@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
if (monster.Id == CardId.GraydleSlimeJr) if (monster.IsCode(CardId.GraydleSlimeJr))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
...@@ -348,7 +348,7 @@ namespace WindBot.Game.AI.Decks ...@@ -348,7 +348,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
if (monster.Id == CardId.DupeFrog) if (monster.IsCode(CardId.DupeFrog))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
...@@ -357,7 +357,7 @@ namespace WindBot.Game.AI.Decks ...@@ -357,7 +357,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard monster in hands) foreach (ClientCard monster in hands)
{ {
if (monster.Id == CardId.Ronintoadin || monster.Id == CardId.DupeFrog) if (monster.IsCode(CardId.Ronintoadin, CardId.DupeFrog))
{ {
AI.SelectCard(monster); AI.SelectCard(monster);
return true; return true;
...@@ -442,7 +442,7 @@ namespace WindBot.Game.AI.Decks ...@@ -442,7 +442,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.ToadallyAwesome && monster.Attack <= 2200) if (monster.IsCode(CardId.ToadallyAwesome) && monster.Attack <= 2200)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster); AI.SelectNextCard(monster);
...@@ -451,7 +451,7 @@ namespace WindBot.Game.AI.Decks ...@@ -451,7 +451,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.SkyCavalryCentaurea && monster.Attack <= 2000) if (monster.IsCode(CardId.SkyCavalryCentaurea) && monster.Attack <= 2000)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster); AI.SelectNextCard(monster);
...@@ -460,7 +460,7 @@ namespace WindBot.Game.AI.Decks ...@@ -460,7 +460,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.Id == CardId.DaigustoPhoenix && monster.Attack <= 1500) if (monster.IsCode(CardId.DaigustoPhoenix) && monster.Attack <= 1500)
{ {
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
AI.SelectNextCard(monster); AI.SelectNextCard(monster);
......
...@@ -217,14 +217,14 @@ namespace WindBot.Game.AI.Decks ...@@ -217,14 +217,14 @@ namespace WindBot.Game.AI.Decks
public bool SpellSet() public bool SpellSet()
{ {
if (Card.Id == CardId.Sheep && Bot.HasInSpellZone(CardId.Sheep)) return false; if (Card.IsCode(CardId.Sheep) && Bot.HasInSpellZone(CardId.Sheep)) return false;
if (DefaultSpellSet()) if (DefaultSpellSet())
{ {
AI.SelectPlace(SelectSTPlace()); AI.SelectPlace(SelectSTPlace());
return true; return true;
} else if (Enemy.HasInSpellZone(58921041,true) || Bot.HasInSpellZone(58921041, true)) } else if (Enemy.HasInSpellZone(58921041,true) || Bot.HasInSpellZone(58921041, true))
{ {
if (Card.Id == CardId.Stage) return !Bot.HasInSpellZone(CardId.Stage); if (Card.IsCode(CardId.Stage)) return !Bot.HasInSpellZone(CardId.Stage);
if (Card.IsSpell()) if (Card.IsSpell())
{ {
AI.SelectPlace(SelectSTPlace()); AI.SelectPlace(SelectSTPlace());
...@@ -244,7 +244,7 @@ namespace WindBot.Game.AI.Decks ...@@ -244,7 +244,7 @@ namespace WindBot.Game.AI.Decks
if (Card.HasPosition(CardPosition.FaceDown) && Card.HasType(CardType.Field) && Card.Location == CardLocation.SpellZone) if (Card.HasPosition(CardPosition.FaceDown) && Card.HasType(CardType.Field) && Card.Location == CardLocation.SpellZone)
{ {
// field spells that forbid other fields' activate // field spells that forbid other fields' activate
return (Card.Id != 71650854 && Card.Id != 78082039); return !Card.IsCode(71650854, 78082039);
} }
return false; return false;
} }
...@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks ...@@ -337,7 +337,7 @@ namespace WindBot.Game.AI.Decks
bool has_skystriker = false; bool has_skystriker = false;
foreach (ClientCard card in Enemy.Graveyard) foreach (ClientCard card in Enemy.Graveyard)
{ {
if (card != null && SkyStrike_list.Contains(card.Id)) if (card != null && card.IsCode(SkyStrike_list))
{ {
has_skystriker = true; has_skystriker = true;
break; break;
...@@ -347,7 +347,7 @@ namespace WindBot.Game.AI.Decks ...@@ -347,7 +347,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card != null && SkyStrike_list.Contains(card.Id)) if (card != null && card.IsCode(SkyStrike_list))
{ {
has_skystriker = true; has_skystriker = true;
break; break;
...@@ -358,7 +358,7 @@ namespace WindBot.Game.AI.Decks ...@@ -358,7 +358,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Enemy.GetSpells()) foreach (ClientCard card in Enemy.GetSpells())
{ {
if (card != null && SkyStrike_list.Contains(card.Id)) if (card != null && card.IsCode(SkyStrike_list))
{ {
has_skystriker = true; has_skystriker = true;
break; break;
...@@ -536,7 +536,7 @@ namespace WindBot.Game.AI.Decks ...@@ -536,7 +536,7 @@ namespace WindBot.Game.AI.Decks
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.IsCode(CardId.Galaxy))
return false; return false;
} }
AI.SelectPlace(SelectSTPlace()); AI.SelectPlace(SelectSTPlace());
...@@ -554,7 +554,7 @@ namespace WindBot.Game.AI.Decks ...@@ -554,7 +554,7 @@ namespace WindBot.Game.AI.Decks
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
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 (Duel.LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (AI.Utils.GetLastChainCard().Id == CardId.Feather && !Bot.HasInSpellZone(CardId.Awaken)))) return true; if (Duel.LastChainPlayer == 1 && (AI.Utils.IsChainTarget(Card) || (AI.Utils.GetLastChainCard().IsCode(CardId.Feather) && !Bot.HasInSpellZone(CardId.Awaken)))) 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;
...@@ -704,8 +704,8 @@ namespace WindBot.Game.AI.Decks ...@@ -704,8 +704,8 @@ 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 (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.IsCode(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.IsCode(CardId.Ghost) && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.Ghost)) return false;
return (Duel.LastChainPlayer == 1); return (Duel.LastChainPlayer == 1);
} }
...@@ -772,11 +772,11 @@ namespace WindBot.Game.AI.Decks ...@@ -772,11 +772,11 @@ namespace WindBot.Game.AI.Decks
if (AI.Utils.IsTurn1OrMain2()) return false; if (AI.Utils.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack); AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> targets = new List<ClientCard>(); IList<ClientCard> targets = new List<ClientCard>();
if (Bot.SpellZone[5] != null && Bot.SpellZone[5].Id != CardId.Stage) if (Bot.SpellZone[5] != null && !Bot.SpellZone[5].IsCode(CardId.Stage))
{ {
targets.Add(Bot.SpellZone[5]); targets.Add(Bot.SpellZone[5]);
} }
if (Bot.SpellZone[5] != null && Bot.SpellZone[5].Id == CardId.Stage && Bot.HasInHand(CardId.Stage)) if (Bot.SpellZone[5] != null && Bot.SpellZone[5].IsCode(CardId.Stage) && Bot.HasInHand(CardId.Stage))
{ {
targets.Add(Bot.SpellZone[5]); targets.Add(Bot.SpellZone[5]);
} }
...@@ -835,7 +835,7 @@ namespace WindBot.Game.AI.Decks ...@@ -835,7 +835,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (red_ss_count >= 6) return false; if (red_ss_count >= 6) return false;
if ((AI.Utils.ChainContainsCard(CardId.DarkHole) || AI.Utils.ChainContainsCard(99330325) || AI.Utils.ChainContainsCard(53582587)) && AI.Utils.ChainContainsCard(CardId.Red)) return false; 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) if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Red))
{ {
foreach (ClientCard m in Bot.GetMonsters()) foreach (ClientCard m in Bot.GetMonsters())
{ {
...@@ -858,7 +858,7 @@ namespace WindBot.Game.AI.Decks ...@@ -858,7 +858,7 @@ 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) && c.Id != CardId.Red) if (IsTrickstar(c.Id) && !c.IsCode(CardId.Red))
{ {
if (c.Attacked) if (c.Attacked)
{ {
...@@ -867,7 +867,7 @@ namespace WindBot.Game.AI.Decks ...@@ -867,7 +867,7 @@ namespace WindBot.Game.AI.Decks
red_ss_count += 1; red_ss_count += 1;
return true; return true;
} }
if (c.Id == CardId.Pink) return false; if (c.IsCode(CardId.Pink)) return false;
if (tosolve_enemy != null) if (tosolve_enemy != null)
{ {
if (Bot.HasInHand(CardId.White) && c.Attack + c.BaseAttack < tosolve_enemy.Attack) if (Bot.HasInHand(CardId.White) && c.Attack + c.BaseAttack < tosolve_enemy.Attack)
...@@ -878,7 +878,7 @@ namespace WindBot.Game.AI.Decks ...@@ -878,7 +878,7 @@ namespace WindBot.Game.AI.Decks
red_ss_count += 1; red_ss_count += 1;
return true; return true;
} }
if (!Bot.HasInHand(CardId.White) && tosolve_enemy.Attack <= 3200 && c.Id == CardId.White) if (!Bot.HasInHand(CardId.White) && tosolve_enemy.Attack <= 3200 && c.IsCode(CardId.White))
{ {
AI.SelectCard(c); AI.SelectCard(c);
Red_SelectPos(c); Red_SelectPos(c);
...@@ -916,7 +916,7 @@ namespace WindBot.Game.AI.Decks ...@@ -916,7 +916,7 @@ namespace WindBot.Game.AI.Decks
self_monster.Sort(AIFunctions.CompareDefensePower); self_monster.Sort(AIFunctions.CompareDefensePower);
foreach(ClientCard card in self_monster) foreach(ClientCard card in self_monster)
{ {
if (IsTrickstar(card.Id) && card.Id != CardId.Red) if (IsTrickstar(card.Id) && !card.IsCode(CardId.Red))
{ {
AI.SelectCard(card); AI.SelectCard(card);
Red_SelectPos(card); Red_SelectPos(card);
...@@ -1211,7 +1211,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1211,7 +1211,7 @@ namespace WindBot.Game.AI.Decks
if (hand.IsMonster() && IsTrickstar(hand.Id)) if (hand.IsMonster() && IsTrickstar(hand.Id))
{ {
if (hand.Attack >= Enemy.LifePoints) return true; if (hand.Attack >= Enemy.LifePoints) return true;
if (hand.Id != CardId.Yellow) if (!hand.IsCode(CardId.Yellow))
{ {
if (AI.Utils.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true; if (AI.Utils.GetOneEnemyBetterThanValue(hand.Attack, false) == null) return true;
} }
...@@ -1296,7 +1296,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1296,7 +1296,7 @@ namespace WindBot.Game.AI.Decks
public bool Tuner_ns() public bool Tuner_ns()
{ {
if ((Card.Id == CardId.Tuner && Bot.HasInExtra(CardId.Crystal) && !tuner_eff_used) || Tuner_ss()) if ((Card.IsCode(CardId.Tuner) && Bot.HasInExtra(CardId.Crystal) && !tuner_eff_used) || Tuner_ss())
{ {
NormalSummoned = true; NormalSummoned = true;
return true; return true;
...@@ -1308,17 +1308,17 @@ namespace WindBot.Game.AI.Decks ...@@ -1308,17 +1308,17 @@ namespace WindBot.Game.AI.Decks
{ {
if (crystal_eff_used || Bot.HasInMonstersZone(CardId.Crystal)) 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; if (Card.IsCode(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.IsCode(CardId.Urara)) count += 1;
foreach(ClientCard hand in Bot.Hand) foreach(ClientCard hand in Bot.Hand)
{ {
if (hand.Id == Card.Id) count += 1; if (hand.IsCode(Card.Id)) count += 1;
} }
if (count < 2) return false; if (count < 2) return false;
foreach(ClientCard m in Bot.GetMonsters()) foreach(ClientCard m in Bot.GetMonsters())
{ {
if (m.Id != CardId.Eater && getLinkMarker(m.Id) <= 2) return true; if (!m.IsCode(CardId.Eater) && getLinkMarker(m.Id) <= 2) return true;
} }
return false; return false;
} }
...@@ -1332,7 +1332,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1332,7 +1332,7 @@ namespace WindBot.Game.AI.Decks
public bool Ring_act() public bool Ring_act()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == CardId.Ghost) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(CardId.Ghost)) return false;
if (!spell_trap_activate()) return false; if (!spell_trap_activate()) return false;
ClientCard target = AI.Utils.GetProblematicEnemyMonster(); ClientCard target = AI.Utils.GetProblematicEnemyMonster();
if (target == null && AI.Utils.IsChainTarget(Card)) if (target == null && AI.Utils.IsChainTarget(Card))
...@@ -1352,7 +1352,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1352,7 +1352,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard c in Bot.GetMonsters()) foreach(ClientCard c in Bot.GetMonsters())
{ {
if (c.Id != CardId.Eater && c.Level == 1 && c.Id != CardId.Linkuri && c.Id != CardId.Linkspi) if (!c.IsCode(CardId.Eater, CardId.Linkuri, CardId.Linkspi) && c.Level == 1)
{ {
AI.SelectCard(c); AI.SelectCard(c);
return true; return true;
...@@ -1363,7 +1363,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1363,7 +1363,7 @@ namespace WindBot.Game.AI.Decks
public bool Linkuri_eff() public bool Linkuri_eff()
{ {
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuri) return false; if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().IsCode(CardId.Linkuri)) return false;
AI.SelectCard(new[] { CardId.Tuner, CardId.BF + 1 }); AI.SelectCard(new[] { CardId.Tuner, CardId.BF + 1 });
return true; return true;
} }
...@@ -1387,7 +1387,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1387,7 +1387,7 @@ namespace WindBot.Game.AI.Decks
foreach(ClientCard t_check in Bot.GetMonsters()) foreach(ClientCard t_check in Bot.GetMonsters())
{ {
if (t_check.IsFacedown()) continue; 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.IsCode(CardId.BF, CardId.Tuner, CardId.Urara, CardId.Ghost))
{ {
targets.Add(t_check); targets.Add(t_check);
break; break;
...@@ -1399,7 +1399,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1399,7 +1399,7 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard e_check in m_list) foreach (ClientCard e_check in m_list)
{ {
if (e_check.IsFacedown()) continue; 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.IsCode(CardId.Eater, CardId.Crystal))
{ {
targets.Add(e_check); targets.Add(e_check);
break; break;
...@@ -1483,7 +1483,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1483,7 +1483,7 @@ 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.IsCode(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;
} }
...@@ -1525,7 +1525,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1525,7 +1525,7 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard s_m in main_list) foreach (ClientCard s_m in main_list)
{ {
if (s_m.IsFacedown()) continue; if (s_m.IsFacedown()) continue;
if ((s_m.Id != CardId.Eater || (s_m.Id == CardId.Eater && s_m.IsDisabled())) && !targets.ContainsCardWithId(s_m.Id)) if ((!s_m.IsCode(CardId.Eater) || (s_m.IsCode(CardId.Eater) && s_m.IsDisabled())) && !targets.ContainsCardWithId(s_m.Id))
{ {
targets.Add(s_m); targets.Add(s_m);
}; };
...@@ -1536,7 +1536,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1536,7 +1536,7 @@ namespace WindBot.Game.AI.Decks
foreach (ClientCard s_m in Bot.GetMonstersInExtraZone()) foreach (ClientCard s_m in Bot.GetMonstersInExtraZone())
{ {
if (s_m.IsFacedown()) continue; if (s_m.IsFacedown()) continue;
if (s_m.Id != CardId.Eater && !targets.ContainsCardWithId(s_m.Id)) if (!s_m.IsCode(CardId.Eater) && !targets.ContainsCardWithId(s_m.Id))
{ {
targets.Add(s_m); targets.Add(s_m);
}; };
...@@ -1604,7 +1604,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1604,7 +1604,7 @@ namespace WindBot.Game.AI.Decks
sort_list.Sort(AIFunctions.CompareCardAttack); sort_list.Sort(AIFunctions.CompareCardAttack);
foreach (ClientCard s_m in sort_list) foreach (ClientCard s_m in sort_list)
{ {
if ((s_m.Id != CardId.Eater || (s_m.Id == CardId.Eater && m.IsMonsterHasPreventActivationEffectInBattle())) && getLinkMarker(s_m.Id) <= 2 && s_m.IsFaceup()) if ((!s_m.IsCode(CardId.Eater) || (s_m.IsCode(CardId.Eater) && m.IsMonsterHasPreventActivationEffectInBattle())) && getLinkMarker(s_m.Id) <= 2 && s_m.IsFaceup())
{ {
if (!targets.ContainsCardWithId(s_m.Id)) if (!targets.ContainsCardWithId(s_m.Id))
{ {
...@@ -1693,12 +1693,12 @@ namespace WindBot.Game.AI.Decks ...@@ -1693,12 +1693,12 @@ namespace WindBot.Game.AI.Decks
{ {
foreach(ClientCard hand in Bot.Hand) foreach(ClientCard hand in Bot.Hand)
{ {
if (hand.Id == CardId.Red || hand.Id == CardId.Pink) if (hand.IsCode(CardId.Red, CardId.Pink))
{ {
AI.SelectCard(hand); AI.SelectCard(hand);
return true; return true;
} }
if (hand.Id == CardId.Urara || hand.Id == CardId.Ghost) if (hand.IsCode(CardId.Urara, CardId.Ghost))
{ {
if (Tuner_ss()) if (Tuner_ss())
{ {
...@@ -1770,7 +1770,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1770,7 +1770,7 @@ namespace WindBot.Game.AI.Decks
{ {
already_link2 = true; already_link2 = true;
material_list.Add(m); material_list.Add(m);
} else if (m.Id != CardId.Sheep + 1 && (m.Id != CardId.Eater)) } else if (!m.IsCode(CardId.Sheep + 1, CardId.Eater))
{ {
material_list.Add(m); material_list.Add(m);
} }
...@@ -1876,14 +1876,14 @@ namespace WindBot.Game.AI.Decks ...@@ -1876,14 +1876,14 @@ namespace WindBot.Game.AI.Decks
public bool MonsterRepos() public bool MonsterRepos()
{ {
if (Card.Id == CardId.Eater) return (!Card.HasPosition(CardPosition.Attack)); if (Card.IsCode(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;
if (Card.Id == CardId.Pink) if (Card.IsCode(CardId.Pink))
{ {
if ((Bot.HasInSpellZone(CardId.Stage, true) && Enemy.LifePoints <= 1000) || (!Bot.HasInSpellZone(CardId.Stage, true) && Enemy.LifePoints <= 800)) if ((Bot.HasInSpellZone(CardId.Stage, true) && Enemy.LifePoints <= 1000) || (!Bot.HasInSpellZone(CardId.Stage, true) && Enemy.LifePoints <= 800))
{ {
...@@ -1944,8 +1944,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1944,8 +1944,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)) || attacker.Id == CardId.Borrel) return AI.Attack(attacker, defender); if ((attacker.IsCode(CardId.Eater) && !defender.HasType(CardType.Token)) || attacker.IsCode(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 ((attacker.IsCode(CardId.Ultimate, CardId.Cardian)) && attacker.RealPower > defender.RealPower) return AI.Attack(attacker, defender);
} }
if (!OnPreBattleBetween(attacker, defender)) if (!OnPreBattleBetween(attacker, defender))
...@@ -1966,7 +1966,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1966,7 +1966,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.IsCode(CardId.Borrel, CardId.Eater)) return attacker;
} }
return null; return null;
} }
......
...@@ -163,7 +163,7 @@ namespace WindBot.Game.AI.Decks ...@@ -163,7 +163,7 @@ namespace WindBot.Game.AI.Decks
if (Card == null) if (Card == null)
return true; return true;
// Logger.DebugWriteLine(Card.Name); // Logger.DebugWriteLine(Card.Name);
if (Card.Id == CardId.YosenjuKama2) if (Card.IsCode(CardId.YosenjuKama2))
return Card.ShouldDirectAttack; return Card.ShouldDirectAttack;
else else
return true; return true;
...@@ -241,7 +241,7 @@ namespace WindBot.Game.AI.Decks ...@@ -241,7 +241,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.Hand.GetMonsters()) foreach (ClientCard card in Bot.Hand.GetMonsters())
{ {
if (!card.Equals(Card) && card.Id == Card.Id) if (!card.Equals(Card) && card.IsCode(Card.Id))
return true; return true;
} }
return false; return false;
...@@ -251,7 +251,7 @@ namespace WindBot.Game.AI.Decks ...@@ -251,7 +251,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
if (card.Id == Card.Id) if (card.IsCode(Card.Id))
return false; return false;
} }
return TrapSetWhenZoneFree(); return TrapSetWhenZoneFree();
......
...@@ -238,7 +238,7 @@ namespace WindBot.Game.AI.Decks ...@@ -238,7 +238,7 @@ namespace WindBot.Game.AI.Decks
{ {
var lastChainCard = AI.Utils.GetLastChainCard(); var lastChainCard = AI.Utils.GetLastChainCard();
if (lastChainCard == null) return true; if (lastChainCard == null) return true;
return lastChainCard.Id != CardId.Goblindbergh && lastChainCard.Id != CardId.TinGoldfish; return !lastChainCard.IsCode(CardId.Goblindbergh, CardId.TinGoldfish);
} }
private bool SummonerMonkEffect() private bool SummonerMonkEffect()
...@@ -279,7 +279,7 @@ namespace WindBot.Game.AI.Decks ...@@ -279,7 +279,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.NumberS39UtopiatheLightning && Card.IsAttack()) if (Card.IsCode(CardId.NumberS39UtopiatheLightning) && Card.IsAttack())
return false; return false;
return base.DefaultMonsterRepos(); return base.DefaultMonsterRepos();
} }
......
...@@ -230,14 +230,14 @@ namespace WindBot.Game.AI.Decks ...@@ -230,14 +230,14 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard card in Enemy.Graveyard) foreach (ClientCard card in Enemy.Graveyard)
{ {
if (card.Id == CardId.AleisterTheInvoker) if (card.IsCode(CardId.AleisterTheInvoker))
{ {
return card; return card;
} }
} }
foreach (ClientCard card in Bot.Graveyard) foreach (ClientCard card in Bot.Graveyard)
{ {
if (card.Id == CardId.AleisterTheInvoker) if (card.IsCode(CardId.AleisterTheInvoker))
{ {
return card; return card;
} }
...@@ -445,7 +445,7 @@ namespace WindBot.Game.AI.Decks ...@@ -445,7 +445,7 @@ namespace WindBot.Game.AI.Decks
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.IsFaceup() && monster.Id == CardId.Drident && !monster.HasXyzMaterial()) if (monster.IsFaceup() && monster.IsCode(CardId.Drident) && !monster.HasXyzMaterial())
{ {
target = monster; target = monster;
break; break;
...@@ -455,7 +455,7 @@ namespace WindBot.Game.AI.Decks ...@@ -455,7 +455,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
{ {
if (monster.IsFaceup() && monster.Type == (int)CardType.Xyz && monster.Id != CardId.DaigustoEmeral && !monster.HasXyzMaterial()) if (monster.IsFaceup() && monster.Type == (int)CardType.Xyz && !monster.IsCode(CardId.DaigustoEmeral) && !monster.HasXyzMaterial())
{ {
target = monster; target = monster;
break; break;
...@@ -550,7 +550,7 @@ namespace WindBot.Game.AI.Decks ...@@ -550,7 +550,7 @@ namespace WindBot.Game.AI.Decks
{ {
foreach (ClientCard spell in Bot.GetSpells()) foreach (ClientCard spell in Bot.GetSpells())
{ {
if (spell.Id == CardId.ZoodiacBarrage && !Card.Equals(spell)) if (spell.IsCode(CardId.ZoodiacBarrage) && !Card.Equals(spell))
return false; return false;
} }
AI.SelectCard(new[] AI.SelectCard(new[]
...@@ -604,7 +604,7 @@ namespace WindBot.Game.AI.Decks ...@@ -604,7 +604,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.NumberS39UtopiatheLightning && Card.IsAttack()) if (Card.IsCode(CardId.NumberS39UtopiatheLightning) && Card.IsAttack())
return false; return false;
return base.DefaultMonsterRepos(); return base.DefaultMonsterRepos();
} }
......
...@@ -129,16 +129,16 @@ namespace WindBot.Game.AI ...@@ -129,16 +129,16 @@ namespace WindBot.Game.AI
if (defender.IsMonsterDangerous()) if (defender.IsMonsterDangerous())
{ {
bool canIgnoreIt = !attacker.IsDisabled() && ( bool canIgnoreIt = !attacker.IsDisabled() && (
attacker.Id == _CardId.UltimateConductorTytanno && defender.IsDefense() || attacker.IsCode(_CardId.UltimateConductorTytanno) && defender.IsDefense() ||
attacker.Id == _CardId.ElShaddollConstruct && defender.IsSpecialSummoned || attacker.IsCode(_CardId.ElShaddollConstruct) && defender.IsSpecialSummoned ||
attacker.Id == _CardId.AllyOfJusticeCatastor && !defender.HasAttribute(CardAttribute.Dark)); attacker.IsCode(_CardId.AllyOfJusticeCatastor) && !defender.HasAttribute(CardAttribute.Dark));
if (!canIgnoreIt) if (!canIgnoreIt)
return false; return false;
} }
foreach (ClientCard equip in defender.EquipCards) foreach (ClientCard equip in defender.EquipCards)
{ {
if (equip.Id == _CardId.MoonMirrorShield && !equip.IsDisabled()) if (equip.IsCode(_CardId.MoonMirrorShield) && !equip.IsDisabled())
{ {
return false; return false;
} }
...@@ -146,44 +146,44 @@ namespace WindBot.Game.AI ...@@ -146,44 +146,44 @@ namespace WindBot.Game.AI
if (!defender.IsDisabled()) if (!defender.IsDisabled())
{ {
if (defender.Id == _CardId.CrystalWingSynchroDragon && defender.IsAttack() && attacker.Level >= 5) if (defender.IsCode(_CardId.CrystalWingSynchroDragon) && defender.IsAttack() && attacker.Level >= 5)
return false; return false;
if (defender.Id == _CardId.AllyOfJusticeCatastor && !attacker.HasAttribute(CardAttribute.Dark)) if (defender.IsCode(_CardId.AllyOfJusticeCatastor) && !attacker.HasAttribute(CardAttribute.Dark))
return false; return false;
if (defender.Id == _CardId.NumberS39UtopiaTheLightning && defender.IsAttack() && defender.HasXyzMaterial(2, _CardId.Number39Utopia)) if (defender.IsCode(_CardId.NumberS39UtopiaTheLightning) && defender.IsAttack() && defender.HasXyzMaterial(2, _CardId.Number39Utopia))
defender.RealPower = 5000; defender.RealPower = 5000;
if (defender.Id == _CardId.VampireFraeulein) if (defender.IsCode(_CardId.VampireFraeulein))
defender.RealPower += (Enemy.LifePoints > 3000) ? 3000 : (Enemy.LifePoints - 100); defender.RealPower += (Enemy.LifePoints > 3000) ? 3000 : (Enemy.LifePoints - 100);
if (defender.Id == _CardId.InjectionFairyLily && Enemy.LifePoints > 2000) if (defender.IsCode(_CardId.InjectionFairyLily) && Enemy.LifePoints > 2000)
defender.RealPower += 3000; defender.RealPower += 3000;
} }
} }
if (!defender.IsMonsterHasPreventActivationEffectInBattle()) if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{ {
if (attacker.Id == _CardId.NumberS39UtopiaTheLightning && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, _CardId.Number39Utopia)) if (attacker.IsCode(_CardId.NumberS39UtopiaTheLightning) && !attacker.IsDisabled() && attacker.HasXyzMaterial(2, _CardId.Number39Utopia))
attacker.RealPower = 5000; attacker.RealPower = 5000;
foreach (ClientCard equip in attacker.EquipCards) foreach (ClientCard equip in attacker.EquipCards)
{ {
if (equip.Id == _CardId.MoonMirrorShield && !equip.IsDisabled()) if (equip.IsCode(_CardId.MoonMirrorShield) && !equip.IsDisabled())
{ {
attacker.RealPower = defender.RealPower + 100; attacker.RealPower = defender.RealPower + 100;
} }
} }
} }
if (Enemy.HasInMonstersZone(_CardId.DupeFrog, true) && defender.Id != _CardId.DupeFrog) if (Enemy.HasInMonstersZone(_CardId.DupeFrog, true) && !(defender).IsCode(_CardId.DupeFrog))
return false; return false;
if (Enemy.HasInMonstersZone(_CardId.MaraudingCaptain, true) && defender.Id != _CardId.MaraudingCaptain && defender.Race == (int)CardRace.Warrior) if (Enemy.HasInMonstersZone(_CardId.MaraudingCaptain, true) && !defender.IsCode(_CardId.MaraudingCaptain) && defender.Race == (int)CardRace.Warrior)
return false; return false;
if (defender.Id == _CardId.UltimayaTzolkin && !defender.IsDisabled() && Enemy.GetMonsters().Any(monster => !monster.Equals(defender) && monster.HasType(CardType.Synchro))) if (defender.IsCode(_CardId.UltimayaTzolkin) && !defender.IsDisabled() && Enemy.GetMonsters().Any(monster => !monster.Equals(defender) && monster.HasType(CardType.Synchro)))
return false; return false;
return true; return true;
...@@ -231,7 +231,7 @@ namespace WindBot.Game.AI ...@@ -231,7 +231,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultMysticalSpaceTyphoon() protected bool DefaultMysticalSpaceTyphoon()
{ {
if (Duel.CurrentChain.Any(card => card.Id == _CardId.MysticalSpaceTyphoon)) if (Duel.CurrentChain.Any(card => card.IsCode(_CardId.MysticalSpaceTyphoon)))
{ {
return false; return false;
} }
...@@ -262,7 +262,7 @@ namespace WindBot.Game.AI ...@@ -262,7 +262,7 @@ namespace WindBot.Game.AI
protected bool DefaultCosmicCyclone() protected bool DefaultCosmicCyclone()
{ {
foreach (ClientCard card in Duel.CurrentChain) foreach (ClientCard card in Duel.CurrentChain)
if (card.Id == _CardId.CosmicCyclone) if (card.IsCode(_CardId.CosmicCyclone))
return false; return false;
return (Bot.LifePoints > 1000) && DefaultMysticalSpaceTyphoon(); return (Bot.LifePoints > 1000) && DefaultMysticalSpaceTyphoon();
} }
...@@ -386,7 +386,7 @@ namespace WindBot.Game.AI ...@@ -386,7 +386,7 @@ namespace WindBot.Game.AI
_CardId.UpstartGoblin, _CardId.UpstartGoblin,
_CardId.CyberEmergency _CardId.CyberEmergency
}; };
if (ignoreList.Contains(AI.Utils.GetLastChainCard().Id)) if (AI.Utils.GetLastChainCard().IsCode(ignoreList))
return false; return false;
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
...@@ -411,7 +411,7 @@ namespace WindBot.Game.AI ...@@ -411,7 +411,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultEffectVeiler() protected bool DefaultEffectVeiler()
{ {
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == _CardId.GalaxySoldier && Enemy.Hand.Count >= 3) return false; if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsCode(_CardId.GalaxySoldier) && Enemy.Hand.Count >= 3) return false;
if (AI.Utils.ChainContainsCard(_CardId.EffectVeiler)) if (AI.Utils.ChainContainsCard(_CardId.EffectVeiler))
return false; return false;
return DefaultBreakthroughSkill(); return DefaultBreakthroughSkill();
...@@ -433,7 +433,7 @@ namespace WindBot.Game.AI ...@@ -433,7 +433,7 @@ namespace WindBot.Game.AI
{ {
foreach (int id in targetList) foreach (int id in targetList)
{ {
if (AI.Utils.GetLastChainCard().Id == id) if (AI.Utils.GetLastChainCard().IsCode(id))
{ {
AI.SelectCard(id); AI.SelectCard(id);
return UniqueFaceupSpell(); return UniqueFaceupSpell();
...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI ...@@ -479,7 +479,7 @@ namespace WindBot.Game.AI
if (Bot.BattlingMonster != null && Enemy.BattlingMonster != null) if (Bot.BattlingMonster != null && Enemy.BattlingMonster != null)
{ {
if (!Enemy.BattlingMonster.IsDisabled() && Enemy.BattlingMonster.Id == _CardId.EaterOfMillions) if (!Enemy.BattlingMonster.IsDisabled() && Enemy.BattlingMonster.IsCode(_CardId.EaterOfMillions))
{ {
AI.SelectCard(Enemy.BattlingMonster); AI.SelectCard(Enemy.BattlingMonster);
return true; return true;
...@@ -659,7 +659,7 @@ namespace WindBot.Game.AI ...@@ -659,7 +659,7 @@ namespace WindBot.Game.AI
ClientCard card = null; ClientCard card = null;
foreach (ClientCard check in Bot.GetSpells()) foreach (ClientCard check in Bot.GetSpells())
{ {
if (check.Id == _CardId.AntiSpellFragrance && !check.IsDisabled()) if (check.IsCode(_CardId.AntiSpellFragrance) && !check.IsDisabled())
card = check; card = check;
} }
if (card != null && card.IsFaceup()) if (card != null && card.IsFaceup())
...@@ -715,7 +715,7 @@ namespace WindBot.Game.AI ...@@ -715,7 +715,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool UniqueFaceupSpell() protected bool UniqueFaceupSpell()
{ {
return !Bot.GetSpells().Any(card => card.Id == Card.Id && card.IsFaceup()); return !Bot.GetSpells().Any(card => card.IsCode(Card.Id) && card.IsFaceup());
} }
/// <summary> /// <summary>
...@@ -723,7 +723,7 @@ namespace WindBot.Game.AI ...@@ -723,7 +723,7 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool UniqueFaceupMonster() protected bool UniqueFaceupMonster()
{ {
return !Bot.GetMonsters().Any(card => card.Id == Card.Id && card.IsFaceup()); return !Bot.GetMonsters().Any(card => card.IsCode(Card.Id) && card.IsFaceup());
} }
/// <summary> /// <summary>
...@@ -917,7 +917,7 @@ namespace WindBot.Game.AI ...@@ -917,7 +917,7 @@ namespace WindBot.Game.AI
}; };
foreach (ClientCard monster in Enemy.GetMonsters()) foreach (ClientCard monster in Enemy.GetMonsters())
{ {
if (kaijus.Contains(monster.Id)) if (monster.IsCode(kaijus))
return Card.GetDefensePower() > monster.GetDefensePower(); return Card.GetDefensePower() > monster.GetDefensePower();
} }
ClientCard card = Enemy.MonsterZone.GetFloodgate(); ClientCard card = Enemy.MonsterZone.GetFloodgate();
......
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using YGOSharp.OCGWrapper; using YGOSharp.OCGWrapper;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
...@@ -72,7 +73,11 @@ namespace WindBot.Game ...@@ -72,7 +73,11 @@ namespace WindBot.Game
Id = id; Id = id;
Data = NamedCard.Get(Id); Data = NamedCard.Get(Id);
if (Data != null) if (Data != null)
{
Name = Data.Name; Name = Data.Name;
if (Data.Alias != 0)
Alias = Data.Alias;
}
} }
public void Update(BinaryReader packet, Duel duel) public void Update(BinaryReader packet, Duel duel)
...@@ -274,6 +279,21 @@ namespace WindBot.Game ...@@ -274,6 +279,21 @@ namespace WindBot.Game
return Disabled != 0; return Disabled != 0;
} }
public bool IsCode(int id)
{
return Id == id || Alias != 0 && Alias == id;
}
public bool IsCode(IList<int> ids)
{
return ids.Contains(Id) || Alias != 0 && ids.Contains(Alias);
}
public bool IsCode(params int[] ids)
{
return ids.Contains(Id) || Alias != 0 && ids.Contains(Alias);
}
public bool HasXyzMaterial() public bool HasXyzMaterial()
{ {
return Overlays.Count > 0; return Overlays.Count > 0;
......
...@@ -300,10 +300,10 @@ namespace WindBot.Game ...@@ -300,10 +300,10 @@ namespace WindBot.Game
public int GetRemainingCount(int cardId, int initialCount) public int GetRemainingCount(int cardId, int initialCount)
{ {
int remaining = initialCount; int remaining = initialCount;
remaining = remaining - Hand.Count(card => card != null && card.Id == cardId); remaining = remaining - Hand.Count(card => card != null && card.IsCode(cardId));
remaining = remaining - SpellZone.Count(card => card != null && card.Id == cardId); remaining = remaining - SpellZone.Count(card => card != null && card.IsCode(cardId));
remaining = remaining - Graveyard.Count(card => card != null && card.Id == cardId); remaining = remaining - Graveyard.Count(card => card != null && card.IsCode(cardId));
remaining = remaining - Banished.Count(card => card != null && card.Id == cardId); remaining = remaining - Banished.Count(card => card != null && card.IsCode(cardId));
return (remaining < 0) ? 0 : remaining; return (remaining < 0) ? 0 : remaining;
} }
...@@ -314,12 +314,12 @@ namespace WindBot.Game ...@@ -314,12 +314,12 @@ namespace WindBot.Game
public int GetCountCardInZone(IEnumerable<ClientCard> cards, int cardId) public int GetCountCardInZone(IEnumerable<ClientCard> cards, int cardId)
{ {
return cards.Count(card => card != null && card.Id == cardId); return cards.Count(card => card != null && card.IsCode(cardId));
} }
public int GetCountCardInZone(IEnumerable<ClientCard> cards, List<int> cardId) public int GetCountCardInZone(IEnumerable<ClientCard> cards, List<int> cardId)
{ {
return cards.Count(card => card != null && cardId.Contains(card.Id)); return cards.Count(card => card != null && card.IsCode(cardId));
} }
private static List<ClientCard> GetCards(IEnumerable<ClientCard> cards, CardType type) private static List<ClientCard> GetCards(IEnumerable<ClientCard> cards, CardType type)
...@@ -334,12 +334,12 @@ namespace WindBot.Game ...@@ -334,12 +334,12 @@ namespace WindBot.Game
private static bool HasInCards(IEnumerable<ClientCard> cards, int cardId, bool notDisabled = false, bool hasXyzMaterial = false, bool faceUp = false) private static bool HasInCards(IEnumerable<ClientCard> cards, int cardId, bool notDisabled = false, bool hasXyzMaterial = false, bool faceUp = false)
{ {
return cards.Any(card => card != null && card.Id == cardId && !(notDisabled && card.IsDisabled()) && !(hasXyzMaterial && !card.HasXyzMaterial()) && !(faceUp && card.IsFacedown())); return cards.Any(card => card != null && card.IsCode(cardId) && !(notDisabled && card.IsDisabled()) && !(hasXyzMaterial && !card.HasXyzMaterial()) && !(faceUp && card.IsFacedown()));
} }
private static bool HasInCards(IEnumerable<ClientCard> cards, IList<int> cardId, bool notDisabled = false, bool hasXyzMaterial = false, bool faceUp = false) private static bool HasInCards(IEnumerable<ClientCard> cards, IList<int> cardId, bool notDisabled = false, bool hasXyzMaterial = false, bool faceUp = false)
{ {
return cards.Any(card => card != null && cardId.Contains(card.Id) && !(notDisabled && card.IsDisabled()) && !(hasXyzMaterial && !card.HasXyzMaterial()) && !(faceUp && card.IsFacedown())); return cards.Any(card => card != null && card.IsCode(cardId) && !(notDisabled && card.IsDisabled()) && !(hasXyzMaterial && !card.HasXyzMaterial()) && !(faceUp && card.IsFacedown()));
} }
} }
} }
\ No newline at end of file
...@@ -1086,7 +1086,8 @@ namespace WindBot.Game ...@@ -1086,7 +1086,8 @@ namespace WindBot.Game
return; return;
} }
if (card.Id == 0) card.SetId(cardId); if (card.Id == 0)
card.SetId(cardId);
int reply = _ai.OnSelectEffectYn(card, desc) ? (1) : (0); int reply = _ai.OnSelectEffectYn(card, desc) ? (1) : (0);
Connection.Send(CtosMessage.Response, reply); Connection.Send(CtosMessage.Response, reply);
......
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