Commit 96490bd2 authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/IceYGO/windbot

parents 94cd3eb0 2d329511
...@@ -221,8 +221,7 @@ namespace WindBot.Game.AI.Decks ...@@ -221,8 +221,7 @@ namespace WindBot.Game.AI.Decks
public bool isAltergeist(ClientCard card) public bool isAltergeist(ClientCard card)
{ {
return card.IsCode(CardId.Marionetter, CardId.Hexstia, CardId.Protocol, CardId.Multifaker, CardId.Meluseek, return card != null && card.HasSetcode(0x103);
CardId.Kunquery, CardId.Manifestation, CardId.Silquitous);
} }
public int GetSequence(ClientCard card) public int GetSequence(ClientCard card)
...@@ -391,6 +390,7 @@ namespace WindBot.Game.AI.Decks ...@@ -391,6 +390,7 @@ namespace WindBot.Game.AI.Decks
public bool spell_trap_activate(bool isCounter = false, ClientCard target = null) public bool spell_trap_activate(bool isCounter = false, ClientCard target = null)
{ {
if (target == null) target = Card; if (target == null) target = Card;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (target.Location != CardLocation.SpellZone && target.Location != CardLocation.Hand) return true; if (target.Location != CardLocation.SpellZone && target.Location != CardLocation.Hand) return true;
if (Enemy.HasInMonstersZone(CardId.NaturalExterio, true) && !Bot.HasInHandOrHasInMonstersZone(CardId.GO_SR) && !isCounter && !Bot.HasInSpellZone(CardId.SolemnStrike)) return false; if (Enemy.HasInMonstersZone(CardId.NaturalExterio, true) && !Bot.HasInHandOrHasInMonstersZone(CardId.GO_SR) && !isCounter && !Bot.HasInSpellZone(CardId.SolemnStrike)) return false;
if (target.IsSpell()) if (target.IsSpell())
...@@ -664,7 +664,7 @@ namespace WindBot.Game.AI.Decks ...@@ -664,7 +664,7 @@ namespace WindBot.Game.AI.Decks
public bool G_activate() public bool G_activate()
{ {
return (Duel.Player == 1); return (Duel.Player == 1) && !DefaultCheckWhetherCardIsNegated(Card);
} }
public bool NaturalExterio_eff() public bool NaturalExterio_eff()
...@@ -821,6 +821,7 @@ namespace WindBot.Game.AI.Decks ...@@ -821,6 +821,7 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff() public bool Hand_act_eff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.IsCode(CardId.AB_JS) && Util.GetLastChainCard().HasSetcode(0x11e) && Util.GetLastChainCard().Location == CardLocation.Hand) // Danger! archtype hand effect if (Card.IsCode(CardId.AB_JS) && Util.GetLastChainCard().HasSetcode(0x11e) && Util.GetLastChainCard().Location == CardLocation.Hand) // Danger! archtype hand effect
return false; return false;
if (Card.IsCode(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;
...@@ -901,6 +902,7 @@ namespace WindBot.Game.AI.Decks ...@@ -901,6 +902,7 @@ namespace WindBot.Game.AI.Decks
public bool GR_WC_activate() public bool GR_WC_activate()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int warrior_count = 0; int warrior_count = 0;
int pendulum_count = 0; int pendulum_count = 0;
int link_count = 0; int link_count = 0;
...@@ -1263,7 +1265,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1263,7 +1265,7 @@ namespace WindBot.Game.AI.Decks
if (linked_card != null && linked_card.IsCode(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])) return false;
} }
} }
return true; return true;
...@@ -1690,7 +1692,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1690,7 +1692,7 @@ namespace WindBot.Game.AI.Decks
if (target.IsCode(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])) continue;
} }
if (!get_linked_by_Hexstia(i)) if (!get_linked_by_Hexstia(i))
{ {
...@@ -2669,6 +2671,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2669,6 +2671,7 @@ namespace WindBot.Game.AI.Decks
ss_other_monster = false; ss_other_monster = false;
Impermanence_list.Clear(); Impermanence_list.Clear();
attacked_Meluseek.Clear(); attacked_Meluseek.Clear();
base.OnNewTurn();
} }
public override void OnChaining(int player, ClientCard card) public override void OnChaining(int player, ClientCard card)
...@@ -2890,16 +2893,16 @@ namespace WindBot.Game.AI.Decks ...@@ -2890,16 +2893,16 @@ namespace WindBot.Game.AI.Decks
if (cardId == CardId.Hexstia) if (cardId == CardId.Hexstia)
{ {
// ex zone // ex zone
if ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && isAltergeist(Bot.MonsterZone[1].Id)) return Zones.z5; if ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && isAltergeist(Bot.MonsterZone[1])) return Zones.z5;
if ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && isAltergeist(Bot.MonsterZone[3].Id)) return Zones.z6; if ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && isAltergeist(Bot.MonsterZone[3])) return Zones.z6;
if ( ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && !isAltergeist(Bot.MonsterZone[3].Id)) if ( ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] != null && !isAltergeist(Bot.MonsterZone[3]))
|| ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] == null) ) return Zones.z5; || ((Zones.z5 & available) > 0 && Bot.MonsterZone[1] == null) ) return Zones.z5;
if (((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && !isAltergeist(Bot.MonsterZone[1].Id)) if (((Zones.z5 & available) > 0 && Bot.MonsterZone[1] != null && !isAltergeist(Bot.MonsterZone[1]))
|| ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] == null)) return Zones.z6; || ((Zones.z6 & available) > 0 && Bot.MonsterZone[3] == null)) return Zones.z6;
// main zone // main zone
for (int i = 1; i < 5; ++i) for (int i = 1; i < 5; ++i)
{ {
if (Bot.MonsterZone[i] != null && isAltergeist(Bot.MonsterZone[i].Id)) if (Bot.MonsterZone[i] != null && isAltergeist(Bot.MonsterZone[i]))
{ {
if ((available & (int)System.Math.Pow(2, i - 1)) > 0) return (int)System.Math.Pow(2, i - 1); if ((available & (int)System.Math.Pow(2, i - 1)) > 0) return (int)System.Math.Pow(2, i - 1);
} }
......
...@@ -131,6 +131,7 @@ namespace WindBot.Game.AI.Decks ...@@ -131,6 +131,7 @@ namespace WindBot.Game.AI.Decks
UsedGalaxyEyesCipherDragon = null; UsedGalaxyEyesCipherDragon = null;
AlternativeWhiteDragonSummoned = false; AlternativeWhiteDragonSummoned = false;
SoulChargeUsed = false; SoulChargeUsed = false;
base.OnNewTurn();
} }
public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
......
...@@ -121,6 +121,7 @@ namespace WindBot.Game.AI.Decks ...@@ -121,6 +121,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxCeff() private bool MaxxCeff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1; return Duel.Player == 1;
} }
...@@ -464,6 +465,7 @@ namespace WindBot.Game.AI.Decks ...@@ -464,6 +465,7 @@ namespace WindBot.Game.AI.Decks
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false; if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Linkuriboh)) return false;
return true; return true;
} }
......
...@@ -180,6 +180,7 @@ namespace WindBot.Game.AI.Decks ...@@ -180,6 +180,7 @@ namespace WindBot.Game.AI.Decks
FusionDestinyUsed = false; FusionDestinyUsed = false;
PhoenixTarget = null; PhoenixTarget = null;
PhoenixSelectingTarget = 0; PhoenixSelectingTarget = 0;
base.OnNewTurn();
} }
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions) public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
...@@ -479,6 +480,7 @@ namespace WindBot.Game.AI.Decks ...@@ -479,6 +480,7 @@ namespace WindBot.Game.AI.Decks
private bool AquamancerOfTheSanctuarySearchEffect() private bool AquamancerOfTheSanctuarySearchEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
AI.SelectCard(CardLocation.Deck); AI.SelectCard(CardLocation.Deck);
...@@ -626,6 +628,7 @@ namespace WindBot.Game.AI.Decks ...@@ -626,6 +628,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect() private bool JetSynchronEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int[] materials = new[] { int[] materials = new[] {
CardId.MechaPhantomBeastToken CardId.MechaPhantomBeastToken
}; };
...@@ -786,6 +789,7 @@ namespace WindBot.Game.AI.Decks ...@@ -786,6 +789,7 @@ namespace WindBot.Game.AI.Decks
private bool PredaplantVerteAnacondaEffect() private bool PredaplantVerteAnacondaEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0)) if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0))
return false; return false;
FusionDestinyUsed = true; FusionDestinyUsed = true;
...@@ -858,6 +862,7 @@ namespace WindBot.Game.AI.Decks ...@@ -858,6 +862,7 @@ namespace WindBot.Game.AI.Decks
private bool DestinyHeroCelestialEffect() private bool DestinyHeroCelestialEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!Bot.HasInGraveyard(CardId.DestinyHeroDasher)) if (!Bot.HasInGraveyard(CardId.DestinyHeroDasher))
return false; return false;
AI.SelectCard(CardId.DestinyHeroDasher); AI.SelectCard(CardId.DestinyHeroDasher);
...@@ -971,6 +976,7 @@ namespace WindBot.Game.AI.Decks ...@@ -971,6 +976,7 @@ namespace WindBot.Game.AI.Decks
private bool VirtualWorldKyubiShenshenEffect() private bool VirtualWorldKyubiShenshenEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.MonsterZone && Bot.HasInBanished(CardId.AquamancerOfTheSanctuary)) if (Card.Location == CardLocation.MonsterZone && Bot.HasInBanished(CardId.AquamancerOfTheSanctuary))
{ {
AI.SelectCard(CardId.AquamancerOfTheSanctuary); AI.SelectCard(CardId.AquamancerOfTheSanctuary);
......
...@@ -265,6 +265,7 @@ namespace WindBot.Game.AI.Decks ...@@ -265,6 +265,7 @@ namespace WindBot.Game.AI.Decks
prevent_used = false; prevent_used = false;
Linkuribohused = true; Linkuribohused = true;
Timelord_check = false; Timelord_check = false;
base.OnNewTurn();
} }
public override void OnNewPhase() public override void OnNewPhase()
{ {
......
...@@ -316,6 +316,7 @@ namespace WindBot.Game.AI.Decks ...@@ -316,6 +316,7 @@ namespace WindBot.Game.AI.Decks
big_attack = false; big_attack = false;
big_attack_used = false; big_attack_used = false;
soul_used = false; soul_used = false;
base.OnNewTurn();
} }
public int GetTotalATK(IList<ClientCard> list) public int GetTotalATK(IList<ClientCard> list)
{ {
...@@ -496,11 +497,13 @@ namespace WindBot.Game.AI.Decks ...@@ -496,11 +497,13 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.LifePoints > 1500 && Duel.LastChainPlayer == 1) if (Bot.LifePoints > 1500 && Duel.LastChainPlayer == 1)
return true; return true;
if (DefaultOnlyHorusSpSummoning()) return false;
return false; return false;
} }
private bool ChainEnemy() private bool ChainEnemy()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Util.GetLastChainCard() != null && if (Util.GetLastChainCard() != null &&
Util.GetLastChainCard().IsCode(CardId.UpstartGoblin)) Util.GetLastChainCard().IsCode(CardId.UpstartGoblin))
return false; return false;
...@@ -519,6 +522,7 @@ namespace WindBot.Game.AI.Decks ...@@ -519,6 +522,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxCeff() private bool MaxxCeff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1; return Duel.Player == 1;
} }
/* /*
...@@ -1417,6 +1421,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1417,6 +1421,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika)) if (Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika))
{ {
AI.SelectCard(CardId.VentriloauistsClaraAndLucika); AI.SelectCard(CardId.VentriloauistsClaraAndLucika);
......
This diff is collapsed.
...@@ -123,6 +123,7 @@ namespace WindBot.Game.AI.Decks ...@@ -123,6 +123,7 @@ namespace WindBot.Game.AI.Decks
{ {
BeastOLionUsed = false; BeastOLionUsed = false;
RedEyesFusionUsed = false; RedEyesFusionUsed = false;
base.OnNewTurn();
} }
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions) public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
...@@ -198,6 +199,7 @@ namespace WindBot.Game.AI.Decks ...@@ -198,6 +199,7 @@ namespace WindBot.Game.AI.Decks
private bool TourGuideFromTheUnderworldSummon() private bool TourGuideFromTheUnderworldSummon()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.GetRemainingCount(CardId.TourGuideFromTheUnderworld, 2) == 0 && Bot.GetRemainingCount(CardId.Sangan, 2) == 0) if (Bot.GetRemainingCount(CardId.TourGuideFromTheUnderworld, 2) == 0 && Bot.GetRemainingCount(CardId.Sangan, 2) == 0)
return false; return false;
return true; return true;
...@@ -307,6 +309,7 @@ namespace WindBot.Game.AI.Decks ...@@ -307,6 +309,7 @@ namespace WindBot.Game.AI.Decks
private bool MagiciansSoulsEffect() private bool MagiciansSoulsEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (RedEyesFusionUsed) if (RedEyesFusionUsed)
...@@ -375,6 +378,7 @@ namespace WindBot.Game.AI.Decks ...@@ -375,6 +378,7 @@ namespace WindBot.Game.AI.Decks
private bool PredaplantVerteAnacondaEffect() private bool PredaplantVerteAnacondaEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0)) if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 0))
return false; return false;
AI.SelectCard(CardId.RedEyesFusion); AI.SelectCard(CardId.RedEyesFusion);
......
...@@ -456,6 +456,7 @@ namespace WindBot.Game.AI.Decks ...@@ -456,6 +456,7 @@ namespace WindBot.Game.AI.Decks
private bool AssaultBeast() private bool AssaultBeast()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!Bot.HasInSpellZone(CardId.AssaultModeActivate)) if (!Bot.HasInSpellZone(CardId.AssaultModeActivate))
return true; return true;
return false; return false;
......
...@@ -164,7 +164,7 @@ namespace WindBot.Game.AI.Decks ...@@ -164,7 +164,7 @@ namespace WindBot.Game.AI.Decks
}; };
List<int> ExosisterSpellTrapList = new List<int>{CardId.ExosisterPax, CardId.ExosisterArment, CardId.ExosisterVadis, CardId.ExosisterReturnia}; List<int> ExosisterSpellTrapList = new List<int>{CardId.ExosisterPax, CardId.ExosisterArment, CardId.ExosisterVadis, CardId.ExosisterReturnia};
Dictionary<int, int> calledbytheGraveCount = new Dictionary<int, int>(); List<int> currentNegatingIdList = new List<int>();
bool enemyActivateMaxxC = false; bool enemyActivateMaxxC = false;
bool enemyActivateLockBird = false; bool enemyActivateLockBird = false;
bool enemyMoveGrave = false; bool enemyMoveGrave = false;
...@@ -410,11 +410,9 @@ namespace WindBot.Game.AI.Decks ...@@ -410,11 +410,9 @@ namespace WindBot.Game.AI.Decks
/// </summary> /// </summary>
public int CheckCalledbytheGrave(int id) public int CheckCalledbytheGrave(int id)
{ {
if (!calledbytheGraveCount.ContainsKey(id)) if (currentNegatingIdList.Contains(id)) return 1;
{ if (DefaultCheckWhetherCardIdIsNegated(id)) return 1;
return 0; return 0;
}
return calledbytheGraveCount[id];
} }
public void CheckEnemyMoveGrave() public void CheckEnemyMoveGrave()
...@@ -470,24 +468,6 @@ namespace WindBot.Game.AI.Decks ...@@ -470,24 +468,6 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
/// <summary>
/// Check whether negate opposite's effect and clear flag
/// </summary>
public void CheckDeactiveFlag()
{
if (Util.GetLastChainCard() != null && Duel.LastChainPlayer == 1)
{
if (Util.GetLastChainCard().IsCode(_CardId.MaxxC))
{
enemyActivateMaxxC = false;
}
if (Util.GetLastChainCard().IsCode(_CardId.LockBird))
{
enemyActivateLockBird = false;
}
}
}
/// <summary> /// <summary>
/// Check whether opposite use Maxx-C, and thus make less operation. /// Check whether opposite use Maxx-C, and thus make less operation.
/// </summary> /// </summary>
...@@ -777,13 +757,6 @@ namespace WindBot.Game.AI.Decks ...@@ -777,13 +757,6 @@ namespace WindBot.Game.AI.Decks
ClientCard card = Util.GetLastChainCard(); ClientCard card = Util.GetLastChainCard();
if (player == 1) if (player == 1)
{ {
if (card != null && card.IsCode(_CardId.CalledByTheGrave))
{
foreach (ClientCard targetCard in Duel.LastChainTargets) {
Logger.DebugWriteLine("===Exosister: " + targetCard?.Name + " is targeted by called by the grave.");
calledbytheGraveCount[targetCard.Id] = 2;
}
}
foreach (ClientCard targetCard in Duel.LastChainTargets) { foreach (ClientCard targetCard in Duel.LastChainTargets) {
if (targetCard.Location == CardLocation.Grave) if (targetCard.Location == CardLocation.Grave)
{ {
...@@ -796,6 +769,30 @@ namespace WindBot.Game.AI.Decks ...@@ -796,6 +769,30 @@ namespace WindBot.Game.AI.Decks
base.OnSelectChain(cards); base.OnSelectChain(cards);
} }
public override void OnChainSolved(int chainIndex)
{
ClientCard currentCard = Duel.GetCurrentSolvingChainCard();
if (currentCard != null && !Duel.IsCurrentSolvingChainNegated() && currentCard.Controller == 1)
{
if (currentCard.IsCode(_CardId.MaxxC))
enemyActivateMaxxC = true;
if (currentCard.IsCode(_CardId.LockBird))
enemyActivateLockBird = true;
if (currentCard.IsCode(_CardId.InfiniteImpermanence))
{
for (int i = 0; i < 5; ++i)
{
if (Enemy.SpellZone[i] == currentCard)
{
infiniteImpermanenceList.Add(4 - i);
break;
}
}
}
}
}
/// <summary> /// <summary>
/// clear chain information /// clear chain information
/// </summary> /// </summary>
...@@ -833,19 +830,10 @@ namespace WindBot.Game.AI.Decks ...@@ -833,19 +830,10 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn() public override void OnNewTurn()
{ {
if (Duel.Turn <= 1) calledbytheGraveCount.Clear();
enemyActivateMaxxC = false; enemyActivateMaxxC = false;
enemyActivateLockBird = false; enemyActivateLockBird = false;
infiniteImpermanenceList.Clear(); infiniteImpermanenceList.Clear();
// CalledbytheGrave refresh currentNegatingIdList.Clear();
List<int> key_list = calledbytheGraveCount.Keys.ToList();
foreach (int dic in key_list)
{
if (calledbytheGraveCount[dic] > 1)
{
calledbytheGraveCount[dic] -= 1;
}
}
summoned = false; summoned = false;
elisEffect1Activated = false; elisEffect1Activated = false;
...@@ -1133,7 +1121,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1133,7 +1121,6 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
} }
CheckDeactiveFlag();
return DefaultAshBlossomAndJoyousSpring(); return DefaultAshBlossomAndJoyousSpring();
} }
...@@ -1192,7 +1179,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1192,7 +1179,6 @@ namespace WindBot.Game.AI.Decks
{ {
ClientCard target = GetProblematicEnemyMonster(canBeTarget: true); ClientCard target = GetProblematicEnemyMonster(canBeTarget: true);
List<ClientCard> enemyMonsters = Enemy.GetMonsters(); List<ClientCard> enemyMonsters = Enemy.GetMonsters();
CheckDeactiveFlag();
AI.SelectCard(target); AI.SelectCard(target);
infiniteImpermanenceList.Add(this_seq); infiniteImpermanenceList.Add(this_seq);
return true; return true;
...@@ -1227,7 +1213,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1227,7 +1213,6 @@ namespace WindBot.Game.AI.Decks
{ {
if (card.IsFaceup() && !card.IsShouldNotBeTarget() && !card.IsShouldNotBeSpellTrapTarget()) if (card.IsFaceup() && !card.IsShouldNotBeTarget() && !card.IsShouldNotBeSpellTrapTarget())
{ {
CheckDeactiveFlag();
AI.SelectCard(card); AI.SelectCard(card);
return true; return true;
} }
...@@ -1244,7 +1229,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1244,7 +1229,7 @@ namespace WindBot.Game.AI.Decks
// negate // negate
if (Util.GetLastChainCard().IsMonster()) if (Util.GetLastChainCard().IsMonster())
{ {
int code = Util.GetLastChainCard().Id; int code = Util.GetLastChainCard().GetOriginCode();
if (code == 0) return false; if (code == 0) return false;
if (CheckCalledbytheGrave(code) > 0) return false; if (CheckCalledbytheGrave(code) > 0) return false;
if (Util.GetLastChainCard().IsCode(_CardId.MaxxC) && CheckAtAdvantage()) if (Util.GetLastChainCard().IsCode(_CardId.MaxxC) && CheckAtAdvantage())
...@@ -1255,15 +1240,15 @@ namespace WindBot.Game.AI.Decks ...@@ -1255,15 +1240,15 @@ namespace WindBot.Game.AI.Decks
{ {
return false; return false;
} }
if (Enemy.Graveyard.GetFirstMatchingCard(card => card.IsMonster() && card.IsOriginalCode(code)) != null) ClientCard targetCard = Enemy.Graveyard.GetFirstMatchingCard(card => card.IsMonster() && card.IsOriginalCode(code));
if (targetCard != null)
{ {
if (!(Card.Location == CardLocation.SpellZone)) if (!(Card.Location == CardLocation.SpellZone))
{ {
SelectSTPlace(null, true); SelectSTPlace(null, true);
} }
AI.SelectCard(code); AI.SelectCard(targetCard);
calledbytheGraveCount[code] = 2; currentNegatingIdList.Add(code);
CheckDeactiveFlag();
return true; return true;
} }
} }
...@@ -1275,7 +1260,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1275,7 +1260,7 @@ namespace WindBot.Game.AI.Decks
{ {
int code = cards.Id; int code = cards.Id;
AI.SelectCard(cards); AI.SelectCard(cards);
calledbytheGraveCount[code] = 2; currentNegatingIdList.Add(code);
return true; return true;
} }
} }
...@@ -1290,7 +1275,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1290,7 +1275,7 @@ namespace WindBot.Game.AI.Decks
enemyMonsters.Reverse(); enemyMonsters.Reverse();
int code = enemyMonsters[0].Id; int code = enemyMonsters[0].Id;
AI.SelectCard(code); AI.SelectCard(code);
calledbytheGraveCount[code] = 2; currentNegatingIdList.Add(code);
return true; return true;
} }
} }
...@@ -1300,13 +1285,13 @@ namespace WindBot.Game.AI.Decks ...@@ -1300,13 +1285,13 @@ namespace WindBot.Game.AI.Decks
if (Duel.LastChainPlayer == 1) return false; if (Duel.LastChainPlayer == 1) return false;
List<ClientCard> targets = CheckDangerousCardinEnemyGrave(true); List<ClientCard> targets = CheckDangerousCardinEnemyGrave(true);
if (targets.Count() > 0) { if (targets.Count() > 0) {
int code = targets[0].Id; int code = targets[0].GetOriginCode();
if (!(Card.Location == CardLocation.SpellZone)) if (!(Card.Location == CardLocation.SpellZone))
{ {
SelectSTPlace(null, true); SelectSTPlace(null, true);
} }
AI.SelectCard(code); AI.SelectCard(targets);
calledbytheGraveCount[code] = 2; currentNegatingIdList.Add(code);
return true; return true;
} }
......
...@@ -135,6 +135,7 @@ namespace WindBot.Game.AI.Decks ...@@ -135,6 +135,7 @@ namespace WindBot.Game.AI.Decks
private bool Ronintoadin() private bool Ronintoadin()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> monsters = Bot.GetGraveyardMonsters(); List<ClientCard> monsters = Bot.GetGraveyardMonsters();
if (monsters.Count > 2) if (monsters.Count > 2)
{ {
......
...@@ -128,6 +128,7 @@ namespace WindBot.Game.AI.Decks ...@@ -128,6 +128,7 @@ namespace WindBot.Game.AI.Decks
{ {
eater_eff = false; eater_eff = false;
CardOfDemiseeff_used = false; CardOfDemiseeff_used = false;
base.OnNewTurn();
} }
public override void OnNewPhase() public override void OnNewPhase()
...@@ -437,6 +438,7 @@ namespace WindBot.Game.AI.Decks ...@@ -437,6 +438,7 @@ namespace WindBot.Game.AI.Decks
private bool ThunderKingRaiOheff() private bool ThunderKingRaiOheff()
{ {
if (DefaultOnlyHorusSpSummoning()) return false;
if(Duel.SummoningCards.Count > 0) if(Duel.SummoningCards.Count > 0)
{ {
foreach(ClientCard m in Duel.SummoningCards) foreach(ClientCard m in Duel.SummoningCards)
...@@ -547,7 +549,7 @@ namespace WindBot.Game.AI.Decks ...@@ -547,7 +549,7 @@ namespace WindBot.Game.AI.Decks
{ {
targets.Add(s_c); targets.Add(s_c);
if (targets.Count >= 5) if (targets.Count >= 5)
{ {
AI.SelectMaterials(targets, HintMsg.Remove); AI.SelectMaterials(targets, HintMsg.Remove);
return true; return true;
} }
...@@ -570,6 +572,7 @@ namespace WindBot.Game.AI.Decks ...@@ -570,6 +572,7 @@ namespace WindBot.Game.AI.Decks
private bool MetalSnakesp() private bool MetalSnakesp()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (ActivateDescription == Util.GetStringId(CardId.MetalSnake, 0) && !Bot.HasInMonstersZone(CardId.MetalSnake)) if (ActivateDescription == Util.GetStringId(CardId.MetalSnake, 0) && !Bot.HasInMonstersZone(CardId.MetalSnake))
{ {
if(Duel.Player == 1 && Duel.Phase >= DuelPhase.BattleStart ) if(Duel.Player == 1 && Duel.Phase >= DuelPhase.BattleStart )
......
...@@ -175,6 +175,7 @@ namespace WindBot.Game.AI.Decks ...@@ -175,6 +175,7 @@ namespace WindBot.Game.AI.Decks
opt_2 = false; opt_2 = false;
if (flag >= 0) ++flag; if (flag >= 0) ++flag;
if (flag >= 2) { flag = -1; activate_DimensionShifter = false; } if (flag >= 2) { flag = -1; activate_DimensionShifter = false; }
base.OnNewTurn();
} }
public override bool OnSelectYesNo(int desc) public override bool OnSelectYesNo(int desc)
{ {
......
...@@ -179,7 +179,6 @@ namespace WindBot.Game.AI.Decks ...@@ -179,7 +179,6 @@ namespace WindBot.Game.AI.Decks
}; };
List<int> notToDestroySpellTrap = new List<int> { 50005218, 6767771 }; List<int> notToDestroySpellTrap = new List<int> { 50005218, 6767771 };
Dictionary<int, int> calledbytheGraveCount = new Dictionary<int, int>();
bool enemyActivateMaxxC = false; bool enemyActivateMaxxC = false;
List<int> infiniteImpermanenceList = new List<int>(); List<int> infiniteImpermanenceList = new List<int>();
bool summoned = false; bool summoned = false;
...@@ -455,11 +454,8 @@ namespace WindBot.Game.AI.Decks ...@@ -455,11 +454,8 @@ namespace WindBot.Game.AI.Decks
/// </summary> /// </summary>
public int CheckCalledbytheGrave(int id) public int CheckCalledbytheGrave(int id)
{ {
if (!calledbytheGraveCount.ContainsKey(id)) if (DefaultCheckWhetherCardIdIsNegated(id)) return 1;
{ return 0;
return 0;
}
return calledbytheGraveCount[id];
} }
public bool CheckCanBeTargeted(ClientCard card, bool canBeTarget, CardType selfType) public bool CheckCanBeTargeted(ClientCard card, bool canBeTarget, CardType selfType)
...@@ -1593,7 +1589,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1593,7 +1589,6 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Turn <= 1) if (Duel.Turn <= 1)
{ {
calledbytheGraveCount.Clear();
dimensionShifterCount = 0; dimensionShifterCount = 0;
enemySpSummonFromExLastTurn = 0; enemySpSummonFromExLastTurn = 0;
...@@ -1605,11 +1600,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1605,11 +1600,6 @@ namespace WindBot.Game.AI.Decks
enemySpSummonFromExThisTurn = 0; enemySpSummonFromExThisTurn = 0;
rollbackCopyCardId = 0; rollbackCopyCardId = 0;
List<int> keyList = calledbytheGraveCount.Keys.ToList();
foreach (int dic in keyList)
{
if (calledbytheGraveCount[dic] > 1) calledbytheGraveCount[dic] -= 1;
}
if (dimensionShifterCount > 0) dimensionShifterCount--; if (dimensionShifterCount > 0) dimensionShifterCount--;
if (banSpSummonExceptFiendCount > 0) banSpSummonExceptFiendCount--; if (banSpSummonExceptFiendCount > 0) banSpSummonExceptFiendCount--;
infiniteImpermanenceList.Clear(); infiniteImpermanenceList.Clear();
...@@ -1622,6 +1612,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1622,6 +1612,7 @@ namespace WindBot.Game.AI.Decks
enemySetThisTurn.Clear(); enemySetThisTurn.Clear();
dimensionalBarrierAnnouced.Clear(); dimensionalBarrierAnnouced.Clear();
summonInChainList.Clear(); summonInChainList.Clear();
base.OnNewTurn();
} }
public override void OnChaining(int player, ClientCard card) public override void OnChaining(int player, ClientCard card)
...@@ -1742,14 +1733,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1742,14 +1733,6 @@ namespace WindBot.Game.AI.Decks
summonThisTurn.Add(card); summonThisTurn.Add(card);
if (currentSolvingChain != null) summonInChainList.Add(card); if (currentSolvingChain != null) summonInChainList.Add(card);
} }
if (previousLocation == (int)CardLocation.Grave && currentLocation == (int)CardLocation.Removed)
{
if (currentSolvingChain != null && currentSolvingChain.Controller == 1 && currentSolvingChain.IsCode(_CardId.CalledByTheGrave))
{
Logger.DebugWriteLine("*** " + (card.Name ?? "UnknowCard") + " is banished by CallByTheGrave");
calledbytheGraveCount[card.Id] = 2;
}
}
} }
} }
......
...@@ -217,11 +217,12 @@ namespace WindBot.Game.AI.Decks ...@@ -217,11 +217,12 @@ namespace WindBot.Game.AI.Decks
JetSynchronUsed = false; JetSynchronUsed = false;
ScrapWyvernUsed = false; ScrapWyvernUsed = false;
MaskedChameleonUsed = false; MaskedChameleonUsed = false;
base.OnNewTurn();
} }
public override void OnChainEnd() public override void OnChainEnd()
{ {
base.OnChainEnd();
} }
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions) public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
......
...@@ -274,6 +274,7 @@ namespace WindBot.Game.AI.Decks ...@@ -274,6 +274,7 @@ namespace WindBot.Game.AI.Decks
ShaddollSquamata_used = false; ShaddollSquamata_used = false;
ShaddollDragon_used = false; ShaddollDragon_used = false;
ShaddollHedgehog_used = false; ShaddollHedgehog_used = false;
base.OnNewTurn();
} }
private bool Luminasummon() private bool Luminasummon()
...@@ -290,6 +291,7 @@ namespace WindBot.Game.AI.Decks ...@@ -290,6 +291,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool Luminaeff() private bool Luminaeff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInGraveyard(CardId.Raiden)) if (Bot.HasInGraveyard(CardId.Raiden))
{ {
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
...@@ -555,6 +557,7 @@ namespace WindBot.Game.AI.Decks ...@@ -555,6 +557,7 @@ namespace WindBot.Game.AI.Decks
private bool GlowUpBulbeff() private bool GlowUpBulbeff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
IList<ClientCard> check = Bot.GetMonstersInExtraZone(); IList<ClientCard> check = Bot.GetMonstersInExtraZone();
foreach (ClientCard monster in check) foreach (ClientCard monster in check)
if (monster.HasType(CardType.Fusion)) return false; if (monster.HasType(CardType.Fusion)) return false;
...@@ -627,6 +630,7 @@ namespace WindBot.Game.AI.Decks ...@@ -627,6 +630,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxC() private bool MaxxC()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1; return Duel.Player == 1;
} }
...@@ -977,6 +981,7 @@ namespace WindBot.Game.AI.Decks ...@@ -977,6 +981,7 @@ namespace WindBot.Game.AI.Decks
public bool Hand_act_eff() public bool Hand_act_eff()
{ {
//if (Card.IsCode(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 (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.IsCode(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);
} }
...@@ -998,6 +1003,7 @@ namespace WindBot.Game.AI.Decks ...@@ -998,6 +1003,7 @@ namespace WindBot.Game.AI.Decks
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
return true; return true;
if (Bot.LifePoints <= 1000) return false; if (Bot.LifePoints <= 1000) return false;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
ClientCard select = Util.GetBestEnemyCard(); ClientCard select = Util.GetBestEnemyCard();
if (select == null) return false; if (select == null) return false;
if(select!=null) if(select!=null)
......
...@@ -219,11 +219,13 @@ namespace WindBot.Game.AI.Decks ...@@ -219,11 +219,13 @@ namespace WindBot.Game.AI.Decks
private bool ImFeelingLucky() private bool ImFeelingLucky()
{ {
if (Type == ExecutorType.Activate && DefaultCheckWhetherCardIsNegated(Card)) return false;
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself(); return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself();
} }
private bool ImFeelingUnlucky() private bool ImFeelingUnlucky()
{ {
if (Type == ExecutorType.Activate && DefaultCheckWhetherCardIsNegated(Card)) return false;
return DefaultDontChainMyself(); return DefaultDontChainMyself();
} }
......
...@@ -214,11 +214,13 @@ namespace WindBot.Game.AI.Decks ...@@ -214,11 +214,13 @@ namespace WindBot.Game.AI.Decks
CymbalSkeletonUsed = false; CymbalSkeletonUsed = false;
BorrelswordDragonUsed = false; BorrelswordDragonUsed = false;
RustyBardicheTarget = null; RustyBardicheTarget = null;
base.OnNewTurn();
} }
public override void OnChainEnd() public override void OnChainEnd()
{ {
RustyBardicheTarget = null; RustyBardicheTarget = null;
base.OnChainEnd();
} }
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions) public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
...@@ -465,6 +467,7 @@ namespace WindBot.Game.AI.Decks ...@@ -465,6 +467,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect() private bool JetSynchronEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(HandCosts); AI.SelectCard(HandCosts);
return true; return true;
} }
...@@ -488,6 +491,7 @@ namespace WindBot.Game.AI.Decks ...@@ -488,6 +491,7 @@ namespace WindBot.Game.AI.Decks
private bool DestrudoSummon() private bool DestrudoSummon()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Bot.GetMonsterCount() < 3 && Bot.HasInExtra(new[] { CardId.CrystronNeedlefiber, CardId.KnightmarePhoenix }); return Bot.GetMonsterCount() < 3 && Bot.HasInExtra(new[] { CardId.CrystronNeedlefiber, CardId.KnightmarePhoenix });
} }
...@@ -659,6 +663,7 @@ namespace WindBot.Game.AI.Decks ...@@ -659,6 +663,7 @@ namespace WindBot.Game.AI.Decks
private bool KnightmarePhoenixEffect() private bool KnightmarePhoenixEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int costcount = Bot.Hand.GetMatchingCardsCount(card => card.IsCode(HandCosts)); int costcount = Bot.Hand.GetMatchingCardsCount(card => card.IsCode(HandCosts));
ClientCard target = Enemy.SpellZone.GetFloodgate(); ClientCard target = Enemy.SpellZone.GetFloodgate();
ClientCard anytarget = Enemy.SpellZone.GetFirstMatchingCard(card => !card.OwnTargets.Any(cont => cont.IsCode(CardId.TrickstarLightStage))); ClientCard anytarget = Enemy.SpellZone.GetFirstMatchingCard(card => !card.OwnTargets.Any(cont => cont.IsCode(CardId.TrickstarLightStage)));
...@@ -685,6 +690,7 @@ namespace WindBot.Game.AI.Decks ...@@ -685,6 +690,7 @@ namespace WindBot.Game.AI.Decks
private bool KnightmareMermaidEffect() private bool KnightmareMermaidEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(HandCosts); AI.SelectCard(HandCosts);
return true; return true;
} }
...@@ -703,6 +709,7 @@ namespace WindBot.Game.AI.Decks ...@@ -703,6 +709,7 @@ namespace WindBot.Game.AI.Decks
private bool OrcustKnightmareEffect() private bool OrcustKnightmareEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!Bot.HasInGraveyard(CardId.OrcustHarpHorror)) if (!Bot.HasInGraveyard(CardId.OrcustHarpHorror))
{ {
AI.SelectCard(Util.GetBestBotMonster()); AI.SelectCard(Util.GetBestBotMonster());
...@@ -726,6 +733,7 @@ namespace WindBot.Game.AI.Decks ...@@ -726,6 +733,7 @@ namespace WindBot.Game.AI.Decks
private bool HarpHorrorEffect() private bool HarpHorrorEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
HarpHorrorUsed = true; HarpHorrorUsed = true;
AI.SelectCard(CardId.OrcustCymbalSkeleton); AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true; return true;
...@@ -733,6 +741,7 @@ namespace WindBot.Game.AI.Decks ...@@ -733,6 +741,7 @@ namespace WindBot.Game.AI.Decks
private bool WorldWandEffect() private bool WorldWandEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(CardId.OrcustCymbalSkeleton); AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true; return true;
} }
...@@ -783,6 +792,7 @@ namespace WindBot.Game.AI.Decks ...@@ -783,6 +792,7 @@ namespace WindBot.Game.AI.Decks
private bool CymbalSkeletonEffect() private bool CymbalSkeletonEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int[] botTurnTargets = new[] { CardId.GalateaTheOrcustAutomaton, CardId.SheorcustDingirsu }; int[] botTurnTargets = new[] { CardId.GalateaTheOrcustAutomaton, CardId.SheorcustDingirsu };
int[] emenyTurnTargets = new[] { CardId.SheorcustDingirsu, CardId.GalateaTheOrcustAutomaton }; int[] emenyTurnTargets = new[] { CardId.SheorcustDingirsu, CardId.GalateaTheOrcustAutomaton };
if (Duel.Player == 0 && Bot.HasInGraveyard(CardId.GalateaTheOrcustAutomaton) && !Bot.HasInMonstersZone(CardId.GalateaTheOrcustAutomaton) && Bot.HasInExtra(CardId.SheorcustDingirsu) && !SheorcustDingirsuSummoned) if (Duel.Player == 0 && Bot.HasInGraveyard(CardId.GalateaTheOrcustAutomaton) && !Bot.HasInMonstersZone(CardId.GalateaTheOrcustAutomaton) && Bot.HasInExtra(CardId.SheorcustDingirsu) && !SheorcustDingirsuSummoned)
...@@ -867,6 +877,7 @@ namespace WindBot.Game.AI.Decks ...@@ -867,6 +877,7 @@ namespace WindBot.Game.AI.Decks
private bool AncientCloakEffect() private bool AncientCloakEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix)) if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix))
AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine); AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine);
else else
...@@ -881,6 +892,7 @@ namespace WindBot.Game.AI.Decks ...@@ -881,6 +892,7 @@ namespace WindBot.Game.AI.Decks
private bool SilentBootsEffect() private bool SilentBootsEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix)) if (Bot.HasInMonstersZone(CardId.SalamangreatAlmiraj) && Bot.HasInExtra(CardId.KnightmarePhoenix))
AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine); AI.SelectCard(CardId.ThePhantomKnightsofShadeBrigandine);
else else
...@@ -1033,6 +1045,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1033,6 +1045,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
IList<ClientCard> costCards = Bot.Hand.GetMatchingCards(card => card.IsCode(HandCosts)); IList<ClientCard> costCards = Bot.Hand.GetMatchingCards(card => card.IsCode(HandCosts));
if (costCards.Count > 0) if (costCards.Count > 0)
{ {
...@@ -1113,6 +1126,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1113,6 +1126,7 @@ namespace WindBot.Game.AI.Decks
} }
else if (Bot.HasInGraveyard(CardId.ThePhantomKnightsofRustyBardiche) || Bot.GetMonsterCount() < 2) else if (Bot.HasInGraveyard(CardId.ThePhantomKnightsofRustyBardiche) || Bot.GetMonsterCount() < 2)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(CardId.ThePhantomKnightsofRustyBardiche); AI.SelectCard(CardId.ThePhantomKnightsofRustyBardiche);
return true; return true;
} }
......
...@@ -555,6 +555,7 @@ namespace WindBot.Game.AI.Decks ...@@ -555,6 +555,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool SpeedroidTaketomborgeff() private bool SpeedroidTaketomborgeff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if ((Bot.GetRemainingCount(CardId.SpeedroidRedEyedDice, 1) >= 1) && if ((Bot.GetRemainingCount(CardId.SpeedroidRedEyedDice, 1) >= 1) &&
Bot.HasInMonstersZone(CardId.SpeedroidTerrortop)) Bot.HasInMonstersZone(CardId.SpeedroidTerrortop))
{ {
......
...@@ -130,6 +130,7 @@ namespace WindBot.Game.AI.Decks ...@@ -130,6 +130,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn() public override void OnNewTurn()
{ {
CardOfDemiseUsed = false; CardOfDemiseUsed = false;
base.OnNewTurn();
} }
public override IList<ClientCard> OnSelectPendulumSummon(IList<ClientCard> cards, int max) public override IList<ClientCard> OnSelectPendulumSummon(IList<ClientCard> cards, int max)
...@@ -281,6 +282,7 @@ namespace WindBot.Game.AI.Decks ...@@ -281,6 +282,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
return false; return false;
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
int count = 0; int count = 0;
int handcount = 0; int handcount = 0;
int fieldcount = 0; int fieldcount = 0;
......
...@@ -142,6 +142,7 @@ namespace WindBot.Game.AI.Decks ...@@ -142,6 +142,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn() public override void OnNewTurn()
{ {
NormalSummoned = false; NormalSummoned = false;
base.OnNewTurn();
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
...@@ -210,6 +211,7 @@ namespace WindBot.Game.AI.Decks ...@@ -210,6 +211,7 @@ namespace WindBot.Game.AI.Decks
private bool RescueRabbitSummon() private bool RescueRabbitSummon()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Util.GetBotAvailZonesFromExtraDeck() > 0 return Util.GetBotAvailZonesFromExtraDeck() > 0
|| !Enemy.MonsterZone.IsExistingMatchingCard(card => card.GetDefensePower() >= 1900) || !Enemy.MonsterZone.IsExistingMatchingCard(card => card.GetDefensePower() >= 1900)
|| Enemy.MonsterZone.GetMatchingCardsCount(card => card.GetDefensePower() < 1900) > Bot.MonsterZone.GetMatchingCardsCount(card => card.Attack >= 1900); || Enemy.MonsterZone.GetMatchingCardsCount(card => card.GetDefensePower() < 1900) > Bot.MonsterZone.GetMatchingCardsCount(card => card.Attack >= 1900);
......
...@@ -116,6 +116,7 @@ namespace WindBot.Game.AI.Decks ...@@ -116,6 +116,7 @@ namespace WindBot.Game.AI.Decks
DoubleSummonUsed = false; DoubleSummonUsed = false;
CyberDragonInfinitySummoned = false; CyberDragonInfinitySummoned = false;
Number61VolcasaurusUsed = false; Number61VolcasaurusUsed = false;
base.OnNewTurn();
} }
public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max) public override IList<ClientCard> OnSelectXyzMaterial(IList<ClientCard> cards, int min, int max)
......
...@@ -153,6 +153,7 @@ namespace WindBot.Game.AI.Decks ...@@ -153,6 +153,7 @@ namespace WindBot.Game.AI.Decks
{ {
// reset // reset
BalancerLordUsed = false; BalancerLordUsed = false;
base.OnNewTurn();
} }
public override int OnSelectOption(IList<int> options) public override int OnSelectOption(IList<int> options)
......
...@@ -594,6 +594,7 @@ namespace WindBot.Game.AI.Decks ...@@ -594,6 +594,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInHand(CardId.Spinny) || FalcoToGY(false)) if (Bot.HasInHand(CardId.Spinny) || FalcoToGY(false))
{ {
if (Bot.HasInHand(CardId.Spinny) && !Bot.HasInGraveyard(CardId.Spinny)) if (Bot.HasInHand(CardId.Spinny) && !Bot.HasInGraveyard(CardId.Spinny))
...@@ -779,10 +780,12 @@ namespace WindBot.Game.AI.Decks ...@@ -779,10 +780,12 @@ namespace WindBot.Game.AI.Decks
public bool G_activate() public bool G_activate()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return (Duel.Player == 1); return (Duel.Player == 1);
} }
public bool Hand_act_eff() public bool Hand_act_eff()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return (Duel.LastChainPlayer == 1); return (Duel.LastChainPlayer == 1);
} }
......
...@@ -146,6 +146,7 @@ namespace WindBot.Game.AI.Decks ...@@ -146,6 +146,7 @@ namespace WindBot.Game.AI.Decks
ShizukuSummoned = false; ShizukuSummoned = false;
HayateSummoned = false; HayateSummoned = false;
WidowAnchorTarget = null; WidowAnchorTarget = null;
base.OnNewTurn();
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
...@@ -194,6 +195,7 @@ namespace WindBot.Game.AI.Decks ...@@ -194,6 +195,7 @@ namespace WindBot.Game.AI.Decks
private bool MaxxCEffect() private bool MaxxCEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player == 1; return Duel.Player == 1;
} }
...@@ -667,6 +669,7 @@ namespace WindBot.Game.AI.Decks ...@@ -667,6 +669,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect() private bool JetSynchronEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInMonstersZone(CardId.Raye) || Bot.HasInMonstersZone(CardId.CrystronNeedlefiber)) if (Bot.HasInMonstersZone(CardId.Raye) || Bot.HasInMonstersZone(CardId.CrystronNeedlefiber))
{ {
AI.SelectCard(GetDiscardHand()); AI.SelectCard(GetDiscardHand());
......
This diff is collapsed.
This diff is collapsed.
...@@ -182,8 +182,8 @@ namespace WindBot.Game.AI.Decks ...@@ -182,8 +182,8 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.BaronnedeFleur, BaronnedeFleurEffect); AddExecutor(ExecutorType.Activate, CardId.BaronnedeFleur, BaronnedeFleurEffect);
AddExecutor(ExecutorType.Activate, CardId.ElderEntityNtss, ElderEntityNtssEffect); AddExecutor(ExecutorType.Activate, CardId.ElderEntityNtss, ElderEntityNtssEffect);
AddExecutor(ExecutorType.Activate, CardId.PredaplantDragostapelia, PredaplantDragostapeliaEffect); AddExecutor(ExecutorType.Activate, CardId.PredaplantDragostapelia, PredaplantDragostapeliaEffect);
AddExecutor(ExecutorType.Activate, CardId.HeraldofOrangeLight); AddExecutor(ExecutorType.Activate, CardId.HeraldofOrangeLight, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.HeraldofGreenLight); AddExecutor(ExecutorType.Activate, CardId.HeraldofGreenLight, DefaultTrap);
AddExecutor(ExecutorType.Activate, CardId.TearlamentsRulkallos, TearlamentsRulkallosEffect); AddExecutor(ExecutorType.Activate, CardId.TearlamentsRulkallos, TearlamentsRulkallosEffect);
AddExecutor(ExecutorType.Activate, CardId.FADawnDragster); AddExecutor(ExecutorType.Activate, CardId.FADawnDragster);
AddExecutor(ExecutorType.Activate, CardId.PrimevalPlanetPerlereino, PrimevalPlanetPerlereinoEffect); AddExecutor(ExecutorType.Activate, CardId.PrimevalPlanetPerlereino, PrimevalPlanetPerlereinoEffect);
...@@ -275,6 +275,7 @@ namespace WindBot.Game.AI.Decks ...@@ -275,6 +275,7 @@ namespace WindBot.Game.AI.Decks
spsummoned = false; spsummoned = false;
summon_SprightElf = false; summon_SprightElf = false;
TearlamentsKitkallos_summoned = false; TearlamentsKitkallos_summoned = false;
base.OnNewTurn();
} }
private List<ClientCard> GetZoneCards(CardLocation loc, ClientField player) private List<ClientCard> GetZoneCards(CardLocation loc, ClientField player)
{ {
...@@ -2172,6 +2173,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2172,6 +2173,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool EvaEffect() private bool EvaEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> cards = Bot.GetGraveyardMonsters().Where(card => card != null && card.HasAttribute(CardAttribute.Light) && card.HasRace(CardRace.Fairy) && card != Card).ToList(); List<ClientCard> cards = Bot.GetGraveyardMonsters().Where(card => card != null && card.HasAttribute(CardAttribute.Light) && card.HasRace(CardRace.Fairy) && card != Card).ToList();
if (cards.Count <= 0) return false; if (cards.Count <= 0) return false;
activate_Eva = true; activate_Eva = true;
...@@ -2207,6 +2209,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2207,6 +2209,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool MudoratheSwordOracleEffect() private bool MudoratheSwordOracleEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if ((Bot.Hand.Count(card => card != null && card.Id == CardId.AgidotheAncientSentinel) <= 0 || activate_AgidotheAncientSentinel_2) if ((Bot.Hand.Count(card => card != null && card.Id == CardId.AgidotheAncientSentinel) <= 0 || activate_AgidotheAncientSentinel_2)
......
...@@ -278,6 +278,8 @@ namespace WindBot.Game.AI.Decks ...@@ -278,6 +278,8 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < selectAtt.Count; i++) for (int i = 0; i < selectAtt.Count; i++)
selectAtt[i] = false; selectAtt[i] = false;
base.OnNewTurn();
} }
private bool IsAvailableZone(int seq) private bool IsAvailableZone(int seq)
{ {
...@@ -889,6 +891,7 @@ namespace WindBot.Game.AI.Decks ...@@ -889,6 +891,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool AshBlossomEffect() private bool AshBlossomEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.CurrentChain.Count > 0 && Duel.LastChainPlayer != 0; return Duel.CurrentChain.Count > 0 && Duel.LastChainPlayer != 0;
} }
public int CompareCardLink(ClientCard cardA, ClientCard cardB) public int CompareCardLink(ClientCard cardA, ClientCard cardB)
...@@ -1053,6 +1056,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1053,6 +1056,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool GEffect() private bool GEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return Duel.Player != 0; return Duel.Player != 0;
} }
private bool ThunderDragonColossusSummon_2() private bool ThunderDragonColossusSummon_2()
...@@ -1101,6 +1105,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1101,6 +1105,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 1)) if (ActivateDescription == Util.GetStringId(CardId.PredaplantVerteAnaconda, 1))
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (CheckRemainInDeck(CardId.ThunderDragonFusion) <= 0) return false; if (CheckRemainInDeck(CardId.ThunderDragonFusion) <= 0) return false;
if (Bot.GetMonstersInMainZone().Count > 4 && Bot.GetMonstersInMainZone().Count(card => card != null && !card.IsExtraCard() && card.HasSetcode(0x11c) && card.HasType(CardType.Monster) && card.IsFaceup()) <= 0) return false; if (Bot.GetMonstersInMainZone().Count > 4 && Bot.GetMonstersInMainZone().Count(card => card != null && !card.IsExtraCard() && card.HasSetcode(0x11c) && card.HasType(CardType.Monster) && card.IsFaceup()) <= 0) return false;
List<ClientCard> g_card = Bot.Graveyard.ToList(); List<ClientCard> g_card = Bot.Graveyard.ToList();
...@@ -1148,6 +1153,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1148,6 +1153,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool KnightmareUnicornEffect() private bool KnightmareUnicornEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> cards = new List<ClientCard>(); List<ClientCard> cards = new List<ClientCard>();
cards.AddRange(Enemy.SpellZone); cards.AddRange(Enemy.SpellZone);
cards.AddRange(Enemy.MonsterZone); cards.AddRange(Enemy.MonsterZone);
...@@ -1598,6 +1604,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1598,6 +1604,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
List<ClientCard> banish_cards = new List<ClientCard>(); List<ClientCard> banish_cards = new List<ClientCard>();
List<ClientCard> grave_cards = new List<ClientCard>(); List<ClientCard> grave_cards = new List<ClientCard>();
foreach (var card in Bot.Banished) foreach (var card in Bot.Banished)
...@@ -1792,6 +1799,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1792,6 +1799,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (handActivated) return false; if (handActivated) return false;
handActivated = true; handActivated = true;
activate_ThunderDragonroar = true; activate_ThunderDragonroar = true;
...@@ -2035,6 +2043,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2035,6 +2043,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
if (IsShouldChainTunder()) if (IsShouldChainTunder())
...@@ -2243,6 +2252,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2243,6 +2252,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (HasInZoneNoActivate(CardId.BystialMagnamhut,CardLocation.Deck) && !Bot.HasInHand(CardId.BystialMagnamhut)) if (HasInZoneNoActivate(CardId.BystialMagnamhut,CardLocation.Deck) && !Bot.HasInHand(CardId.BystialMagnamhut))
AI.SelectCard(CardId.BystialMagnamhut); AI.SelectCard(CardId.BystialMagnamhut);
else if(HasInZoneNoActivate(CardId.BystialDruiswurm, CardLocation.Deck) && !Bot.HasInHand(CardId.BystialDruiswurm)) else if(HasInZoneNoActivate(CardId.BystialDruiswurm, CardLocation.Deck) && !Bot.HasInHand(CardId.BystialDruiswurm))
...@@ -2420,6 +2430,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2420,6 +2430,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
if (IsShouldChainTunder()) if (IsShouldChainTunder())
...@@ -2498,6 +2509,7 @@ namespace WindBot.Game.AI.Decks ...@@ -2498,6 +2509,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool NormalThunderDragonEffect() private bool NormalThunderDragonEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
handActivated = true; handActivated = true;
ResetFlag(); ResetFlag();
selectFlag[(int)Select.NormalThunderDragon] = true; selectFlag[(int)Select.NormalThunderDragon] = true;
......
...@@ -192,6 +192,7 @@ namespace WindBot.Game.AI.Decks ...@@ -192,6 +192,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.MonsterZone) if (Card.Location == CardLocation.MonsterZone)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectCard(Monsters.TimeThiefCronocorder); AI.SelectCard(Monsters.TimeThiefCronocorder);
AI.SelectCard(Monsters.TimeThiefWinder); AI.SelectCard(Monsters.TimeThiefWinder);
return true; return true;
...@@ -370,6 +371,7 @@ namespace WindBot.Game.AI.Decks ...@@ -370,6 +371,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool ThunderKingRaiOheff() private bool ThunderKingRaiOheff()
{ {
if (DefaultOnlyHorusSpSummoning()) return false;
if (Duel.SummoningCards.Count > 0) if (Duel.SummoningCards.Count > 0)
{ {
foreach (ClientCard m in Duel.SummoningCards) foreach (ClientCard m in Duel.SummoningCards)
......
...@@ -231,6 +231,7 @@ namespace WindBot.Game.AI.Decks ...@@ -231,6 +231,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (Bot.HasInHand(CardId.DupeFrog)) if (Bot.HasInHand(CardId.DupeFrog))
{ {
AI.SelectCard( AI.SelectCard(
...@@ -267,6 +268,7 @@ namespace WindBot.Game.AI.Decks ...@@ -267,6 +268,7 @@ namespace WindBot.Game.AI.Decks
private bool RonintoadinEffect() private bool RonintoadinEffect()
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
return true; return true;
} }
...@@ -297,6 +299,7 @@ namespace WindBot.Game.AI.Decks ...@@ -297,6 +299,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.CurrentChain.Count > 0) if (Duel.CurrentChain.Count > 0)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
// negate effect, select a cost for it // negate effect, select a cost for it
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
IList<int> suitableCost = new[] { IList<int> suitableCost = new[] {
...@@ -381,6 +384,7 @@ namespace WindBot.Game.AI.Decks ...@@ -381,6 +384,7 @@ namespace WindBot.Game.AI.Decks
} }
else if (Duel.Phase == DuelPhase.Standby) else if (Duel.Phase == DuelPhase.Standby)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
SelectXYZDetach(Card.Overlays); SelectXYZDetach(Card.Overlays);
if (Duel.Player == 0) if (Duel.Player == 0)
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -155,6 +155,7 @@ namespace WindBot.Game.AI.Decks ...@@ -155,6 +155,7 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn() public override void OnNewTurn()
{ {
CardOfDemiseUsed = false; CardOfDemiseUsed = false;
base.OnNewTurn();
} }
public override bool OnSelectYesNo(int desc) public override bool OnSelectYesNo(int desc)
......
...@@ -573,6 +573,7 @@ namespace WindBot.Game.AI.Decks ...@@ -573,6 +573,7 @@ namespace WindBot.Game.AI.Decks
activate_count = 0; activate_count = 0;
summon_count = 0; summon_count = 0;
enemy_activate = false; enemy_activate = false;
base.OnNewTurn();
} }
private bool ZefraProvidenceEffect() private bool ZefraProvidenceEffect()
{ {
......
...@@ -127,6 +127,7 @@ namespace WindBot.Game.AI.Decks ...@@ -127,6 +127,7 @@ namespace WindBot.Game.AI.Decks
TigermortarSpsummoned = false; TigermortarSpsummoned = false;
ChakanineSpsummoned = false; ChakanineSpsummoned = false;
BroadbullSpsummoned = false; BroadbullSpsummoned = false;
base.OnNewTurn();
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
...@@ -150,6 +151,7 @@ namespace WindBot.Game.AI.Decks ...@@ -150,6 +151,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Hand) if (Card.Location == CardLocation.Hand)
{ {
if (DefaultCheckWhetherCardIsNegated(Card)) return false;
if (!(Duel.Phase == DuelPhase.BattleStep if (!(Duel.Phase == DuelPhase.BattleStep
|| Duel.Phase == DuelPhase.BattleStart || Duel.Phase == DuelPhase.BattleStart
|| Duel.Phase == DuelPhase.Damage)) || Duel.Phase == DuelPhase.Damage))
...@@ -429,8 +431,7 @@ namespace WindBot.Game.AI.Decks ...@@ -429,8 +431,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Duel.Phase == DuelPhase.Main1 || Duel.Phase == DuelPhase.Main2) if (Duel.Phase == DuelPhase.Main1 || Duel.Phase == DuelPhase.Main2)
return false; return false;
if (Card.IsDisabled()) if (DefaultCheckWhetherCardIsNegated(Card)) return false;
return false;
ClientCard target = null; ClientCard target = null;
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
foreach (ClientCard monster in monsters) foreach (ClientCard monster in monsters)
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ namespace WindBot.Game ...@@ -15,6 +15,7 @@ namespace WindBot.Game
public int Position { get; set; } public int Position { get; set; }
public int Sequence { get; set; } public int Sequence { get; set; }
public CardLocation Location { get; set; } public CardLocation Location { get; set; }
public CardLocation LastLocation { get; set; }
public int Alias { get; private set; } public int Alias { get; private set; }
public int Level { get; private set; } public int Level { get; private set; }
public int Rank { get; private set; } public int Rank { get; private set; }
...@@ -70,6 +71,7 @@ namespace WindBot.Game ...@@ -70,6 +71,7 @@ namespace WindBot.Game
ActionIndex = new int[16]; ActionIndex = new int[16];
ActionActivateIndex = new Dictionary<int, int>(); ActionActivateIndex = new Dictionary<int, int>();
Location = loc; Location = loc;
LastLocation = 0;
} }
public void SetId(int id) public void SetId(int id)
...@@ -346,7 +348,7 @@ namespace WindBot.Game ...@@ -346,7 +348,7 @@ namespace WindBot.Game
public bool IsOriginalCode(int id) public bool IsOriginalCode(int id)
{ {
return Id == id || Alias - Id < 10 && Alias == id; return Id == id || Alias - Id < 20 && Alias == id;
} }
public bool HasXyzMaterial() public bool HasXyzMaterial()
...@@ -369,6 +371,17 @@ namespace WindBot.Game ...@@ -369,6 +371,17 @@ namespace WindBot.Game
return IsAttack() ? Attack : Defense; return IsAttack() ? Attack : Defense;
} }
public int GetOriginCode()
{
int code = Id;
if (Data != null)
{
if (Data.Alias > 0) code = Data.Alias;
else code = Data.Id;
}
return code;
}
public bool Equals(ClientCard card) public bool Equals(ClientCard card)
{ {
return ReferenceEquals(this, card); return ReferenceEquals(this, card);
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using WindBot.Game.AI; using WindBot.Game.AI;
using YGOSharp.Network; using YGOSharp.Network;
using YGOSharp.Network.Enums; using YGOSharp.Network.Enums;
...@@ -284,6 +285,7 @@ namespace WindBot.Game ...@@ -284,6 +285,7 @@ namespace WindBot.Game
private void OnDuelEnd(BinaryReader packet) private void OnDuelEnd(BinaryReader packet)
{ {
Thread.Sleep(500);
Connection.Close(); Connection.Close();
} }
...@@ -376,15 +378,10 @@ namespace WindBot.Game ...@@ -376,15 +378,10 @@ namespace WindBot.Game
_duel.Fields[GetLocalPlayer(1)].Init(deck, extra); _duel.Fields[GetLocalPlayer(1)].Init(deck, extra);
// in case of ending duel in chain's solving // in case of ending duel in chain's solving
_duel.LastChainPlayer = -1;
_duel.LastChainLocation = 0;
_duel.CurrentChain.Clear(); _duel.CurrentChain.Clear();
_duel.ChainTargets.Clear(); _duel.ChainTargets.Clear();
_duel.LastChainTargets.Clear();
_duel.ChainTargetOnly.Clear(); _duel.ChainTargetOnly.Clear();
_duel.LastSummonPlayer = -1;
_duel.SummoningCards.Clear(); _duel.SummoningCards.Clear();
_duel.LastSummonedCards.Clear();
_duel.SolvingChainIndex = 0; _duel.SolvingChainIndex = 0;
_duel.NegatedChainIndexList.Clear(); _duel.NegatedChainIndexList.Clear();
...@@ -615,6 +612,10 @@ namespace WindBot.Game ...@@ -615,6 +612,10 @@ namespace WindBot.Game
packet.ReadInt32(); // reason packet.ReadInt32(); // reason
ClientCard card = _duel.GetCard(previousControler, (CardLocation)previousLocation, previousSequence); ClientCard card = _duel.GetCard(previousControler, (CardLocation)previousLocation, previousSequence);
if (card != null)
{
card.LastLocation = (CardLocation)previousLocation;
}
if ((previousLocation & (int)CardLocation.Overlay) != 0) if ((previousLocation & (int)CardLocation.Overlay) != 0)
{ {
previousLocation = previousLocation & 0x7f; previousLocation = previousLocation & 0x7f;
...@@ -803,6 +804,7 @@ namespace WindBot.Game ...@@ -803,6 +804,7 @@ namespace WindBot.Game
_duel.ChainTargetOnly.Clear(); _duel.ChainTargetOnly.Clear();
_duel.SolvingChainIndex = 0; _duel.SolvingChainIndex = 0;
_duel.NegatedChainIndexList.Clear(); _duel.NegatedChainIndexList.Clear();
_duel.SummoningCards.Clear();
} }
private void OnCardSorting(BinaryReader packet) private void OnCardSorting(BinaryReader packet)
......
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