Commit 638feefb authored by mercury233's avatar mercury233

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

parents 47404a59 a829ae8c
#created by ...
#main
89631139
55410871
89631139
80701178
31036355
38517737
80701178
80701178
95492061
95492061
95492061
53303460
53303460
53303460
14558127
14558127
23434538
55410871
55410871
31036355
31036355
48800175
48800175
48800175
70368879
70368879
70368879
21082832
46052429
46052429
46052429
24224830
24224830
24224830
73915051
10045474
10045474
37576645
37576645
37576645
#extra
31833038
85289965
74997493
5043010
65330383
38342335
2857636
28776350
75452921
3987233
3987233
99111753
98978921
41999284
41999284
!side
75732622
15397015
15397015
73642296
23434538
5821478
77058170
3679218
25774450
43898403
23002292
23002292
84749824
84749824
#created by ...
#main
81823360
81823360
81823360
14558127
14558127
63845230
18144506
35261759
35261759
47325505
47325505
59750328
59750328
59750328
73628505
98645731
98645731
98645731
73915051
73915051
2819435
2819435
2819435
10045474
34302287
34302287
34302287
47475363
58120309
61397885
61397885
89208725
89208725
19089195
19089195
19089195
53334471
53334471
82732705
99188141
#extra
44508094
5821478
31833038
85289965
65330383
72529749
61665245
38342335
2857636
75452921
50588353
3987233
98978921
41999284
41999284
!side
24094258
47475363
61397885
30241314
30241314
82732705
...@@ -41,6 +41,19 @@ namespace WindBot.Game.AI ...@@ -41,6 +41,19 @@ namespace WindBot.Game.AI
return 1; return 1;
} }
/// <summary>
/// Get the total ATK Monster of the player.
/// </summary>
public int GetTotalAttackingMonsterAttack(int player)
{
int atk = 0;
foreach (ClientCard m in Duel.Fields[player].GetMonsters())
{
if (m.IsAttack())
atk += m.Attack;
}
return atk;
}
/// <summary> /// <summary>
/// Get the best ATK or DEF power of the field. /// Get the best ATK or DEF power of the field.
/// </summary> /// </summary>
......
...@@ -63,7 +63,7 @@ namespace WindBot.Game.AI ...@@ -63,7 +63,7 @@ namespace WindBot.Game.AI
break; break;
case SelectType.Cards: case SelectType.Cards:
foreach (ClientCard card in _cards) foreach (ClientCard card in _cards)
if (cards.Contains(card)) if (cards.Contains(card) && !result.Contains(card))
result.Add(card); result.Add(card);
break; break;
case SelectType.Id: case SelectType.Id:
...@@ -74,7 +74,7 @@ namespace WindBot.Game.AI ...@@ -74,7 +74,7 @@ namespace WindBot.Game.AI
case SelectType.Ids: case SelectType.Ids:
foreach (int id in _ids) foreach (int id in _ids)
foreach (ClientCard card in cards) foreach (ClientCard card in cards)
if (card.Id == id) if (card.Id == id && !result.Contains(card))
result.Add(card); result.Add(card);
break; break;
case SelectType.Location: case SelectType.Location:
......
...@@ -1135,7 +1135,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1135,7 +1135,7 @@ namespace WindBot.Game.AI.Decks
} }
if (!AI.Utils.IsTurn1OrMain2()) if (!AI.Utils.IsTurn1OrMain2())
{ {
ClientCard self_best = AI.Utils.GetBestBotMonster(true); ClientCard self_best = AI.Utils.GetBestBotMonster();
ClientCard enemy_best = AI.Utils.GetProblematicEnemyCard(self_best.Attack + 1, true); ClientCard enemy_best = AI.Utils.GetProblematicEnemyCard(self_best.Attack + 1, true);
ClientCard enemy_target = GetProblematicEnemyCard_Alter(true,false); ClientCard enemy_target = GetProblematicEnemyCard_Alter(true,false);
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("BlueEyesMaxDragon", "AI_BlueEyesMaxDragon", "Normal")]
public class BlueEyesMaxDragonExecutor : DefaultExecutor
{
public class CardId
{
public const int BlueEyesWhiteDragon = 89631139;
public const int BlueEyesAlternativeWhiteDragon = 38517737;
public const int DeviritualTalismandra = 80701178;
public const int ManguOfTheTenTousandHands = 95492061;
public const int DevirrtualCandoll = 53303460;
public const int AshBlossom = 14558127;
public const int MaxxC = 23434538;
public const int BlueEyesChaosMaxDragon = 55410871;
public const int CreatureSwap= 31036355;
public const int TheMelodyOfAwakeningDragon = 48800175;
public const int UpstartGoblin = 70368879;
public const int ChaosForm = 21082832;
public const int AdvancedRitualArt = 46052429;
public const int CalledByTheGrave = 24224830;
public const int Scapegoat = 73915051;
public const int InfiniteImpermanence = 10045474;
public const int RecklessGreed = 37576645;
public const int BorreloadDragon = 31833038;
public const int BirrelswordDragon = 85289965;
public const int KnightmareGryphon = 65330383;
public const int MissusRadiant = 3987233;
public const int LinkSpider = 98978921;
public const int Linkuriboh = 41999284;
public const int LockBird = 94145021;
public const int Ghost = 59438930;
}
public BlueEyesMaxDragonExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
//counter
AddExecutor(ExecutorType.Activate, CardId.AshBlossom, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, CardId.MaxxC, MaxxCeff);
AddExecutor(ExecutorType.Activate, CardId.InfiniteImpermanence, DefaultInfiniteImpermanence);
AddExecutor(ExecutorType.Activate, CardId.CalledByTheGrave, CalledByTheGraveeff);
//first
AddExecutor(ExecutorType.Activate, CardId.UpstartGoblin);
AddExecutor(ExecutorType.Activate, CardId.BlueEyesAlternativeWhiteDragon, BlueEyesAlternativeWhiteDragoneff);
AddExecutor(ExecutorType.Activate, CardId.CreatureSwap, CreatureSwapeff);
AddExecutor(ExecutorType.Activate, CardId.TheMelodyOfAwakeningDragon, TheMelodyOfAwakeningDragoneff);
//summon
AddExecutor(ExecutorType.Summon, CardId.ManguOfTheTenTousandHands);
AddExecutor(ExecutorType.Activate, CardId.ManguOfTheTenTousandHands, TenTousandHandseff);
AddExecutor(ExecutorType.Activate, DeviritualCheck);
//ritual summon
AddExecutor(ExecutorType.Activate, CardId.AdvancedRitualArt);
AddExecutor(ExecutorType.Activate, CardId.ChaosForm, ChaosFormeff);
//sp summon
AddExecutor(ExecutorType.SpSummon, CardId.MissusRadiant, MissusRadiantsp);
AddExecutor(ExecutorType.Activate, CardId.MissusRadiant, MissusRadianteff);
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh, Linkuribohsp);
AddExecutor(ExecutorType.SpSummon, CardId.LinkSpider);
AddExecutor(ExecutorType.SpSummon, CardId.BirrelswordDragon, BirrelswordDragonsp);
AddExecutor(ExecutorType.Activate, CardId.BirrelswordDragon, BirrelswordDragoneff);
//set
AddExecutor(ExecutorType.Activate, CardId.TheMelodyOfAwakeningDragon, TheMelodyOfAwakeningDragoneffsecond);
AddExecutor(ExecutorType.SpellSet, SpellSet);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
//
AddExecutor(ExecutorType.Activate, CardId.RecklessGreed, RecklessGreedeff);
AddExecutor(ExecutorType.Activate, CardId.Scapegoat, Scapegoateff);
}
int Talismandra_count = 0;
int Candoll_count = 0;
bool Talismandra_used = false;
bool Candoll_used = false;
int RitualArt_count = 0;
int ChaosForm_count = 0;
int MaxDragon_count = 0;
int TheMelody_count = 0;
public override void OnNewTurn()
{
Talismandra_used = false;
Candoll_used = false;
base.OnNewTurn();
}
private void Count_check()
{
TheMelody_count = 0;
Talismandra_count = 0;
Candoll_count = 0;
RitualArt_count = 0;
ChaosForm_count = 0;
MaxDragon_count = 0;
foreach (ClientCard check in Bot.Hand)
{
if (check.Id == CardId.AdvancedRitualArt)
RitualArt_count++;
if (check.Id == CardId.ChaosForm)
ChaosForm_count++;
if (check.Id == CardId.DevirrtualCandoll)
Candoll_count++;
if (check.Id == CardId.DeviritualTalismandra)
Talismandra_count++;
if (check.Id == CardId.BlueEyesChaosMaxDragon)
MaxDragon_count++;
if (check.Id == CardId.TheMelodyOfAwakeningDragon)
TheMelody_count++;
}
}
private bool MaxxCeff()
{
return Duel.Player == 1;
}
private bool CalledByTheGraveeff()
{
if(Duel.LastChainPlayer==1)
{
if(AI.Utils.GetLastChainCard().Id==CardId.MaxxC)
{
AI.SelectCard(CardId.MaxxC);
if(AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == CardId.LockBird)
{
AI.SelectCard(CardId.LockBird);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == CardId.Ghost)
{
AI.SelectCard(CardId.Ghost);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == CardId.AshBlossom)
{
AI.SelectCard(CardId.AshBlossom);
if (AI.Utils.ChainContainsCard(CardId.TheMelodyOfAwakeningDragon))
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return UniqueFaceupSpell();
}
}
return false;
}
private bool BlueEyesAlternativeWhiteDragoneff()
{
if(Card.Location==CardLocation.Hand)
{
if (Duel.Turn == 1)
return false;
return true;
}
else
{
if(AI.Utils.GetProblematicEnemyMonster(3000,true)!=null)
{
AI.SelectCard(AI.Utils.GetProblematicEnemyMonster(3000, true));
return true;
}
}
return false;
}
private bool CreatureSwapeff()
{
if(Bot.HasInMonstersZone(CardId.BlueEyesChaosMaxDragon,true) && Duel.Phase==DuelPhase.Main1 &&
(Bot.HasInMonstersZone(CardId.DeviritualTalismandra) || Bot.HasInMonstersZone(CardId.DevirrtualCandoll)))
{
AI.SelectCard(new[] {CardId.DevirrtualCandoll,CardId.DeviritualTalismandra });
return true;
}
return false;
}
private bool TheMelodyOfAwakeningDragoneff()
{
Count_check();
if(TheMelody_count>=2 && Bot.GetRemainingCount(CardId.BlueEyesChaosMaxDragon,3)>0)
{
AI.SelectCard(CardId.TheMelodyOfAwakeningDragon);
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon , CardId.BlueEyesAlternativeWhiteDragon });
return true;
}
if(Bot.HasInHand(CardId.BlueEyesWhiteDragon) && Bot.GetRemainingCount(CardId.BlueEyesChaosMaxDragon, 3) > 0)
{
AI.SelectCard(CardId.BlueEyesWhiteDragon);
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon,CardId.BlueEyesAlternativeWhiteDragon });
return true;
}
return false;
}
private bool TheMelodyOfAwakeningDragoneffsecond()
{
Count_check();
if (RitualArtCanUse() && Bot.GetRemainingCount(CardId.BlueEyesChaosMaxDragon, 3) > 0 &&
!Bot.HasInHand(CardId.BlueEyesChaosMaxDragon) && Bot.Hand.Count>=3)
{
if(RitualArt_count>=2)
{
foreach (ClientCard m in Bot.Hand)
{
if (m.Id == CardId.AdvancedRitualArt)
AI.SelectCard(m);
}
}
foreach(ClientCard m in Bot.Hand)
{
if (m.Id != CardId.AdvancedRitualArt)
AI.SelectCard(m);
}
AI.SelectNextCard(new[] { CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesChaosMaxDragon, CardId.BlueEyesAlternativeWhiteDragon });
return true;
}
return false;
}
private bool TenTousandHandseff()
{
Count_check();
if(Talismandra_count>=2 && Bot.GetRemainingCount(CardId.BlueEyesChaosMaxDragon,3)>0)
{
AI.SelectCard(CardId.BlueEyesChaosMaxDragon);
return true;
}
if(Candoll_count>=2 || MaxDragon_count >= 2)
{
if(RitualArtCanUse() && Bot.GetRemainingCount(CardId.AdvancedRitualArt,3)>0)
{
AI.SelectCard(CardId.AdvancedRitualArt);
return true;
}
if(ChaosFormCanUse() && Bot.GetRemainingCount(CardId.ChaosForm,1)>0)
{
AI.SelectCard(CardId.ChaosForm);
return true;
}
}
if(RitualArt_count+ChaosForm_count>=2)
{
AI.SelectCard(CardId.BlueEyesChaosMaxDragon);
return true;
}
if(Candoll_count+Talismandra_count>1)
{
if (MaxDragon_count >= 1)
{
if (RitualArtCanUse() && Bot.GetRemainingCount(CardId.AdvancedRitualArt, 3) > 0)
{
AI.SelectCard(CardId.AdvancedRitualArt);
return true;
}
if (ChaosFormCanUse() && Bot.GetRemainingCount(CardId.ChaosForm, 1) > 0)
{
AI.SelectCard(CardId.ChaosForm);
return true;
}
}
if(Bot.HasInHand(CardId.AdvancedRitualArt) || Bot.HasInHand(CardId.ChaosForm))
{
AI.SelectCard(CardId.BlueEyesChaosMaxDragon);
return true;
}
}
if (ChaosForm_count >= 1)
{
if (RitualArtCanUse() && Bot.GetRemainingCount(CardId.AdvancedRitualArt, 3) > 0)
{
AI.SelectCard(CardId.AdvancedRitualArt);
return true;
}
if (ChaosFormCanUse() && Bot.GetRemainingCount(CardId.ChaosForm, 1) > 0)
{
AI.SelectCard(CardId.ChaosForm);
return true;
}
}
if (Talismandra_count>=1)
{
AI.SelectCard(CardId.BlueEyesChaosMaxDragon);
return true;
}
if(MaxDragon_count>=1)
{
if (RitualArtCanUse() && Bot.GetRemainingCount(CardId.AdvancedRitualArt, 3) > 0)
{
AI.SelectCard(CardId.AdvancedRitualArt);
return true;
}
if (ChaosFormCanUse() && Bot.GetRemainingCount(CardId.ChaosForm, 1) > 0)
{
AI.SelectCard(CardId.ChaosForm);
return true;
}
}
if (RitualArtCanUse() && Bot.GetRemainingCount(CardId.AdvancedRitualArt, 3) > 0)
{
AI.SelectCard(CardId.AdvancedRitualArt);
}
if (ChaosFormCanUse() && Bot.GetRemainingCount(CardId.ChaosForm, 1) > 0)
{
AI.SelectCard(CardId.ChaosForm);
}
return true;
}
private bool RitualArtCanUse()
{
return Bot.GetRemainingCount(CardId.BlueEyesWhiteDragon,2)>0;
}
private bool ChaosFormCanUse()
{
ClientCard check = null;
foreach (ClientCard m in Bot.GetGraveyardMonsters())
{
if (m.Id == CardId.BlueEyesAlternativeWhiteDragon ||
m.Id == CardId.BlueEyesChaosMaxDragon ||
m.Id == CardId.BlueEyesWhiteDragon)
check = m;
}
foreach (ClientCard m in Bot.Hand)
{
if (m.Id == CardId.BlueEyesWhiteDragon)
check = m;
}
if (check != null)
{
return true;
}
return false;
}
private bool DeviritualCheck()
{
Count_check();
if(Card.Id==CardId.DeviritualTalismandra || Card.Id==CardId.DevirrtualCandoll)
{
if (Card.Location == CardLocation.MonsterZone)
{
if(RitualArtCanUse())
{
AI.SelectCard(CardId.AdvancedRitualArt);
}
else
{
AI.SelectCard(CardId.ChaosForm);
}
return true;
}
if(Card.Location==CardLocation.Hand)
{
if(Card.Id==CardId.DevirrtualCandoll)
{
if (MaxDragon_count >= 2 && Talismandra_count >= 1 || Candoll_used)
return false;
}
if(Card.Id==CardId.DeviritualTalismandra)
{
if (RitualArt_count + ChaosForm_count >= 2 && Candoll_count >= 1 || Talismandra_used)
return false;
Talismandra_used = true;
return true;
}
if(RitualArtCanUse())
{
Candoll_used = true;
AI.SelectCard(CardId.AdvancedRitualArt);
return true;
}
if (ChaosFormCanUse())
{
Candoll_used = true;
AI.SelectCard(CardId.ChaosForm);
return true;
}
return true;
}
}
return false;
}
private bool ChaosFormeff()
{
ClientCard check = null;
foreach(ClientCard m in Bot.Graveyard)
{
if (m.Id == CardId.BlueEyesAlternativeWhiteDragon ||
m.Id == CardId.BlueEyesChaosMaxDragon ||
m.Id == CardId.BlueEyesWhiteDragon)
check = m;
}
if(check != null)
{
AI.SelectCard(CardId.BlueEyesChaosMaxDragon);
AI.SelectNextCard(check);
return true;
}
foreach(ClientCard m in Bot.Hand)
{
if (m.Id == CardId.BlueEyesWhiteDragon)
check = m;
}
if (check != null)
{
AI.SelectCard(CardId.BlueEyesChaosMaxDragon);
AI.SelectNextCard(check);
return true;
}
return false;
}
private bool MissusRadiantsp()
{
IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters())
{
if (monster.HasAttribute(CardAttribute.Earth) && monster.Level == 1)
material_list.Add(monster);
if (material_list.Count == 2) break;
}
if (material_list.Count < 2) return false;
if (Bot.HasInMonstersZone(CardId.MissusRadiant)) return false;
AI.SelectMaterials(material_list);
if (Bot.MonsterZone[0] == null && Bot.MonsterZone[2] == null && Bot.MonsterZone[5] == null)
AI.SelectPlace(Zones.z5);
else
AI.SelectPlace(Zones.z6);
return true;
}
private bool MissusRadianteff()
{
AI.SelectCard(new[]
{
CardId.MaxxC,
CardId.MissusRadiant,
});
return true;
}
private bool Linkuribohsp()
{
foreach (ClientCard c in Bot.GetMonsters())
{
if (c.Id != CardId.Linkuriboh && c.Level == 1)
{
AI.SelectMaterials(c);
return true;
}
}
return false;
}
private bool Linkuriboheff()
{
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false;
return true;
}
private bool BirrelswordDragonsp()
{
IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard m in Bot.GetMonsters())
{
if (m.Id == CardId.MissusRadiant)
{
material_list.Add(m);
break;
}
}
foreach (ClientCard m in Bot.GetMonsters())
{
if (m.Id == CardId.Linkuriboh || m.Level==1)
{
material_list.Add(m);
if (material_list.Count == 3)
break;
}
}
if (material_list.Count == 3)
{
AI.SelectMaterials(material_list);
return true;
}
return false;
}
private bool BirrelswordDragoneff()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.BirrelswordDragon, 0))
{
if (AI.Utils.IsChainTarget(Card) && AI.Utils.GetBestEnemyMonster(true, true) != null)
{
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true, true));
return true;
}
if (Duel.Player == 1 && Bot.BattlingMonster == Card)
{
AI.SelectCard(Enemy.BattlingMonster);
return true;
}
if (Duel.Player == 1 && Bot.BattlingMonster != null &&
(Enemy.BattlingMonster.Attack - Bot.BattlingMonster.Attack) >= Bot.LifePoints)
{
AI.SelectCard(Enemy.BattlingMonster);
return true;
}
if (Duel.Player == 0 && Duel.Phase == DuelPhase.BattleStart)
{
foreach (ClientCard check in Enemy.GetMonsters())
{
if (check.IsAttack())
{
AI.SelectCard(check);
return true;
}
}
}
return false;
}
return true;
}
private bool SpellSet()
{
if (Card.Id == CardId.InfiniteImpermanence)
return !Bot.IsFieldEmpty();
if (Card.Id == CardId.RecklessGreed)
return true;
if (Card.Id == CardId.Scapegoat)
return true;
return false;
}
private bool RecklessGreedeff()
{
int count = 0;
foreach (ClientCard card in Bot.GetSpells())
{
if (card.Id == CardId.RecklessGreed)
count++;
}
if (DefaultOnBecomeTarget()) return true;
if(Duel.Player==0 && Duel.Phase>=DuelPhase.Main1)
{
if (Bot.LifePoints <= 4000 || count>=2)
return true;
}
return false;
}
private bool Scapegoateff()
{
if (Duel.Player == 0) return false;
if (Duel.Phase == DuelPhase.End) return true;
if (Duel.LastChainPlayer == 1 && DefaultOnBecomeTarget()) return true;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
int total_atk = 0;
List<ClientCard> enemy_monster = Enemy.GetMonsters();
foreach (ClientCard m in enemy_monster)
{
if (m.IsAttack() && !m.Attacked) total_atk += m.Attack;
}
if (total_atk >= Bot.LifePoints) return true;
}
return false;
}
public override ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
for (int i = 0; i < attackers.Count; ++i)
{
ClientCard attacker = attackers[i];
if (attacker.Id == CardId.BlueEyesChaosMaxDragon)
{
Logger.DebugWriteLine(attacker.Name);
return attacker;
}
}
return base.OnSelectAttacker(attackers, defenders);
}
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
if(attacker.Id==CardId.BlueEyesChaosMaxDragon && !attacker.IsDisabled() &&
Enemy.HasInMonstersZone(new[] {CardId.DeviritualTalismandra,CardId.DevirrtualCandoll }))
{
for (int i = 0; i < defenders.Count; i++)
{
ClientCard defender = defenders[i];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
if (defender.Id == CardId.DevirrtualCandoll || defender.Id == CardId.DeviritualTalismandra)
{
return AI.Attack(attacker, defender);
}
}
}
return base.OnSelectAttackTarget(attacker, defenders);
}
public override bool OnSelectHand()
{
return false;
}
}
}
...@@ -382,9 +382,7 @@ namespace WindBot.Game.AI.Decks ...@@ -382,9 +382,7 @@ namespace WindBot.Game.AI.Decks
if (destroyCard == null) if (destroyCard == null)
return false; return false;
if (tributeId != -1) AI.SelectCard(tributeId);
AI.SelectCard(tributeId);
AI.SelectNextCard(destroyCard); AI.SelectNextCard(destroyCard);
return true; return true;
......
...@@ -57,7 +57,8 @@ namespace WindBot.Game.AI.Decks ...@@ -57,7 +57,8 @@ namespace WindBot.Game.AI.Decks
public GrenMajuThunderBoarderExecutor(GameAI ai, Duel duel) public GrenMajuThunderBoarderExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.GoToBattlePhase, EvenlyMatchedToBP);
AddExecutor(ExecutorType.Activate, CardId.EvenlyMatched, EvenlyMatchedeff); AddExecutor(ExecutorType.Activate, CardId.EvenlyMatched, EvenlyMatchedeff);
//Sticker //Sticker
AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, MacroCosmoseff); AddExecutor(ExecutorType.Activate, CardId.MacroCosmos, MacroCosmoseff);
...@@ -102,19 +103,11 @@ namespace WindBot.Game.AI.Decks ...@@ -102,19 +103,11 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpellSet, SpellSet); AddExecutor(ExecutorType.SpellSet, SpellSet);
} }
bool CardOfDemiseeff_used = false; bool CardOfDemiseeff_used = false;
bool plan_A = false;
bool eater_eff = false; bool eater_eff = false;
public override void OnNewTurn() public override void OnNewTurn()
{ {
eater_eff = false; eater_eff = false;
CardOfDemiseeff_used = false; CardOfDemiseeff_used = false;
if (Bot.HasInHand(CardId.EvenlyMatched) && Duel.Turn == 2 && Enemy.GetFieldCount()>=2)
{
Logger.DebugWriteLine("***********plan_A");
plan_A = true;
//todo:Duel.Global.ToBattlePhase = true;
}
} }
public override void OnNewPhase() public override void OnNewPhase()
...@@ -182,15 +175,17 @@ namespace WindBot.Game.AI.Decks ...@@ -182,15 +175,17 @@ namespace WindBot.Game.AI.Decks
return Duel.Player == 1; return Duel.Player == 1;
} }
private bool EvenlyMatchedToBP()
{
return Bot.HasInHand(CardId.EvenlyMatched) && Duel.Turn >= 2 && Enemy.GetFieldCount() >= 2;
}
private bool EvenlyMatchedeff() private bool EvenlyMatchedeff()
{ {
// todo:Duel.Global.ToBattlePhase = false;
plan_A = false;
return true; return true;
} }
private bool InfiniteImpermanenceeff() private bool InfiniteImpermanenceeff()
{ {
if (plan_A) return false;
AI.SelectPlace(Zones.z2); AI.SelectPlace(Zones.z2);
ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster(); ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster();
if(target!=null) if(target!=null)
...@@ -368,21 +363,18 @@ namespace WindBot.Game.AI.Decks ...@@ -368,21 +363,18 @@ namespace WindBot.Game.AI.Decks
private bool InspectBoardersummon() private bool InspectBoardersummon()
{ {
if (plan_A) return false;
AI.SelectPlace(Zones.z4 | Zones.z0); AI.SelectPlace(Zones.z4 | Zones.z0);
return true; return true;
} }
private bool GrenMajuDaEizosummon() private bool GrenMajuDaEizosummon()
{ {
if (Duel.Turn == 1) return false; if (Duel.Turn == 1) return false;
if (plan_A) return false;
AI.SelectPlace(Zones.z4 | Zones.z0); AI.SelectPlace(Zones.z4 | Zones.z0);
return Bot.Banished.Count >= 6; return Bot.Banished.Count >= 6;
} }
private bool ThunderKingRaiOhsummon() private bool ThunderKingRaiOhsummon()
{ {
if (plan_A) return false;
AI.SelectPlace(Zones.z4 | Zones.z0); AI.SelectPlace(Zones.z4 | Zones.z0);
return true; return true;
} }
...@@ -440,7 +432,6 @@ namespace WindBot.Game.AI.Decks ...@@ -440,7 +432,6 @@ namespace WindBot.Game.AI.Decks
private bool EaterOfMillionssp() private bool EaterOfMillionssp()
{ {
if (Bot.HasInMonstersZone(CardId.InspectBoarder) && !eater_eff) return false; if (Bot.HasInMonstersZone(CardId.InspectBoarder) && !eater_eff) return false;
if (plan_A) return false;
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false; if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (Bot.GetMonstersInMainZone().Count >= 5) return false; if (Bot.GetMonstersInMainZone().Count >= 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false; if (AI.Utils.IsTurn1OrMain2()) return false;
...@@ -547,7 +538,6 @@ namespace WindBot.Game.AI.Decks ...@@ -547,7 +538,6 @@ namespace WindBot.Game.AI.Decks
private bool SpellSet() private bool SpellSet()
{ {
if (plan_A) return false;
int count = 0; int count = 0;
foreach(ClientCard check in Bot.Hand) foreach(ClientCard check in Bot.Hand)
{ {
......
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
[Deck("Phantasm", "AI_Phantasm", "Normal")]
public class PhantasmExecutor : DefaultExecutor
{
public class CardId
{
public const int MegalosmasherX = 81823360;
public const int AshBlossom = 14558127;
public const int EaterOfMillions = 63845230;
public const int HarpieFeatherDuster = 18144506;
public const int PotOfDesires = 35261759;
public const int FossilDig = 47325505;
public const int CardOfDemise = 59750328;
public const int Terraforming = 73628505;
public const int PotOfDuality = 98645731;
public const int Scapegoat = 73915051;
public const int PacifisThePhantasmCity = 2819435;
public const int InfiniteImpermanence = 10045474;
public const int PhantasmSprialBattle = 34302287;
public const int DrowningMirrorForce = 47475363;
public const int StarlightRoad = 58120309;
public const int PhantasmSpiralPower = 61397885;
public const int Metaverse = 89208725;
public const int SeaStealthAttack = 19089195;
public const int GozenMatch = 53334471;
public const int SkillDrain = 82732705;
public const int TheHugeRevolutionIsOver = 99188141;
public const int StardustDragon = 44508094;
public const int TopologicBomberDragon = 5821478;
public const int BorreloadDragon = 31833038;
public const int BorrelswordDragon = 85289965;
public const int KnightmareGryphon = 65330383;
public const int TopologicTrisbaena = 72529749;
public const int SummonSorceress = 61665245;
public const int KnightmareUnicorn = 38342335;
public const int KnightmarePhoenix = 2857636;
public const int KnightmareCerberus = 75452921;
public const int CrystronNeedlefiber = 50588353;
public const int MissusRadiant = 3987233;
public const int LinkSpider = 98978921;
public const int Linkuriboh = 41999284;
public const int ElShaddollWinda = 94977269;
public const int BrandishSkillJammingWave = 25955749;
public const int BrandishSkillAfterburner = 99550630;
public const int EternalSoul = 48680970;
public const int SuperboltThunderDragon = 15291624;
}
public PhantasmExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
//counter
//AddExecutor(ExecutorType.ToBattlePhase, ToBattlePhaseeff);
AddExecutor(ExecutorType.Activate, CardId.StarlightRoad, PreventFeatherDustereff);
AddExecutor(ExecutorType.Activate, CardId.TheHugeRevolutionIsOver, PreventFeatherDustereff);
AddExecutor(ExecutorType.Activate, _CardId.GhostBelle, DefaultGhostBelleAndHauntedMansion);
AddExecutor(ExecutorType.Activate, _CardId.CalledByTheGrave, DefaultCalledByTheGrave);
AddExecutor(ExecutorType.Activate, _CardId.EffectVeiler, DefaultEffectVeiler);
AddExecutor(ExecutorType.Activate, _CardId.InfiniteImpermanence, DefaultInfiniteImpermanence);
AddExecutor(ExecutorType.Activate, _CardId.AshBlossom, DefaultAshBlossomAndJoyousSpring);
AddExecutor(ExecutorType.Activate, _CardId.GhostOgreAndSnowRabbit, DefaultGhostOgreAndSnowRabbit);
//trap activate
AddExecutor(ExecutorType.Activate, CardId.SeaStealthAttack, SeaStealthAttackeff);
AddExecutor(ExecutorType.Activate, CardId.PhantasmSprialBattle, PhantasmSprialBattleeff);
AddExecutor(ExecutorType.Activate, CardId.PhantasmSpiralPower, PhantasmSpiralPowereff);
AddExecutor(ExecutorType.Activate, CardId.DrowningMirrorForce, DrowningMirrorForceeff);
AddExecutor(ExecutorType.Activate, CardId.GozenMatch, GozenMatcheff);
AddExecutor(ExecutorType.Activate, CardId.SkillDrain, SkillDraineff);
AddExecutor(ExecutorType.Activate, CardId.Metaverse, Metaverseeff);
//sp
AddExecutor(ExecutorType.SpSummon, CardId.BorrelswordDragon, BorrelswordDragonsp);
AddExecutor(ExecutorType.Activate, CardId.BorrelswordDragon, BorrelswordDragoneff);
AddExecutor(ExecutorType.SpSummon, CardId.MissusRadiant, MissusRadiantsp);
AddExecutor(ExecutorType.Activate, CardId.MissusRadiant, MissusRadianteff);
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh, Linkuribohsp);
//first
AddExecutor(ExecutorType.Activate, CardId.HarpieFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.FossilDig, FossilDigeff);
AddExecutor(ExecutorType.Activate, CardId.Terraforming, Terraformingeff);
AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityeff);
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires, PotOfDesireseff);
AddExecutor(ExecutorType.Activate, CardId.PacifisThePhantasmCity, PacifisThePhantasmCityeff);
//summon
AddExecutor(ExecutorType.Summon, CardId.MegalosmasherX, MegalosmasherXsummon);
//sp
AddExecutor(ExecutorType.SpSummon, CardId.EaterOfMillions, EaterOfMillionssp);
AddExecutor(ExecutorType.Activate, CardId.EaterOfMillions, EaterOfMillionseff);
//other
AddExecutor(ExecutorType.Activate, CardId.Scapegoat, Scapegoateff);
AddExecutor(ExecutorType.SpellSet, CardId.SeaStealthAttack, NoSetAlreadyDone);
AddExecutor(ExecutorType.SpellSet, CardId.StarlightRoad, StarlightRoadset);
AddExecutor(ExecutorType.SpellSet, CardId.TheHugeRevolutionIsOver, TheHugeRevolutionIsOverset);
AddExecutor(ExecutorType.SpellSet, CardId.DrowningMirrorForce);
AddExecutor(ExecutorType.SpellSet, CardId.InfiniteImpermanence, InfiniteImpermanenceset);
AddExecutor(ExecutorType.SpellSet, CardId.Scapegoat, NoSetAlreadyDone);
AddExecutor(ExecutorType.SpellSet, CardId.GozenMatch, NoSetAlreadyDone);
AddExecutor(ExecutorType.SpellSet, CardId.SkillDrain, NoSetAlreadyDone);
AddExecutor(ExecutorType.SpellSet, CardId.Metaverse);
AddExecutor(ExecutorType.SpellSet, SpellSeteff);
AddExecutor(ExecutorType.Activate, CardId.CardOfDemise, CardOfDemiseeff);
AddExecutor(ExecutorType.Repos, MonsterRepos);
}
bool summon_used = false;
bool CardOfDemiseeff_used = false;
bool SeaStealthAttackeff_used = false;
public override void OnNewTurn()
{
summon_used = false;
CardOfDemiseeff_used = false;
SeaStealthAttackeff_used = false;
base.OnNewTurn();
}
private bool PreventFeatherDustereff()
{
return Duel.LastChainPlayer == 1;
}
/* private bool ToBattlePhaseeff()
{
if (Enemy.GetMonsterCount() == 0)
{
if (AI.Utils.GetTotalAttackingMonsterAttack(0) >= Enemy.LifePoints)
{
AI.ManualPhaseChange = true;
return true;
}
}
return false;
}*/
private bool PhantasmSprialBattleeff()
{
if (DefaultOnBecomeTarget() && Card.Location==CardLocation.SpellZone)
{
AI.SelectCard(AI.Utils.GetBestEnemyCard(false,true));
return true;
}
if(Enemy.HasInSpellZone(CardId.EternalSoul))
{
AI.SelectCard(CardId.EternalSoul);
return UniqueFaceupSpell();
}
if(Bot.GetMonsterCount()>0 && !Bot.HasInSpellZone(CardId.SeaStealthAttack) &&
AI.Utils.IsOneEnemyBetterThanValue(2000,true) && Duel.Phase==DuelPhase.BattleStart)
{
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true,true));
return UniqueFaceupSpell();
}
if (AI.Utils.GetProblematicEnemyCard(9999,true)!=null)
{
if (AI.Utils.GetProblematicEnemyCard(9999, true).Id == CardId.ElShaddollWinda &&
!AI.Utils.GetProblematicEnemyCard(9999, true).IsDisabled())
return false;
AI.SelectCard(AI.Utils.GetProblematicEnemyCard(9999, true));
return UniqueFaceupSpell();
}
return false;
}
private bool PhantasmSpiralPowereff()
{
if (DefaultOnBecomeTarget() && Card.Location == CardLocation.SpellZone) return true;
if(Duel.Player == 0 || (Duel.Player==1 && Bot.BattlingMonster!=null))
{
if(Enemy.HasInMonstersZone(CardId.ElShaddollWinda))
{
AI.SelectCard(CardId.ElShaddollWinda);
return UniqueFaceupSpell();
}
if(Enemy.HasInMonstersZone(CardId.SuperboltThunderDragon))
{
AI.SelectCard(CardId.SuperboltThunderDragon);
return UniqueFaceupSpell();
}
}
return DefaultInfiniteImpermanence() && UniqueFaceupSpell();
}
private bool DrowningMirrorForceeff()
{
int count = 0;
foreach(ClientCard m in Enemy.GetMonsters())
{
if (m.IsAttack()) count++;
}
if (AI.Utils.GetTotalAttackingMonsterAttack(1) >= Bot.LifePoints)
return true;
return count >= 2;
}
private bool GozenMatcheff()
{
if (Bot.GetMonsterCount() >= 4 || Bot.HasInSpellZone(CardId.Scapegoat)) return false;
if (DefaultOnBecomeTarget()) return true;
int dark_count = 0;
int Divine_count = 0;
int Earth_count = 0;
int Fire_count = 0;
int Light_count = 0;
int Water_count = 0;
int Wind_count = 0;
foreach (ClientCard m in Enemy.GetMonsters())
{
if (m.HasAttribute(CardAttribute.Dark)) dark_count++;
if (m.HasAttribute(CardAttribute.Divine)) Divine_count++;
if (m.HasAttribute(CardAttribute.Earth)) Earth_count++;
if (m.HasAttribute(CardAttribute.Fire)) Fire_count++;
if (m.HasAttribute(CardAttribute.Light)) Light_count++;
if (m.HasAttribute(CardAttribute.Water)) Water_count++;
if (m.HasAttribute(CardAttribute.Wind)) Wind_count++;
}
if (dark_count > 1) dark_count = 1;
if (Divine_count > 1) Divine_count = 1;
if (Earth_count > 1) Earth_count = 1;
if (Fire_count > 1) Fire_count = 1;
if (Light_count > 1) Light_count = 1;
if (Water_count > 1) Water_count = 1;
if (Wind_count > 1) Wind_count = 1;
return ((dark_count + Divine_count + Earth_count + Fire_count + Light_count + Water_count + Wind_count) >= 2 && UniqueFaceupSpell());
}
private bool SkillDraineff()
{
if (Duel.LastChainPlayer == 1 && AI.Utils.GetLastChainCard().Location == CardLocation.MonsterZone)
return UniqueFaceupSpell();
return false;
}
private bool Metaverseeff()
{
if (Duel.LastChainPlayer == 0) return false;
if (!Bot.HasInSpellZone(CardId.PacifisThePhantasmCity))
{
AI.SelectOption(1);
return UniqueFaceupSpell();
}
else
{
AI.SelectOption(0);
return UniqueFaceupSpell();
}
}
private bool CardOfDemiseeff()
{
//if (DefaultSpellWillBeNegated()) return false;
AI.SelectPlace(Zones.z2);
if(Card.Location==CardLocation.Hand)
{
if (Bot.Hand.Count <= 1 && Bot.GetSpellCountWithoutField() <= 3)
{
CardOfDemiseeff_used = true;
return true;
}
}
else
{
if (Bot.Hand.Count <= 1 && Bot.GetSpellCountWithoutField() <= 4)
{
CardOfDemiseeff_used = true;
return true;
}
}
return false;
}
private bool FossilDigeff()
{
//if (DefaultSpellWillBeNegated()) return false;
if (CardOfDemiseeff_used && summon_used) return false;
return true;
}
private bool PotOfDualityeff()
{
if(!Bot.HasInHandOrInSpellZone(CardId.PacifisThePhantasmCity) &&
!Bot.HasInHandOrInSpellZone(CardId.Metaverse))
{
if(Bot.HasInGraveyard(CardId.PacifisThePhantasmCity) && !Bot.HasInHandOrInSpellZone(CardId.SeaStealthAttack))
{
AI.SelectCard(new[] {
CardId.SeaStealthAttack,
CardId.PacifisThePhantasmCity,
CardId.Terraforming,
CardId.Metaverse,
CardId.CardOfDemise,
CardId.Scapegoat});
}
else
{
AI.SelectCard(new[] {
CardId.PacifisThePhantasmCity,
CardId.Terraforming,
CardId.Metaverse,
CardId.CardOfDemise,
CardId.Scapegoat});
}
}
else if(!Bot.HasInHandOrInSpellZone(CardId.SeaStealthAttack))
{
AI.SelectCard(new[] {
CardId.SeaStealthAttack,
CardId.CardOfDemise,
CardId.PotOfDesires,
CardId.Scapegoat});
}
else
{
AI.SelectCard(new[] {
CardId.CardOfDemise,
CardId.PotOfDesires,
CardId.Scapegoat});
}
return true;
}
private bool Terraformingeff()
{
// if (DefaultSpellWillBeNegated()) return false;
if (CardOfDemiseeff_used && Bot.HasInSpellZone(CardId.PacifisThePhantasmCity)) return false;
return true;
}
private bool PacifisThePhantasmCityeff()
{
// if (DefaultSpellWillBeNegated()) return false;
if(Card.Location==CardLocation.Hand)
{
if (Bot.HasInSpellZone(CardId.PacifisThePhantasmCity))
return false;
return true;
}
else
{
ClientCard target = null;
foreach(ClientCard s in Bot.GetSpells())
{
if(s.Id==CardId.SeaStealthAttack && Card.IsFaceup())
{
target = s;
break;
}
}
foreach(ClientCard m in Bot.GetMonsters())
{
if(m.HasAttribute(CardAttribute.Water))
{
if (target != null && !SeaStealthAttackeff_used)
{
if (AI.Utils.IsChainTarget(Card) || AI.Utils.IsChainTarget(target))
return false;
}
break;
}
}
AI.SelectPlace(Zones.z1 | Zones.z3);
AI.SelectCard(CardId.PhantasmSprialBattle);
return true;
}
}
private bool MegalosmasherXsummon()
{
AI.SelectPlace(Zones.z1 | Zones.z3);
summon_used = true;
return true;
}
private bool BorrelswordDragonsp()
{
if (!Bot.HasInMonstersZone(CardId.MissusRadiant))
return false;
IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard m in Bot.GetMonsters())
{
if (m.Id == CardId.MissusRadiant)
{
material_list.Add(m);
break;
}
}
foreach (ClientCard m in Bot.GetMonsters())
{
if (m.Id == CardId.Linkuriboh || m.Id == CardId.LinkSpider)
{
material_list.Add(m);
if (material_list.Count == 3)
break;
}
}
if (material_list.Count == 3)
{
AI.SelectMaterials(material_list);
return true;
}
return false;
}
private bool BorrelswordDragoneff()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.BorrelswordDragon, 0))
{
if (AI.Utils.IsChainTarget(Card) && AI.Utils.GetBestEnemyMonster(true, true) != null)
{
AI.SelectCard(AI.Utils.GetBestEnemyMonster(true, true));
return true;
}
if (Duel.Player == 1 && Bot.BattlingMonster == Card)
{
AI.SelectCard(Enemy.BattlingMonster);
return true;
}
if (Duel.Player == 1 && Bot.BattlingMonster != null &&
(Enemy.BattlingMonster.Attack - Bot.BattlingMonster.Attack) >= Bot.LifePoints)
{
AI.SelectCard(Enemy.BattlingMonster);
return true;
}
if (Duel.Player == 0 && Duel.Phase == DuelPhase.BattleStart)
{
foreach (ClientCard check in Enemy.GetMonsters())
{
if (check.IsAttack() && !check.HasType(CardType.Link))
{
AI.SelectCard(check);
return true;
}
}
}
return false;
}
return true;
}
private bool EaterOfMillionssp()
{
if (Bot.MonsterZone[1] == null)
AI.SelectPlace(Zones.z1);
else
AI.SelectPlace(Zones.z3);
if (Enemy.HasInMonstersZone(CardId.KnightmareGryphon, true)) return false;
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (Bot.GetMonstersInMainZone().Count >= 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> material_list = new List<ClientCard>();
if(Bot.HasInExtra(CardId.BorreloadDragon))
{
AI.SelectCard(new[] {
CardId.TopologicBomberDragon,
CardId.TopologicTrisbaena,
CardId.KnightmareGryphon,
CardId.SummonSorceress,
CardId.BorreloadDragon});
}
else
{
foreach(ClientCard m in Bot.ExtraDeck)
{
if (material_list.Count == 5) break;
material_list.Add(m);
}
}
return true;
}
private bool EaterOfMillionseff()
{
if (Enemy.BattlingMonster.HasPosition(CardPosition.Attack) && (Bot.BattlingMonster.Attack - Enemy.BattlingMonster.GetDefensePower() >= Enemy.LifePoints)) return false;
return true;
}
private bool MissusRadiantsp()
{
IList<ClientCard> material_list = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters())
{
if (monster.HasAttribute(CardAttribute.Earth) && monster.Level == 1 && monster.Id != CardId.EaterOfMillions)
material_list.Add(monster);
if (material_list.Count == 2) break;
}
if (material_list.Count < 2) return false;
if (Bot.HasInMonstersZone(CardId.MissusRadiant)) return false;
AI.SelectMaterials(material_list);
if ((Bot.MonsterZone[0] == null || Bot.MonsterZone[0].Level==1) &&
(Bot.MonsterZone[2] == null || Bot.MonsterZone[2].Level == 1)&&
Bot.MonsterZone[5] == null)
AI.SelectPlace(Zones.z5);
else
AI.SelectPlace(Zones.z6);
return true;
}
private bool MissusRadianteff()
{
AI.SelectCard(new[]
{
CardId.MissusRadiant,
});
return true;
}
private bool Linkuribohsp()
{
foreach (ClientCard c in Bot.GetMonsters())
{
if (c.Id != CardId.EaterOfMillions && c.Id != CardId.Linkuriboh && c.Level == 1)
{
AI.SelectMaterials(c);
return true;
}
}
return false;
}
private bool Linkuriboheff()
{
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false;
return true;
}
private bool SeaStealthAttackeff()
{
if (DefaultOnBecomeTarget())
{
AI.SelectCard(CardId.MegalosmasherX);
SeaStealthAttackeff_used = true;
return true;
}
if ((Card.IsFacedown() && Bot.HasInHandOrInSpellZoneOrInGraveyard(CardId.PacifisThePhantasmCity)))
{
if (!Bot.HasInSpellZone(CardId.PacifisThePhantasmCity))
{
if(Bot.HasInGraveyard(CardId.PacifisThePhantasmCity))
{
foreach (ClientCard s in Bot.GetGraveyardSpells())
{
if (s.Id == CardId.PacifisThePhantasmCity)
{
AI.SelectYesNo(true);
AI.SelectCard(s);
break;
}
}
}
else
{
foreach (ClientCard s in Bot.Hand)
{
if (s.Id == CardId.PacifisThePhantasmCity)
{
AI.SelectYesNo(true);
AI.SelectCard(s);
break;
}
}
}
}
else
AI.SelectYesNo(false);
return UniqueFaceupSpell();
}
else if(Card.IsFaceup())
{
ClientCard target = null;
foreach(ClientCard s in Bot.GetSpells())
{
if (s.Id == CardId.PacifisThePhantasmCity)
target = s;
}
if (target != null && AI.Utils.IsChainTarget(target))
{
SeaStealthAttackeff_used = true;
return true;
}
target = AI.Utils.GetLastChainCard();
if(target!=null)
{
if(target.Id==CardId.BrandishSkillAfterburner)
{
AI.SelectCard(CardId.MegalosmasherX);
SeaStealthAttackeff_used = true;
return true;
}
if(Enemy.GetGraveyardSpells().Count>=3 && target.Id==CardId.BrandishSkillJammingWave)
{
AI.SelectCard(CardId.MegalosmasherX);
SeaStealthAttackeff_used = true;
return true;
}
}
}
return false;
}
private bool PotOfDesireseff()
{
return Bot.Deck.Count >= 18;
}
private bool Scapegoateff()
{
// if (DefaultSpellWillBeNegated()) return false;
if (Duel.Player == 0) return false;
if (Duel.Phase == DuelPhase.End) return true;
if (DefaultOnBecomeTarget()) return true;
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
int total_atk = 0;
List<ClientCard> enemy_monster = Enemy.GetMonsters();
foreach (ClientCard m in enemy_monster)
{
if (m.IsAttack()) total_atk += m.Attack;
}
if (total_atk >= Bot.LifePoints) return true;
}
return false;
}
private bool StarlightRoadset()
{
if (Duel.Turn > 1 && Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster())
return false;
if (Bot.HasInSpellZone(CardId.TheHugeRevolutionIsOver)) return false;
return true;
}
private bool TheHugeRevolutionIsOverset()
{
if (Duel.Turn > 1 && Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster())
return false;
if (Bot.HasInSpellZone(CardId.StarlightRoad)) return false;
return true;
}
private bool InfiniteImpermanenceset()
{
return !Bot.IsFieldEmpty();
}
private bool NoSetAlreadyDone()
{
if (Duel.Turn > 1 && Duel.Phase == DuelPhase.Main1 && Bot.HasAttackingMonster())
return false;
if (Bot.HasInSpellZone(Card.Id)) return false;
return true;
}
private bool SpellSeteff()
{
if (Card.HasType(CardType.Field)) return false;
if (CardOfDemiseeff_used) return true;
if(Bot.HasInHandOrInSpellZone(CardId.CardOfDemise) && !CardOfDemiseeff_used)
{
int hand_spell_count = 0;
foreach(ClientCard s in Bot.Hand)
{
if (s.HasType(CardType.Trap) || s.HasType(CardType.Spell) && !s.HasType(CardType.Field))
hand_spell_count++;
}
int zone_count = 5 - Bot.GetSpellCountWithoutField();
return zone_count- hand_spell_count >= 1;
}
if(Card.Id==CardId.PhantasmSprialBattle || Card.Id==CardId.PhantasmSpiralPower)
{
if (Bot.HasInMonstersZone(CardId.MegalosmasherX) &&
!Bot.HasInHandOrInSpellZone(CardId.PacifisThePhantasmCity) &&
!Bot.HasInHandOrInSpellZone(CardId.Metaverse))
return true;
}
return false;
}
private bool MonsterRepos()
{
if (Card.Level >= 5)
{
foreach (ClientCard s in Bot.GetSpells())
{
if (s.IsFaceup() && s.Id == CardId.SeaStealthAttack &&
Bot.HasInSpellZone(CardId.PacifisThePhantasmCity) &&
Card.IsAttack())
return false;
}
}
if (Card.Id == CardId.EaterOfMillions && !Card.IsDisabled() && Card.IsAttack())
return false;
return DefaultMonsterRepos();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if(attacker.Id==CardId.PacifisThePhantasmCity+1 && defender.Id==CardId.EaterOfMillions)
{
if (attacker.RealPower >= defender.RealPower) return true;
}
if(attacker.Level>=5)
{
foreach(ClientCard s in Bot.GetSpells())
{
if (s.IsFaceup() && s.Id == CardId.SeaStealthAttack && Bot.HasInSpellZone(CardId.PacifisThePhantasmCity))
{
attacker.RealPower = 9999;
if (defender.Id == CardId.EaterOfMillions) return true;
}
}
}
return base.OnPreBattleBetween(attacker, defender);
}
public override ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
for (int i = 0; i < attackers.Count; ++i)
{
ClientCard attacker = attackers[i];
if (attacker.Id == CardId.EaterOfMillions) return attacker;
}
return null;
}
public override bool OnSelectHand()
{
return true;
}
}
}
\ No newline at end of file
...@@ -358,6 +358,7 @@ namespace WindBot.Game.AI.Decks ...@@ -358,6 +358,7 @@ namespace WindBot.Game.AI.Decks
private bool LightningChidoriEffect() private bool LightningChidoriEffect()
{ {
ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard(); ClientCard problematicCard = AI.Utils.GetProblematicEnemyCard();
AI.SelectCard(0);
AI.SelectNextCard(problematicCard); AI.SelectNextCard(problematicCard);
return true; return true;
} }
...@@ -423,6 +424,7 @@ namespace WindBot.Game.AI.Decks ...@@ -423,6 +424,7 @@ namespace WindBot.Game.AI.Decks
ClientCard result = AI.Utils.GetOneEnemyBetterThanValue(2000, true); ClientCard result = AI.Utils.GetOneEnemyBetterThanValue(2000, true);
if (result != null) if (result != null)
{ {
AI.SelectCard(0);
AI.SelectNextCard(result); AI.SelectNextCard(result);
return true; return true;
} }
......
...@@ -312,6 +312,7 @@ namespace WindBot.Game.AI.Decks ...@@ -312,6 +312,7 @@ namespace WindBot.Game.AI.Decks
ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true); ClientCard target = AI.Utils.GetOneEnemyBetterThanValue(oppoBestAttack, true);
if (target != null) if (target != null)
{ {
AI.SelectCard(0);
AI.SelectNextCard(target); AI.SelectNextCard(target);
} }
return true; return true;
......
...@@ -42,6 +42,19 @@ namespace WindBot.Game.AI ...@@ -42,6 +42,19 @@ namespace WindBot.Game.AI
public const int InjectionFairyLily = 79575620; public const int InjectionFairyLily = 79575620;
public const int BlueEyesChaosMAXDragon = 55410871; public const int BlueEyesChaosMAXDragon = 55410871;
public const int AshBlossom = 14558127;
public const int MaxxC = 23434538;
public const int LockBird = 94145021;
public const int GhostOgreAndSnowRabbit = 59438930;
public const int GhostBelle = 73642296;
public const int EffectVeiler = 63845230;
public const int CalledByTheGrave = 24224830;
public const int InfiniteImpermanence = 10045474;
public const int GalaxySoldier = 46659709;
public const int MacroCosmos = 30241314;
public const int UpstartGoblin = 70368879;
public const int EaterOfMillions = 63845230;
} }
protected DefaultExecutor(GameAI ai, Duel duel) protected DefaultExecutor(GameAI ai, Duel duel)
...@@ -312,6 +325,129 @@ namespace WindBot.Game.AI ...@@ -312,6 +325,129 @@ namespace WindBot.Game.AI
return true; return true;
} }
/// <summary>
/// Always active in opponent's turn.
/// </summary>
protected bool DefaultMaxxC()
{
return Duel.Player == 1;
}
/// <summary>
/// Always disable opponent's effect except some cards like UpstartGoblin
/// </summary>
protected bool DefaultAshBlossomAndJoyousSpring()
{
if (AI.Utils.GetLastChainCard().Id == _CardId.MacroCosmos)
return false;
if (AI.Utils.GetLastChainCard().Id == _CardId.UpstartGoblin)
return false;
return Duel.LastChainPlayer == 1;
}
/// <summary>
/// Always activate unless the activating card is disabled
/// </summary>
protected bool DefaultGhostOgreAndSnowRabbit()
{
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().IsDisabled())
return false;
return DefaultTrap();
}
/// <summary>
/// Always disable opponent's effect
/// </summary>
protected bool DefaultGhostBelleAndHauntedMansion()
{
return DefaultTrap();
}
/// <summary>
/// Same as DefaultBreakthroughSkill
/// </summary>
protected bool DefaultEffectVeiler()
{
if (AI.Utils.GetLastChainCard() != null && AI.Utils.GetLastChainCard().Id == _CardId.GalaxySoldier && Enemy.Hand.Count >= 3) return false;
if (AI.Utils.ChainContainsCard(_CardId.EffectVeiler))
return false;
return DefaultBreakthroughSkill();
}
/// <summary>
/// Chain common hand traps
/// </summary>
protected bool DefaultCalledByTheGrave()
{
if (Duel.LastChainPlayer == 1)
{
if (AI.Utils.GetLastChainCard().Id == _CardId.MaxxC)
{
AI.SelectCard(_CardId.MaxxC);
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == _CardId.LockBird)
{
AI.SelectCard(_CardId.LockBird);
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == _CardId.GhostOgreAndSnowRabbit)
{
AI.SelectCard(_CardId.GhostOgreAndSnowRabbit);
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == _CardId.AshBlossom)
{
AI.SelectCard(_CardId.AshBlossom);
return UniqueFaceupSpell();
}
if (AI.Utils.GetLastChainCard().Id == _CardId.GhostBelle)
{
AI.SelectCard(_CardId.GhostBelle);
return UniqueFaceupSpell();
}
}
return false;
}
/// <summary>
/// Default InfiniteImpermanence effect
/// </summary>
protected bool DefaultInfiniteImpermanence()
{
ClientCard target = Enemy.MonsterZone.GetShouldBeDisabledBeforeItUseEffectMonster();
if (target != null)
{
AI.SelectCard(target);
return true;
}
if (Duel.LastChainPlayer == 1)
{
foreach (ClientCard check in Enemy.GetMonsters())
{
if (AI.Utils.GetLastChainCard() == check)
{
target = check;
break;
}
}
if (target != null && !target.IsDisabled())
{
AI.SelectCard(target);
return true;
}
}
if (Bot.BattlingMonster != null && Enemy.BattlingMonster != null)
{
if (Enemy.BattlingMonster.IsDisabled()) return false;
if (Enemy.BattlingMonster.Id == _CardId.EaterOfMillions)
{
AI.SelectCard(Enemy.BattlingMonster);
return true;
}
}
if (Duel.Phase == DuelPhase.BattleStart && Duel.Player == 1 &&
Enemy.HasInMonstersZone(_CardId.NumberS39UtopiaTheLightning, true))
{
AI.SelectCard(_CardId.NumberS39UtopiaTheLightning);
return UniqueFaceupSpell();
}
return false;
}
/// <summary> /// <summary>
/// Chain the enemy monster, or disable monster like Rescue Rabbit. /// Chain the enemy monster, or disable monster like Rescue Rabbit.
/// </summary> /// </summary>
...@@ -862,6 +998,7 @@ namespace WindBot.Game.AI ...@@ -862,6 +998,7 @@ namespace WindBot.Game.AI
ClientCard target = AI.Utils.GetProblematicEnemyCard(); ClientCard target = AI.Utils.GetProblematicEnemyCard();
if (target != null) if (target != null)
{ {
AI.SelectCard(0);
AI.SelectNextCard(target); AI.SelectNextCard(target);
return true; return true;
} }
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
FirePrison = 269510, FirePrison = 269510,
LairOfDarkness = 59160188, LairOfDarkness = 59160188,
SuperboltThunderDragon = 15291624, SuperboltThunderDragon = 15291624,
ThunderDragonLord = 41685633 ThunderDragonLord = 41685633,
CyberDragonInfinity = 10443957
} }
} }
...@@ -573,6 +573,12 @@ namespace WindBot.Game ...@@ -573,6 +573,12 @@ namespace WindBot.Game
if (mode) if (mode)
{ {
// equal // equal
if (sum == 0 && min == 0)
{
return new List<ClientCard>();
}
if (min <= 1) if (min <= 1)
{ {
// try special level first // try special level first
......
...@@ -27,6 +27,7 @@ namespace WindBot.Game ...@@ -27,6 +27,7 @@ namespace WindBot.Game
private int _hand; private int _hand;
private bool _debug; private bool _debug;
private int _select_hint; private int _select_hint;
private GameMessage _lastMessage;
public GameBehavior(GameClient game) public GameBehavior(GameClient game)
{ {
...@@ -61,6 +62,7 @@ namespace WindBot.Game ...@@ -61,6 +62,7 @@ namespace WindBot.Game
GameMessage msg = (GameMessage)packet.ReadByte(); GameMessage msg = (GameMessage)packet.ReadByte();
if (_messages.ContainsKey(msg)) if (_messages.ContainsKey(msg))
_messages[msg](packet); _messages[msg](packet);
_lastMessage = msg;
return; return;
} }
if (_packets.ContainsKey(id)) if (_packets.ContainsKey(id))
...@@ -312,7 +314,7 @@ namespace WindBot.Game ...@@ -312,7 +314,7 @@ namespace WindBot.Game
{ {
_ai.OnRetry(); _ai.OnRetry();
Connection.Close(); Connection.Close();
throw new Exception("Got MSG_RETRY."); throw new Exception("Got MSG_RETRY. Last message is " + _lastMessage);
} }
private void OnHint(BinaryReader packet) private void OnHint(BinaryReader packet)
...@@ -1314,9 +1316,11 @@ namespace WindBot.Game ...@@ -1314,9 +1316,11 @@ namespace WindBot.Game
{ {
result[index++] = 0; result[index++] = 0;
} }
for (int i = 0; i < selected.Count; ++i) int l = 0;
while (l < selected.Count)
{ {
result[index++] = (byte)selected[i].SelectSeq; result[index++] = (byte)selected[l].SelectSeq;
++l;
} }
BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response); BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response);
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
<Compile Include="Game\AI\Decks\GravekeeperExecutor.cs" /> <Compile Include="Game\AI\Decks\GravekeeperExecutor.cs" />
<Compile Include="Game\AI\Decks\RainbowExecutor.cs" /> <Compile Include="Game\AI\Decks\RainbowExecutor.cs" />
<Compile Include="Game\AI\Decks\BlueEyesExecutor.cs" /> <Compile Include="Game\AI\Decks\BlueEyesExecutor.cs" />
<Compile Include="Game\AI\Decks\BlueEyesMaxDragonExecutor.cs" />
<Compile Include="Game\AI\Decks\BurnExecutor.cs" /> <Compile Include="Game\AI\Decks\BurnExecutor.cs" />
<Compile Include="Game\AI\Decks\ChainBurnExecutor.cs" /> <Compile Include="Game\AI\Decks\ChainBurnExecutor.cs" />
<Compile Include="Game\AI\Decks\EvilswarmExecutor.cs" /> <Compile Include="Game\AI\Decks\EvilswarmExecutor.cs" />
...@@ -85,6 +86,7 @@ ...@@ -85,6 +86,7 @@
<Compile Include="Game\AI\Decks\GrenMajuThunderBoarderExecutor.cs" /> <Compile Include="Game\AI\Decks\GrenMajuThunderBoarderExecutor.cs" />
<Compile Include="Game\AI\Decks\LightswornExecutor.cs" /> <Compile Include="Game\AI\Decks\LightswornExecutor.cs" />
<Compile Include="Game\AI\Decks\LightswornShaddoldinosourExecutor.cs" /> <Compile Include="Game\AI\Decks\LightswornShaddoldinosourExecutor.cs" />
<Compile Include="Game\AI\Decks\PhantasmExecutor.cs" />
<Compile Include="Game\AI\Decks\QliphortExecutor.cs" /> <Compile Include="Game\AI\Decks\QliphortExecutor.cs" />
<Compile Include="Game\AI\Decks\ST1732Executor.cs" /> <Compile Include="Game\AI\Decks\ST1732Executor.cs" />
<Compile Include="Game\AI\Decks\TrickstarExecutor.cs" /> <Compile Include="Game\AI\Decks\TrickstarExecutor.cs" />
......
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