Commit bb7f6a1b authored by nanahira's avatar nanahira

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

parents 202c6e67 f79e942c
Pipeline #2670 failed with stages
in 54 seconds
...@@ -20,7 +20,7 @@ namespace WindBot.Game.AI.Decks ...@@ -20,7 +20,7 @@ namespace WindBot.Game.AI.Decks
{ {
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.SummonOrSet); AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
} }
......
...@@ -83,18 +83,10 @@ namespace WindBot.Game.AI.Decks ...@@ -83,18 +83,10 @@ namespace WindBot.Game.AI.Decks
private int m_swapFrogSummoned; private int m_swapFrogSummoned;
private int m_flipFlopFrogSummoned; private int m_flipFlopFrogSummoned;
private int m_treebornFrogCount = 0;
public override void OnNewTurn()
{
m_treebornFrogCount = 0;
base.OnNewTurn();
}
private bool TreebornFrog() private bool TreebornFrog()
{ {
m_treebornFrogCount++; return true;
return m_treebornFrogCount <= 5;
} }
private bool SwapFrogSummon() private bool SwapFrogSummon()
......
...@@ -56,7 +56,7 @@ namespace WindBot.Game.AI.Decks ...@@ -56,7 +56,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, MonsterReborn); AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, MonsterReborn);
AddExecutor(ExecutorType.Summon, CardId.WhiteNightDragon, WhiteNightDragon); AddExecutor(ExecutorType.Summon, CardId.WhiteNightDragon, WhiteNightDragon);
AddExecutor(ExecutorType.Summon, CardId.HorusTheBlackFlameDragonLv6, DefaultTributeSummon); AddExecutor(ExecutorType.Summon, CardId.HorusTheBlackFlameDragonLv6, DefaultMonsterSummon);
AddExecutor(ExecutorType.Summon, CardId.AlexandriteDragon); AddExecutor(ExecutorType.Summon, CardId.AlexandriteDragon);
AddExecutor(ExecutorType.SummonOrSet, CardId.AxeDragonute); AddExecutor(ExecutorType.SummonOrSet, CardId.AxeDragonute);
AddExecutor(ExecutorType.SummonOrSet, CardId.DodgerDragon); AddExecutor(ExecutorType.SummonOrSet, CardId.DodgerDragon);
...@@ -157,7 +157,7 @@ namespace WindBot.Game.AI.Decks ...@@ -157,7 +157,7 @@ namespace WindBot.Game.AI.Decks
if (card.IsCode(11224103)) if (card.IsCode(11224103))
return false; return false;
return DefaultTributeSummon(); return DefaultMonsterSummon();
} }
private bool HorusTheBlackFlameDragonLv8() private bool HorusTheBlackFlameDragonLv8()
......
...@@ -184,7 +184,6 @@ namespace WindBot.Game.AI.Decks ...@@ -184,7 +184,6 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronUsed = false; private bool JetSynchronUsed = false;
private bool ScrapWyvernUsed = false; private bool ScrapWyvernUsed = false;
private bool MaskedChameleonUsed = false; private bool MaskedChameleonUsed = false;
private int ShootingRiserDragonCount = 0;
private int[] HandCosts = new[] private int[] HandCosts = new[]
{ {
...@@ -218,7 +217,6 @@ namespace WindBot.Game.AI.Decks ...@@ -218,7 +217,6 @@ namespace WindBot.Game.AI.Decks
JetSynchronUsed = false; JetSynchronUsed = false;
ScrapWyvernUsed = false; ScrapWyvernUsed = false;
MaskedChameleonUsed = false; MaskedChameleonUsed = false;
ShootingRiserDragonCount = 0;
} }
public override void OnChainEnd() public override void OnChainEnd()
...@@ -845,9 +843,8 @@ namespace WindBot.Game.AI.Decks ...@@ -845,9 +843,8 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (Duel.LastChainPlayer == 0 || ShootingRiserDragonCount >= 10) if (Duel.LastChainPlayer == 0)
return false; return false;
ShootingRiserDragonCount++;
AI.SelectCard(new[] { AI.SelectCard(new[] {
CardId.BlackRoseMoonlightDragon, CardId.BlackRoseMoonlightDragon,
CardId.ScrapDragon, CardId.ScrapDragon,
......
...@@ -230,7 +230,6 @@ namespace WindBot.Game.AI.Decks ...@@ -230,7 +230,6 @@ namespace WindBot.Game.AI.Decks
} }
int Ultimate_ss = 0; int Ultimate_ss = 0;
int Enemy_atk = 0; int Enemy_atk = 0;
int TG_WonderMagician_count = 0;
bool Pillused = false; bool Pillused = false;
bool CrystronNeedlefibereff_used = false; bool CrystronNeedlefibereff_used = false;
bool OvertexCoatlseff_used = false; bool OvertexCoatlseff_used = false;
...@@ -275,7 +274,6 @@ namespace WindBot.Game.AI.Decks ...@@ -275,7 +274,6 @@ namespace WindBot.Game.AI.Decks
ShaddollSquamata_used = false; ShaddollSquamata_used = false;
ShaddollDragon_used = false; ShaddollDragon_used = false;
ShaddollHedgehog_used = false; ShaddollHedgehog_used = false;
TG_WonderMagician_count = 0;
} }
private bool Luminasummon() private bool Luminasummon()
...@@ -576,8 +574,7 @@ namespace WindBot.Game.AI.Decks ...@@ -576,8 +574,7 @@ namespace WindBot.Game.AI.Decks
private bool TG_WonderMagicianeff() private bool TG_WonderMagicianeff()
{ {
TG_WonderMagician_count++; return true;
return TG_WonderMagician_count <= 10;
} }
private bool AllureofDarkness() private bool AllureofDarkness()
{ {
......
...@@ -12,10 +12,14 @@ namespace WindBot.Game.AI.Decks ...@@ -12,10 +12,14 @@ namespace WindBot.Game.AI.Decks
public LuckyExecutor(GameAI ai, Duel duel) public LuckyExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.Activate, ImFeelingLucky); AddExecutor(ExecutorType.Activate, ImFeelingLucky);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLucky); AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.SpellSet, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, ImFeelingUnlucky);
AddExecutor(ExecutorType.Activate, ImFeelingUnlucky);
AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, _CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon); AddExecutor(ExecutorType.Activate, _CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
...@@ -90,9 +94,25 @@ namespace WindBot.Game.AI.Decks ...@@ -90,9 +94,25 @@ namespace WindBot.Game.AI.Decks
return Program.Rand.Next(options.Count); return Program.Rand.Next(options.Count);
} }
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (cardData != null)
{
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
private bool ImFeelingLucky() private bool ImFeelingLucky()
{ {
return Program.Rand.Next(9) >= 3 && DefaultDontChainMyself(); return Program.Rand.Next(9) >= 6 && DefaultDontChainMyself();
}
private bool ImFeelingUnlucky()
{
return DefaultDontChainMyself();
} }
} }
} }
\ No newline at end of file
...@@ -46,8 +46,8 @@ namespace WindBot.Game.AI.Decks ...@@ -46,8 +46,8 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.SwordsOfRevealingLight, SwordsOfRevealingLight); AddExecutor(ExecutorType.Activate, CardId.SwordsOfRevealingLight, SwordsOfRevealingLight);
AddExecutor(ExecutorType.Activate, CardId.DoubleSummon, DoubleSummon); AddExecutor(ExecutorType.Activate, CardId.DoubleSummon, DoubleSummon);
AddExecutor(ExecutorType.Summon, CardId.AncientGearGolem, DefaultTributeSummon); AddExecutor(ExecutorType.Summon, CardId.AncientGearGolem, DefaultMonsterSummon);
AddExecutor(ExecutorType.Summon, CardId.Frostosaurus, DefaultTributeSummon); AddExecutor(ExecutorType.Summon, CardId.Frostosaurus, DefaultMonsterSummon);
AddExecutor(ExecutorType.SummonOrSet, CardId.AlexandriteDragon); AddExecutor(ExecutorType.SummonOrSet, CardId.AlexandriteDragon);
AddExecutor(ExecutorType.SummonOrSet, CardId.GeneWarpedWarwolf); AddExecutor(ExecutorType.SummonOrSet, CardId.GeneWarpedWarwolf);
AddExecutor(ExecutorType.MonsterSet, CardId.GearGolemTheMovingFortress); AddExecutor(ExecutorType.MonsterSet, CardId.GearGolemTheMovingFortress);
......
...@@ -181,7 +181,6 @@ namespace WindBot.Game.AI.Decks ...@@ -181,7 +181,6 @@ namespace WindBot.Game.AI.Decks
private bool CymbalSkeletonUsed = false; private bool CymbalSkeletonUsed = false;
private bool BorrelswordDragonUsed = false; private bool BorrelswordDragonUsed = false;
private ClientCard RustyBardicheTarget = null; private ClientCard RustyBardicheTarget = null;
private int ShootingRiserDragonCount = 0;
private int[] HandCosts = new[] private int[] HandCosts = new[]
{ {
...@@ -215,7 +214,6 @@ namespace WindBot.Game.AI.Decks ...@@ -215,7 +214,6 @@ namespace WindBot.Game.AI.Decks
CymbalSkeletonUsed = false; CymbalSkeletonUsed = false;
BorrelswordDragonUsed = false; BorrelswordDragonUsed = false;
RustyBardicheTarget = null; RustyBardicheTarget = null;
ShootingRiserDragonCount = 0;
} }
public override void OnChainEnd() public override void OnChainEnd()
...@@ -611,10 +609,7 @@ namespace WindBot.Game.AI.Decks ...@@ -611,10 +609,7 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (Duel.LastChainPlayer == 0) return Duel.LastChainPlayer != 0;
return false;
ShootingRiserDragonCount++;
return ShootingRiserDragonCount <= 10;
} }
} }
...@@ -825,8 +820,8 @@ namespace WindBot.Game.AI.Decks ...@@ -825,8 +820,8 @@ namespace WindBot.Game.AI.Decks
if (ActivateDescription == 96) if (ActivateDescription == 96)
{ {
// TODO: more FogBlade lost target // TODO: more FogBlade lost target
if ((Duel.Phase == DuelPhase.Main1 || Duel.Phase == DuelPhase.Main2) && Duel.CurrentChain.Count == 0) if ((Duel.Phase == DuelPhase.Main1 || Duel.Phase == DuelPhase.Main2) && Duel.CurrentChain.Count == 0)
return false; return false;
AI.SelectCard(CardId.OrcustCymbalSkeleton); AI.SelectCard(CardId.OrcustCymbalSkeleton);
return true; return true;
} }
...@@ -1130,22 +1125,22 @@ namespace WindBot.Game.AI.Decks ...@@ -1130,22 +1125,22 @@ namespace WindBot.Game.AI.Decks
{ {
return Duel.LastChainPlayer == 1; return Duel.LastChainPlayer == 1;
} }
else if (Duel.Phase == DuelPhase.End) else if (Duel.Phase == DuelPhase.End)
{ {
ClientCard target = null; ClientCard target = null;
target = Bot.Banished.GetFirstMatchingFaceupCard(card=>card.IsCode(CardId.OrcustCymbalSkeleton)); target = Bot.Banished.GetFirstMatchingFaceupCard(card=>card.IsCode(CardId.OrcustCymbalSkeleton));
if (target == null) if (target == null)
target = Bot.Banished.GetFirstMatchingFaceupCard(card => card.IsCode(CardId.OrcustHarpHorror)); target = Bot.Banished.GetFirstMatchingFaceupCard(card => card.IsCode(CardId.OrcustHarpHorror));
if (target != null) if (target != null)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
} }
if(!Bot.HasInHand(CardId.OrcustHarpHorror) && Bot.GetRemainingCount(CardId.OrcustHarpHorror, 2) > 1) if(!Bot.HasInHand(CardId.OrcustHarpHorror) && Bot.GetRemainingCount(CardId.OrcustHarpHorror, 2) > 1)
{ {
AI.SelectCard(CardId.OrcustHarpHorror); AI.SelectCard(CardId.OrcustHarpHorror);
return true; return true;
} }
} }
return false; return false;
} }
......
...@@ -117,13 +117,11 @@ namespace WindBot.Game.AI.Decks ...@@ -117,13 +117,11 @@ namespace WindBot.Game.AI.Decks
bool summon_used = false; bool summon_used = false;
bool CardOfDemiseeff_used = false; bool CardOfDemiseeff_used = false;
bool SeaStealthAttackeff_used = false; bool SeaStealthAttackeff_used = false;
int City_count = 0;
public override void OnNewTurn() public override void OnNewTurn()
{ {
summon_used = false; summon_used = false;
CardOfDemiseeff_used = false; CardOfDemiseeff_used = false;
SeaStealthAttackeff_used = false; SeaStealthAttackeff_used = false;
City_count = 0;
base.OnNewTurn(); base.OnNewTurn();
} }
private bool PreventFeatherDustereff() private bool PreventFeatherDustereff()
...@@ -356,9 +354,6 @@ namespace WindBot.Game.AI.Decks ...@@ -356,9 +354,6 @@ namespace WindBot.Game.AI.Decks
} }
else else
{ {
if (City_count > 10)
return false;
ClientCard target = null; ClientCard target = null;
foreach(ClientCard s in Bot.GetSpells()) foreach(ClientCard s in Bot.GetSpells())
{ {
...@@ -380,7 +375,6 @@ namespace WindBot.Game.AI.Decks ...@@ -380,7 +375,6 @@ namespace WindBot.Game.AI.Decks
break; break;
} }
} }
City_count++;
AI.SelectPlace(Zones.z1 | Zones.z3); AI.SelectPlace(Zones.z1 | Zones.z3);
AI.SelectCard(CardId.PhantasmSprialBattle); AI.SelectCard(CardId.PhantasmSprialBattle);
return true; return true;
......
...@@ -215,8 +215,7 @@ namespace WindBot.Game.AI.Decks ...@@ -215,8 +215,7 @@ namespace WindBot.Game.AI.Decks
private bool Summon_used; private bool Summon_used;
private bool Pilica_eff; private bool Pilica_eff;
private bool plan_A; private bool plan_A;
private int SnowBell_count = 0;
//TODO: reset the flags when they should reset ( public override void OnNewTurn() )
public PureWindsExecutor(GameAI ai, Duel duel) public PureWindsExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
...@@ -302,7 +301,6 @@ namespace WindBot.Game.AI.Decks ...@@ -302,7 +301,6 @@ namespace WindBot.Game.AI.Decks
Summon_used = false; Summon_used = false;
Pilica_eff = false; Pilica_eff = false;
plan_A = false; plan_A = false;
SnowBell_count = 0;
base.OnNewTurn(); base.OnNewTurn();
} }
private bool windaset() private bool windaset()
...@@ -770,7 +768,6 @@ namespace WindBot.Game.AI.Decks ...@@ -770,7 +768,6 @@ namespace WindBot.Game.AI.Decks
private bool WindwitchSnowBellsp() private bool WindwitchSnowBellsp()
{ {
if (SnowBell_count >= 5) return false;
if ((Bot.HasInMonstersZone(CardId.CrystalWingSynchroDragon) || if ((Bot.HasInMonstersZone(CardId.CrystalWingSynchroDragon) ||
Bot.HasInMonstersZone(CardId.DaigustoSphreez) || Bot.HasInMonstersZone(CardId.DaigustoSphreez) ||
Bot.HasInMonstersZone(CardId.MistWurm)) && Bot.HasInMonstersZone(CardId.MistWurm)) &&
...@@ -786,7 +783,6 @@ namespace WindBot.Game.AI.Decks ...@@ -786,7 +783,6 @@ namespace WindBot.Game.AI.Decks
(Util.GetBotAvailZonesFromExtraDeck() == 0)) (Util.GetBotAvailZonesFromExtraDeck() == 0))
return false; return false;
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
SnowBell_count++;
return true; return true;
} }
private bool DaigustoSphreezsp() private bool DaigustoSphreezsp()
......
...@@ -73,7 +73,6 @@ namespace WindBot.Game.AI.Decks ...@@ -73,7 +73,6 @@ namespace WindBot.Game.AI.Decks
bool snake_four_s = false; bool snake_four_s = false;
bool tuner_eff_used = false; bool tuner_eff_used = false;
bool crystal_eff_used = false; bool crystal_eff_used = false;
int red_ss_count = 0;
bool white_eff_used = false; bool white_eff_used = false;
bool lockbird_useful = false; bool lockbird_useful = false;
bool lockbird_used = false; bool lockbird_used = false;
...@@ -758,7 +757,6 @@ namespace WindBot.Game.AI.Decks ...@@ -758,7 +757,6 @@ namespace WindBot.Game.AI.Decks
public bool Red_ss() public bool Red_ss()
{ {
if (red_ss_count >= 6) return false;
if ((Util.ChainContainsCard(CardId.DarkHole) || Util.ChainContainsCard(99330325) || Util.ChainContainsCard(53582587)) && Util.ChainContainsCard(CardId.Red)) return false; if ((Util.ChainContainsCard(CardId.DarkHole) || Util.ChainContainsCard(99330325) || Util.ChainContainsCard(53582587)) && Util.ChainContainsCard(CardId.Red)) return false;
if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Red)) if (Duel.LastChainPlayer == 0 && Util.GetLastChainCard().IsCode(CardId.Red))
{ {
...@@ -766,7 +764,6 @@ namespace WindBot.Game.AI.Decks ...@@ -766,7 +764,6 @@ namespace WindBot.Game.AI.Decks
{ {
if (Util.IsChainTarget(m) && IsTrickstar(m.Id)) if (Util.IsChainTarget(m) && IsTrickstar(m.Id))
{ {
red_ss_count += 1;
AI.SelectCard(m); AI.SelectCard(m);
Red_SelectPos(); Red_SelectPos();
return true; return true;
...@@ -789,7 +786,6 @@ namespace WindBot.Game.AI.Decks ...@@ -789,7 +786,6 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectCard(c); AI.SelectCard(c);
Red_SelectPos(c); Red_SelectPos(c);
red_ss_count += 1;
return true; return true;
} }
if (c.IsCode(CardId.Pink)) return false; if (c.IsCode(CardId.Pink)) return false;
...@@ -800,14 +796,12 @@ namespace WindBot.Game.AI.Decks ...@@ -800,14 +796,12 @@ namespace WindBot.Game.AI.Decks
if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence); if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c); AI.SelectCard(c);
Red_SelectPos(c); Red_SelectPos(c);
red_ss_count += 1;
return true; return true;
} }
if (!Bot.HasInHand(CardId.White) && tosolve_enemy.Attack <= 3200 && c.IsCode(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);
red_ss_count += 1;
return true; return true;
} }
if (!Bot.HasInHand(CardId.White) && c.Attack < tosolve_enemy.Attack) if (!Bot.HasInHand(CardId.White) && c.Attack < tosolve_enemy.Attack)
...@@ -824,7 +818,6 @@ namespace WindBot.Game.AI.Decks ...@@ -824,7 +818,6 @@ namespace WindBot.Game.AI.Decks
if (tosolve_enemy.Attack > 1600) AI.SelectPosition(CardPosition.FaceUpDefence); if (tosolve_enemy.Attack > 1600) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c); AI.SelectCard(c);
Red_SelectPos(c); Red_SelectPos(c);
red_ss_count += 1;
return true; return true;
} }
} }
...@@ -845,7 +838,6 @@ namespace WindBot.Game.AI.Decks ...@@ -845,7 +838,6 @@ namespace WindBot.Game.AI.Decks
{ {
AI.SelectCard(card); AI.SelectCard(card);
Red_SelectPos(card); Red_SelectPos(card);
red_ss_count += 1;
return true; return true;
} }
} }
...@@ -1710,7 +1702,6 @@ namespace WindBot.Game.AI.Decks ...@@ -1710,7 +1702,6 @@ namespace WindBot.Game.AI.Decks
pink_ss = false; pink_ss = false;
snake_four_s = false; snake_four_s = false;
crystal_eff_used = false; crystal_eff_used = false;
red_ss_count = 0;
white_eff_used = false; white_eff_used = false;
lockbird_useful = false; lockbird_useful = false;
lockbird_used = false; lockbird_used = false;
......
...@@ -197,7 +197,6 @@ namespace WindBot.Game.AI.Decks ...@@ -197,7 +197,6 @@ namespace WindBot.Game.AI.Decks
bool MagicianRightHand_used = false; bool MagicianRightHand_used = false;
ClientCard MagiciansLeftHand_negate = null; ClientCard MagiciansLeftHand_negate = null;
ClientCard MagicianRightHand_negate = null; ClientCard MagicianRightHand_negate = null;
int PSYOmega_count = 0;
// go first // go first
public override bool OnSelectHand() public override bool OnSelectHand()
...@@ -271,7 +270,6 @@ namespace WindBot.Game.AI.Decks ...@@ -271,7 +270,6 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn() public override void OnNewTurn()
{ {
CrossoutDesignatorTarget = 0; CrossoutDesignatorTarget = 0;
PSYOmega_count = 0;
MadameVerreGainedATK = false; MadameVerreGainedATK = false;
summoned = false; summoned = false;
enemy_activate_MaxxC = false; enemy_activate_MaxxC = false;
...@@ -2501,20 +2499,15 @@ namespace WindBot.Game.AI.Decks ...@@ -2501,20 +2499,15 @@ namespace WindBot.Game.AI.Decks
// recycle from grave // recycle from grave
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
if (PSYOmega_count >= 5){
return false;
}
List<ClientCard> enemy_danger = CheckDangerousCardinEnemyGrave(); List<ClientCard> enemy_danger = CheckDangerousCardinEnemyGrave();
if (enemy_danger.Count > 0) if (enemy_danger.Count > 0)
{ {
AI.SelectCard(enemy_danger); AI.SelectCard(enemy_danger);
PSYOmega_count ++;
return true; return true;
} }
if (!Bot.HasInHandOrInSpellZoneOrInGraveyard(CardId.Holiday) && Bot.HasInGraveyard(important_witchcraft)) if (!Bot.HasInHandOrInSpellZoneOrInGraveyard(CardId.Holiday) && Bot.HasInGraveyard(important_witchcraft))
{ {
AI.SelectCard(important_witchcraft); AI.SelectCard(important_witchcraft);
PSYOmega_count ++;
return true; return true;
} }
if (CheckProblematicCards() == null) if (CheckProblematicCards() == null)
...@@ -2523,7 +2516,6 @@ namespace WindBot.Game.AI.Decks ...@@ -2523,7 +2516,6 @@ namespace WindBot.Game.AI.Decks
CardId.MaxxC, CardId.AshBlossom_JoyousSpring, CardId.MaxxC, CardId.AshBlossom_JoyousSpring,
CardId.MagicianRightHand, CardId.MagiciansLeftHand, CardId.MagiciansRestage, CardId.Patronus, CardId.MagicianRightHand, CardId.MagiciansLeftHand, CardId.MagiciansRestage, CardId.Patronus,
CardId.LightningStorm, CardId.Reasoning); CardId.LightningStorm, CardId.Reasoning);
PSYOmega_count ++;
return true; return true;
} }
} }
......
...@@ -100,6 +100,7 @@ namespace WindBot.Game.AI.Decks ...@@ -100,6 +100,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.Goblindbergh); AddExecutor(ExecutorType.Summon, CardId.Goblindbergh);
AddExecutor(ExecutorType.Summon, CardId.TinGoldfish); AddExecutor(ExecutorType.Summon, CardId.TinGoldfish);
AddExecutor(ExecutorType.Summon, CardId.SummonerMonk); AddExecutor(ExecutorType.Summon, CardId.SummonerMonk);
AddExecutor(ExecutorType.Summon, CardId.Honest);
// Summons: Effects // Summons: Effects
AddExecutor(ExecutorType.Activate, CardId.Goblindbergh, GoblindberghEffect); AddExecutor(ExecutorType.Activate, CardId.Goblindbergh, GoblindberghEffect);
...@@ -122,13 +123,6 @@ namespace WindBot.Game.AI.Decks ...@@ -122,13 +123,6 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike); AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, DefaultSolemnStrike);
} }
private int ZwCount = 0;
public override void OnNewTurn()
{
ZwCount = 0;
}
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
return false; return false;
...@@ -177,8 +171,7 @@ namespace WindBot.Game.AI.Decks ...@@ -177,8 +171,7 @@ namespace WindBot.Game.AI.Decks
private bool ZwWeapon() private bool ZwWeapon()
{ {
ZwCount++; return true;
return ZwCount < 10;
} }
private bool ReinforcementOfTheArmy() private bool ReinforcementOfTheArmy()
......
...@@ -47,7 +47,6 @@ namespace WindBot.Game.AI.Decks ...@@ -47,7 +47,6 @@ namespace WindBot.Game.AI.Decks
bool TigermortarSpsummoned = false; bool TigermortarSpsummoned = false;
bool ChakanineSpsummoned = false; bool ChakanineSpsummoned = false;
bool BroadbullSpsummoned = false; bool BroadbullSpsummoned = false;
int WhiptailEffectCount = 0;
public ZoodiacExecutor(GameAI ai, Duel duel) public ZoodiacExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
...@@ -128,7 +127,6 @@ namespace WindBot.Game.AI.Decks ...@@ -128,7 +127,6 @@ namespace WindBot.Game.AI.Decks
TigermortarSpsummoned = false; TigermortarSpsummoned = false;
ChakanineSpsummoned = false; ChakanineSpsummoned = false;
BroadbullSpsummoned = false; BroadbullSpsummoned = false;
WhiptailEffectCount = 0;
} }
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
...@@ -431,7 +429,7 @@ namespace WindBot.Game.AI.Decks ...@@ -431,7 +429,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() || WhiptailEffectCount >= 3) if (Card.IsDisabled())
return false; return false;
ClientCard target = null; ClientCard target = null;
List<ClientCard> monsters = Bot.GetMonsters(); List<ClientCard> monsters = Bot.GetMonsters();
...@@ -461,7 +459,6 @@ namespace WindBot.Game.AI.Decks ...@@ -461,7 +459,6 @@ namespace WindBot.Game.AI.Decks
CardId.Drident CardId.Drident
}); });
} }
WhiptailEffectCount++;
return true; return true;
} }
......
...@@ -105,8 +105,6 @@ namespace WindBot.Game.AI ...@@ -105,8 +105,6 @@ namespace WindBot.Game.AI
public const int lightningStorm = 14532163; public const int lightningStorm = 14532163;
} }
int HonestEffectCount = 0;
protected DefaultExecutor(GameAI ai, Duel duel) protected DefaultExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
...@@ -263,9 +261,12 @@ namespace WindBot.Game.AI ...@@ -263,9 +261,12 @@ namespace WindBot.Game.AI
return false; return false;
} }
public override void OnNewTurn() /// <summary>
/// Set when this card can't beat the enemies
/// </summary>
public override bool OnSelectMonsterSummonOrSet(ClientCard card)
{ {
HonestEffectCount = 0; return card.Level <= 4 && Util.IsAllEnemyBetter(true) && Util.IsAllEnemyBetterThanValue(card.Attack + 300, false);
} }
/// <summary> /// <summary>
...@@ -647,10 +648,13 @@ namespace WindBot.Game.AI ...@@ -647,10 +648,13 @@ namespace WindBot.Game.AI
} }
/// <summary> /// <summary>
/// Summon with tributes ATK lower. /// Summon with no tribute, or with tributes ATK lower.
/// </summary> /// </summary>
protected bool DefaultTributeSummon() protected bool DefaultMonsterSummon()
{ {
if (Card.Level <= 4)
return true;
if (!UniqueFaceupMonster()) if (!UniqueFaceupMonster())
return false; return false;
int tributecount = (int)Math.Ceiling((Card.Level - 4.0d) / 2.0d); int tributecount = (int)Math.Ceiling((Card.Level - 4.0d) / 2.0d);
...@@ -785,6 +789,8 @@ namespace WindBot.Game.AI ...@@ -785,6 +789,8 @@ namespace WindBot.Game.AI
/// </summary> /// </summary>
protected bool DefaultDontChainMyself() protected bool DefaultDontChainMyself()
{ {
if (Type != ExecutorType.Activate)
return true;
if (Executors.Any(exec => exec.Type == Type && exec.CardId == Card.Id)) if (Executors.Any(exec => exec.Type == Type && exec.CardId == Card.Id))
return false; return false;
return Duel.LastChainPlayer != 0; return Duel.LastChainPlayer != 0;
...@@ -797,6 +803,8 @@ namespace WindBot.Game.AI ...@@ -797,6 +803,8 @@ namespace WindBot.Game.AI
{ {
if (Executors.Count(exec => exec.Type == Type && exec.CardId == Card.Id) > 1) if (Executors.Count(exec => exec.Type == Type && exec.CardId == Card.Id) > 1)
return false; return false;
if (Card.IsFacedown())
return true;
if (Bot.LifePoints <= 1000) if (Bot.LifePoints <= 1000)
return false; return false;
if (Bot.LifePoints <= Enemy.LifePoints && ActivateDescription == Util.GetStringId(_CardId.ChickenGame, 0)) if (Bot.LifePoints <= Enemy.LifePoints && ActivateDescription == Util.GetStringId(_CardId.ChickenGame, 0))
...@@ -1110,13 +1118,7 @@ namespace WindBot.Game.AI ...@@ -1110,13 +1118,7 @@ namespace WindBot.Game.AI
|| ((Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Defense) && (Bot.BattlingMonster.Attack + Enemy.BattlingMonster.Attack > Enemy.BattlingMonster.Defense))); || ((Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Defense) && (Bot.BattlingMonster.Attack + Enemy.BattlingMonster.Attack > Enemy.BattlingMonster.Defense)));
} }
if (Util.IsTurn1OrMain2() && HonestEffectCount <= 5) return Util.IsTurn1OrMain2();
{
HonestEffectCount++;
return true;
}
return false;
} }
protected bool DefaultLightingStorm() protected bool DefaultLightingStorm()
......
...@@ -188,6 +188,16 @@ namespace WindBot.Game.AI ...@@ -188,6 +188,16 @@ namespace WindBot.Game.AI
return false; return false;
} }
/// <summary>
/// Called when the executor type is SummonOrSet
/// </summary>
/// <returns>True if select to set the monster.</returns>
public virtual bool OnSelectMonsterSummonOrSet(ClientCard card)
{
// Overrided in DefalultExecutor
return false;
}
/// <summary> /// <summary>
/// Called when bot is going to annouce a card /// Called when bot is going to annouce a card
/// </summary> /// </summary>
......
...@@ -13,12 +13,16 @@ namespace WindBot.Game ...@@ -13,12 +13,16 @@ namespace WindBot.Game
private Dialogs _dialogs; private Dialogs _dialogs;
// record activated count to prevent infinite actions
private Dictionary<int, int> _activatedCards;
public GameAI(GameClient game, Duel duel) public GameAI(GameClient game, Duel duel)
{ {
Game = game; Game = game;
Duel = duel; Duel = duel;
_dialogs = new Dialogs(game); _dialogs = new Dialogs(game);
_activatedCards = new Dictionary<int, int>();
} }
/// <summary> /// <summary>
...@@ -81,6 +85,7 @@ namespace WindBot.Game ...@@ -81,6 +85,7 @@ namespace WindBot.Game
/// </summary> /// </summary>
public void OnNewTurn() public void OnNewTurn()
{ {
_activatedCards.Clear();
Executor.OnNewTurn(); Executor.OnNewTurn();
} }
...@@ -439,8 +444,7 @@ namespace WindBot.Game ...@@ -439,8 +444,7 @@ namespace WindBot.Game
} }
if (ShouldExecute(exec, card, ExecutorType.SummonOrSet)) if (ShouldExecute(exec, card, ExecutorType.SummonOrSet))
{ {
if (Executor.Util.IsAllEnemyBetter(true) && Executor.Util.IsAllEnemyBetterThanValue(card.Attack + 300, false) && if (main.MonsterSetableCards.Contains(card) && Executor.OnSelectMonsterSummonOrSet(card))
main.MonsterSetableCards.Contains(card))
{ {
_dialogs.SendSetMonster(); _dialogs.SendSetMonster();
return new MainPhaseAction(MainPhaseAction.MainAction.SetMonster, card.ActionIndex); return new MainPhaseAction(MainPhaseAction.MainAction.SetMonster, card.ActionIndex);
...@@ -448,7 +452,7 @@ namespace WindBot.Game ...@@ -448,7 +452,7 @@ namespace WindBot.Game
_dialogs.SendSummon(card.Name); _dialogs.SendSummon(card.Name);
return new MainPhaseAction(MainPhaseAction.MainAction.Summon, card.ActionIndex); return new MainPhaseAction(MainPhaseAction.MainAction.Summon, card.ActionIndex);
} }
} }
foreach (ClientCard card in main.SpellSetableCards) foreach (ClientCard card in main.SpellSetableCards)
{ {
if (ShouldExecute(exec, card, ExecutorType.SpellSet)) if (ShouldExecute(exec, card, ExecutorType.SpellSet))
...@@ -1107,11 +1111,28 @@ namespace WindBot.Game ...@@ -1107,11 +1111,28 @@ namespace WindBot.Game
private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1) private bool ShouldExecute(CardExecutor exec, ClientCard card, ExecutorType type, int desc = -1)
{ {
if (card.Id != 0 && type == ExecutorType.Activate &&
_activatedCards.ContainsKey(card.Id) && _activatedCards[card.Id] >= 9)
{
return false;
}
Executor.SetCard(type, card, desc); Executor.SetCard(type, card, desc);
return card != null && bool result = card != null && exec.Type == type &&
exec.Type == type && (exec.CardId == -1 || exec.CardId == card.Id) &&
(exec.CardId == -1 || exec.CardId == card.Id) && (exec.Func == null || exec.Func());
(exec.Func == null || exec.Func()); if (card.Id != 0 && type == ExecutorType.Activate && result)
{
int count = card.IsDisabled() ? 3 : 1;
if (!_activatedCards.ContainsKey(card.Id))
{
_activatedCards.Add(card.Id, count);
}
else
{
_activatedCards[card.Id] += count;
}
}
return result;
} }
} }
} }
...@@ -1095,7 +1095,7 @@ namespace WindBot.Game ...@@ -1095,7 +1095,7 @@ namespace WindBot.Game
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
packet.ReadByte(); // flag packet.ReadByte(); // flag
packet.ReadInt32(); // card id int id = packet.ReadInt32();
int con = GetLocalPlayer(packet.ReadByte()); int con = GetLocalPlayer(packet.ReadByte());
int loc = packet.ReadByte(); int loc = packet.ReadByte();
int seq = packet.ReadByte(); int seq = packet.ReadByte();
...@@ -1106,7 +1106,12 @@ namespace WindBot.Game ...@@ -1106,7 +1106,12 @@ namespace WindBot.Game
{ {
desc = 0; desc = 0;
} }
cards.Add(_duel.GetCard(con, loc, seq, sseq));
ClientCard card = _duel.GetCard(con, loc, seq, sseq);
if (card.Id == 0)
card.SetId(id);
cards.Add(card);
descs.Add(desc); descs.Add(desc);
} }
......
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