Commit 0111d23e authored by Momobako's avatar Momobako

merge

parents 8a7a0f01 d5ee2352
#created by ...
#main
46986414
46986414
46986414
30603688
30603688
30603688
71007216
71007216
7084129
7084129
7084129
43722862
43722862
14558127
14558127
14824019
23434538
70117860
1784686
1784686
2314238
23314220
70368879
70368879
89739383
41735184
73616671
47222536
47222536
47222536
67775894
67775894
7922915
7922915
7922915
48680970
48680970
48680970
40605147
40605147
#extra
41721210
41721210
50954680
58074177
90036274
14577226
16691074
22110647
80117527
71384012
71384012
71384012
1482001
!side
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
80280944 80280944
48048590 48048590
77723643 77723643
77723643
55623480 55623480
30328508 30328508
30328508 30328508
......
using System.Collections.Generic; using System.Collections.Generic;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
namespace WindBot.Game.AI namespace WindBot.Game.AI
{ {
public class AIFunctions public class AIFunctions
...@@ -151,6 +150,25 @@ namespace WindBot.Game.AI ...@@ -151,6 +150,25 @@ namespace WindBot.Game.AI
return bestMonster; return bestMonster;
} }
public ClientCard GetWorstBotMonster(bool onlyATK = false)
{
int WorstPower = -1;
ClientCard WorstMonster = null;
for (int i = 0; i < 7; ++i)
{
ClientCard card = Bot.MonsterZone[i];
if (card == null || card.Data == null) continue;
if (onlyATK && card.IsDefense()) continue;
int newPower = card.GetDefensePower();
if (newPower < WorstPower)
{
WorstPower = newPower;
WorstMonster = card;
}
}
return WorstMonster;
}
public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false) public ClientCard GetOneEnemyBetterThanValue(int value, bool onlyATK = false, bool canBeTarget = false)
{ {
ClientCard bestCard = null; ClientCard bestCard = null;
...@@ -250,12 +268,31 @@ namespace WindBot.Game.AI ...@@ -250,12 +268,31 @@ namespace WindBot.Game.AI
List<ClientCard> monsters = Enemy.GetMonsters(); List<ClientCard> monsters = Enemy.GetMonsters();
// after GetHighestAttackMonster, the left monsters must be face-down. // after GetHighestAttackMonster, the left monsters must be face-down.
if (monsters.Count > 0 && !onlyFaceup && (!canBeTarget || !card.IsShouldNotBeTarget())) if (monsters.Count > 0 && !onlyFaceup)
return monsters[0]; return monsters[0];
return null; return null;
} }
public ClientCard GetWorstEnemyMonster(bool onlyATK = false)
{
int WorstPower = -1;
ClientCard WorstMonster = null;
for (int i = 0; i < 7; ++i)
{
ClientCard card = Enemy.MonsterZone[i];
if (card == null || card.Data == null) continue;
if (onlyATK && card.IsDefense()) continue;
int newPower = card.GetDefensePower();
if (newPower < WorstPower)
{
WorstPower = newPower;
WorstMonster = card;
}
}
return WorstMonster;
}
public ClientCard GetBestEnemySpell(bool onlyFaceup = false) public ClientCard GetBestEnemySpell(bool onlyFaceup = false)
{ {
ClientCard card = GetProblematicEnemySpell(); ClientCard card = GetProblematicEnemySpell();
...@@ -337,6 +374,16 @@ namespace WindBot.Game.AI ...@@ -337,6 +374,16 @@ namespace WindBot.Game.AI
return count; return count;
} }
public bool ChainContainPlayer(int player)
{
foreach (ClientCard card in Duel.CurrentChain)
{
if (card.Controller == player)
return true;
}
return false;
}
public bool HasChainedTrap(int player) public bool HasChainedTrap(int player)
{ {
foreach (ClientCard card in Duel.CurrentChain) foreach (ClientCard card in Duel.CurrentChain)
......
...@@ -11,7 +11,8 @@ namespace WindBot.Game.AI.Decks ...@@ -11,7 +11,8 @@ namespace WindBot.Game.AI.Decks
{ {
public class CardId public class CardId
{ {
public const int SandaionTheTimloard = 100227025; public const int SandaionTheTimelord = 100227025;
public const int MichionTimelord = 100227021;
public const int Mathematician = 41386308; public const int Mathematician = 41386308;
public const int DiceJar = 3549275; public const int DiceJar = 3549275;
public const int CardcarD = 45812361; public const int CardcarD = 45812361;
...@@ -48,16 +49,18 @@ namespace WindBot.Game.AI.Decks ...@@ -48,16 +49,18 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.PotOfDesires); AddExecutor(ExecutorType.Activate, CardId.PotOfDesires);
AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityeff); AddExecutor(ExecutorType.Activate, CardId.PotOfDuality, PotOfDualityeff);
//normal summon //normal summon
AddExecutor(ExecutorType.Summon, CardId.MichionTimelord, MichionTimelordsummon);
AddExecutor(ExecutorType.Summon, CardId.SandaionTheTimelord, SandaionTheTimelord_summon);
AddExecutor(ExecutorType.Summon, CardId.Mathematician); AddExecutor(ExecutorType.Summon, CardId.Mathematician);
AddExecutor(ExecutorType.Activate, CardId.Mathematician, Mathematicianeff); AddExecutor(ExecutorType.Activate, CardId.Mathematician, Mathematicianeff);
AddExecutor(ExecutorType.MonsterSet, CardId.DiceJar); AddExecutor(ExecutorType.MonsterSet, CardId.DiceJar);
AddExecutor(ExecutorType.Activate, CardId.DiceJar); AddExecutor(ExecutorType.Activate, CardId.DiceJar);
AddExecutor(ExecutorType.Summon, CardId.CardcarD);
AddExecutor(ExecutorType.Summon, CardId.AbouluteKingBackJack, AbouluteKingBackJacksummon); AddExecutor(ExecutorType.Summon, CardId.AbouluteKingBackJack, AbouluteKingBackJacksummon);
AddExecutor(ExecutorType.MonsterSet, CardId.AbouluteKingBackJack); AddExecutor(ExecutorType.MonsterSet, CardId.AbouluteKingBackJack);
AddExecutor(ExecutorType.Activate, CardId.AbouluteKingBackJack, AbouluteKingBackJackeff);
AddExecutor(ExecutorType.Summon, CardId.CardcarD); AddExecutor(ExecutorType.Activate, CardId.MichionTimelord);
AddExecutor(ExecutorType.Summon, CardId.SandaionTheTimloard, SandaionTheTimloard_summon); AddExecutor(ExecutorType.Activate, CardId.SandaionTheTimelord, SandaionTheTimelordeff);
AddExecutor(ExecutorType.Activate, CardId.SandaionTheTimloard, SandaionTheTimloardeff);
// Set traps // Set traps
AddExecutor(ExecutorType.SpellSet, CardId.Waboku); AddExecutor(ExecutorType.SpellSet, CardId.Waboku);
AddExecutor(ExecutorType.SpellSet, CardId.ThreateningRoar); AddExecutor(ExecutorType.SpellSet, CardId.ThreateningRoar);
...@@ -71,31 +74,33 @@ namespace WindBot.Game.AI.Decks ...@@ -71,31 +74,33 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.BalanceOfJudgment, BalanceOfJudgmenteff); AddExecutor(ExecutorType.Activate, CardId.BalanceOfJudgment, BalanceOfJudgmenteff);
AddExecutor(ExecutorType.Activate, CardId.AccuulatedFortune); AddExecutor(ExecutorType.Activate, CardId.AccuulatedFortune);
//battle //battle
AddExecutor(ExecutorType.Activate, CardId.BlazingMirrorForce, BlazingMirrorForceeff);
AddExecutor(ExecutorType.Activate, CardId.MagicCylinder, MagicCylindereff);
AddExecutor(ExecutorType.Activate, CardId.ThreateningRoar, ThreateningRoareff); AddExecutor(ExecutorType.Activate, CardId.ThreateningRoar, ThreateningRoareff);
AddExecutor(ExecutorType.Activate, CardId.Waboku, Wabokueff); AddExecutor(ExecutorType.Activate, CardId.Waboku, Wabokueff);
AddExecutor(ExecutorType.Activate, CardId.BattleFader, BattleFadereff); AddExecutor(ExecutorType.Activate, CardId.BattleFader, BattleFadereff);
AddExecutor(ExecutorType.Activate, CardId.MagicCylinder, MagicCylindereff);
AddExecutor(ExecutorType.Activate, CardId.BlazingMirrorForce, BlazingMirrorForceeff);
AddExecutor(ExecutorType.Activate, CardId.RingOfDestruction, Ring_act); AddExecutor(ExecutorType.Activate, CardId.RingOfDestruction, Ring_act);
//chain //chain
AddExecutor(ExecutorType.Activate, CardId.JustDesserts, JustDessertseff); AddExecutor(ExecutorType.Activate, CardId.JustDesserts, JustDessertseff);
AddExecutor(ExecutorType.Activate, CardId.OjamaTrio, OjamaTrioeff);
AddExecutor(ExecutorType.Activate, CardId.Ceasefire, Ceasefireeff); AddExecutor(ExecutorType.Activate, CardId.Ceasefire, Ceasefireeff);
AddExecutor(ExecutorType.Activate, CardId.SecretBlast, SecretBlasteff); AddExecutor(ExecutorType.Activate, CardId.SecretBlast, SecretBlasteff);
AddExecutor(ExecutorType.Activate, CardId.SectetBarrel, SectetBarreleff); AddExecutor(ExecutorType.Activate, CardId.SectetBarrel, SectetBarreleff);
AddExecutor(ExecutorType.Activate, CardId.RecklessGreed, RecklessGreedeff); AddExecutor(ExecutorType.Activate, CardId.RecklessGreed, RecklessGreedeff);
AddExecutor(ExecutorType.Activate, CardId.OjamaTrio, OjamaTrioeff);
AddExecutor(ExecutorType.Activate, CardId.AbouluteKingBackJack, AbouluteKingBackJackeff);
AddExecutor(ExecutorType.Activate, CardId.ChainStrike, ChainStrikeeff); AddExecutor(ExecutorType.Activate, CardId.ChainStrike, ChainStrikeeff);
//sp //sp
AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh); AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh);
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff); AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
AddExecutor(ExecutorType.Repos, MonsterRepos);
} }
public int[] all_List() public int[] all_List()
{ {
return new[] return new[]
{ {
CardId.SandaionTheTimloard, CardId.SandaionTheTimelord,
CardId.MichionTimelord,
CardId.Mathematician, CardId.Mathematician,
CardId.DiceJar, CardId.DiceJar,
CardId.CardcarD, CardId.CardcarD,
...@@ -143,7 +148,8 @@ namespace WindBot.Game.AI.Decks ...@@ -143,7 +148,8 @@ namespace WindBot.Game.AI.Decks
public int[] AbouluteKingBackJack_List_2() public int[] AbouluteKingBackJack_List_2()
{ {
return new[] { return new[] {
CardId.SandaionTheTimloard, CardId.MichionTimelord,
CardId.SandaionTheTimelord,
CardId.PotOfDesires, CardId.PotOfDesires,
CardId.Mathematician, CardId.Mathematician,
CardId.DiceJar, CardId.DiceJar,
...@@ -186,7 +192,8 @@ namespace WindBot.Game.AI.Decks ...@@ -186,7 +192,8 @@ namespace WindBot.Game.AI.Decks
return new[] return new[]
{ {
CardId.PotOfDesires, CardId.PotOfDesires,
CardId.SandaionTheTimloard, CardId.MichionTimelord,
CardId.SandaionTheTimelord,
CardId.BattleFader, CardId.BattleFader,
CardId.Waboku, CardId.Waboku,
...@@ -218,8 +225,9 @@ namespace WindBot.Game.AI.Decks ...@@ -218,8 +225,9 @@ namespace WindBot.Game.AI.Decks
} }
public bool Has_prevent_list_1(int id) public bool Has_prevent_list_1(int id)
{ {
return (id == CardId.SandaionTheTimloard || return (id == CardId.SandaionTheTimelord ||
id == CardId.BattleFader id == CardId.BattleFader ||
id ==CardId.MichionTimelord
); );
} }
bool no_sp = false; bool no_sp = false;
...@@ -228,11 +236,12 @@ namespace WindBot.Game.AI.Decks ...@@ -228,11 +236,12 @@ namespace WindBot.Game.AI.Decks
int expected_blood = 0; int expected_blood = 0;
bool prevent_used = false; bool prevent_used = false;
int preventcount = 0; int preventcount = 0;
bool battleprevent = false;
bool OjamaTrioused = false; bool OjamaTrioused = false;
bool OjamaTrioused_draw = false; bool OjamaTrioused_draw = false;
bool OjamaTrioused_do = false;
bool drawfirst = false; bool drawfirst = false;
bool Linkuribohused = true; bool Linkuribohused = true;
bool Timelord_check = false;
int Waboku_count = 0; int Waboku_count = 0;
int Roar_count = 0; int Roar_count = 0;
int strike_count = 0; int strike_count = 0;
...@@ -242,6 +251,7 @@ namespace WindBot.Game.AI.Decks ...@@ -242,6 +251,7 @@ namespace WindBot.Game.AI.Decks
int just_count = 0; int just_count = 0;
int Ojama_count = 0; int Ojama_count = 0;
int HasAccuulatedFortune = 0; int HasAccuulatedFortune = 0;
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
return true; return true;
...@@ -249,17 +259,16 @@ namespace WindBot.Game.AI.Decks ...@@ -249,17 +259,16 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn() public override void OnNewTurn()
{ {
if (Bot.HasInHand(CardId.SandaionTheTimelord) ||Bot.HasInHand(CardId.MichionTimelord))
Logger.DebugWriteLine("2222222222222222SandaionTheTimelord");
no_sp = false; no_sp = false;
prevent_used = false; prevent_used = false;
Linkuribohused = true; Linkuribohused = true;
Timelord_check = false;
} }
public override void OnNewPhase() public override void OnNewPhase()
{ {
preventcount = 0; preventcount = 0;
battleprevent = false;
OjamaTrioused = false; OjamaTrioused = false;
IList<ClientCard> trap = Bot.GetSpells(); IList<ClientCard> trap = Bot.GetSpells();
...@@ -270,24 +279,35 @@ namespace WindBot.Game.AI.Decks ...@@ -270,24 +279,35 @@ namespace WindBot.Game.AI.Decks
if (Has_prevent_list_0(card.Id)) if (Has_prevent_list_0(card.Id))
{ {
preventcount++; preventcount++;
battleprevent = true;
} }
} }
foreach (ClientCard card in monster) foreach (ClientCard card in monster)
{ {
if (Has_prevent_list_1(card.Id)) if (Has_prevent_list_1(card.Id))
{ {
preventcount++; preventcount++;
battleprevent = true;
} }
} }
foreach (ClientCard card in monster)
{
if (Bot.HasInMonstersZone(CardId.SandaionTheTimelord) ||
Bot.HasInMonstersZone(CardId.MichionTimelord))
{
prevent_used = true;
Timelord_check = true;
}
}
if(prevent_used && Timelord_check)
{
if (!Bot.HasInMonstersZone(CardId.SandaionTheTimelord) ||
!Bot.HasInMonstersZone(CardId.MichionTimelord))
prevent_used = false;
}
expected_blood = 0; expected_blood = 0;
one_turn_kill = false; one_turn_kill = false;
one_turn_kill_1 = false; one_turn_kill_1 = false;
OjamaTrioused_draw = false; OjamaTrioused_draw = false;
OjamaTrioused_do = false;
drawfirst = false; drawfirst = false;
HasAccuulatedFortune = 0; HasAccuulatedFortune = 0;
strike_count = 0; strike_count = 0;
...@@ -348,11 +368,6 @@ namespace WindBot.Game.AI.Decks ...@@ -348,11 +368,6 @@ namespace WindBot.Game.AI.Decks
Roar_count++; Roar_count++;
} }
if (Bot.HasInSpellZone(CardId.OjamaTrio) && Enemy.GetMonsterCount() <= 2 && Enemy.GetMonsterCount() >= 1)
{
if (HasAccuulatedFortune>0) OjamaTrioused_draw = true;
}
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count); expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count);
if (Enemy.LifePoints <= expected_blood && Duel.Player == 1) if (Enemy.LifePoints <= expected_blood && Duel.Player == 1)
{ {
...@@ -366,21 +381,35 @@ namespace WindBot.Game.AI.Decks ...@@ -366,21 +381,35 @@ namespace WindBot.Game.AI.Decks
if (barrel_count >= 2) barrel_count = 1; if (barrel_count >= 2) barrel_count = 1;
if (Waboku_count >= 2) Waboku_count = 1; if (Waboku_count >= 2) Waboku_count = 1;
if (Roar_count >= 2) Roar_count = 1; if (Roar_count >= 2) Roar_count = 1;
if (strike_count >= 2) strike_count = 1;
int currentchain = 0; int currentchain = 0;
if (OjamaTrioused_draw) if (OjamaTrioused_do)
currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + Roar_count + greed_count + strike_count + Ojama_count; currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + Roar_count + greed_count + Ojama_count;
else else
currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + greed_count + Roar_count + strike_count; currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + greed_count + Roar_count;
//if (currentchain >= 3 && Duel.Player == 1) drawfirst = true; //if (currentchain >= 3 && Duel.Player == 1) drawfirst = true;
currentchain = Duel.CurrentChain.Count+ blast_count + just_count+barrel_count; if (Bot.HasInSpellZone(CardId.ChainStrike))
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count+(currentchain+1)*400);
/*if (!one_turn_kill && Enemy.LifePoints <= expected_blood && Duel.Player == 1)
{ {
Logger.DebugWriteLine(" one_turn_kill_1"); if (strike_count == 1)
{
if (OjamaTrioused_do)
expected_blood = ((Enemy.GetMonsterCount() + 3) * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1) * 400);
else
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1) * 400);
}
else
{
if (OjamaTrioused_do)
expected_blood = ((Enemy.GetMonsterCount() + 3) * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1 + currentchain + 2) * 400);
else
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1 + currentchain + 2) * 400);
}
if (!one_turn_kill && Enemy.LifePoints <= expected_blood && Duel.Player == 1)
{
Logger.DebugWriteLine(" %%%%%%%%%%%%%%%%%one_turn_kill_1");
one_turn_kill_1 = true; one_turn_kill_1 = true;
}*/ OjamaTrioused = true;
}
}
} }
...@@ -406,11 +435,17 @@ namespace WindBot.Game.AI.Decks ...@@ -406,11 +435,17 @@ namespace WindBot.Game.AI.Decks
if (Card.Id == CardId.OjamaTrio && Bot.HasInSpellZone(CardId.OjamaTrio))return false; if (Card.Id == CardId.OjamaTrio && Bot.HasInSpellZone(CardId.OjamaTrio))return false;
return (Card.IsTrap() || Card.HasType(CardType.QuickPlay)) && Bot.GetSpellCountWithoutField() < 5; return (Card.IsTrap() || Card.HasType(CardType.QuickPlay)) && Bot.GetSpellCountWithoutField() < 5;
} }
private bool SandaionTheTimloard_summon() private bool MichionTimelordsummon()
{ {
if (!battleprevent) if (Duel.Turn == 1)
return true;
return false; return false;
return true;
}
private bool SandaionTheTimelord_summon()
{
Logger.DebugWriteLine("&&&&&&&&&SandaionTheTimelord_summon");
return true;
} }
private bool AbouluteKingBackJacksummon() private bool AbouluteKingBackJacksummon()
{ {
...@@ -434,34 +469,28 @@ namespace WindBot.Game.AI.Decks ...@@ -434,34 +469,28 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(pot_list()); AI.SelectCard(pot_list());
return true; return true;
} }
private bool BlazingMirrorForceeff()
{
if (prevent_used) return false;
IList<ClientCard> list = new List<ClientCard>();
foreach (ClientCard monster in Enemy.GetMonsters())
{
list.Add(monster);
}
//if (GetTotalATK(list) / 2 >= Bot.LifePoints) return false;
if (GetTotalATK(list) < 3000) return false;
return Enemy.HasAttackingMonster() && DefaultUniqueTrap();
}
private bool ThreateningRoareff() private bool ThreateningRoareff()
{ {
if (one_turn_kill_1) return UniqueFaceupSpell();
if (drawfirst) return true; if (drawfirst) return true;
if (DefaultOnBecomeTarget()) return DefaultUniqueTrap(); if (DefaultOnBecomeTarget())
{
prevent_used = true;
return true;
}
if (prevent_used || Duel.Phase != DuelPhase.BattleStart) return false; if (prevent_used || Duel.Phase != DuelPhase.BattleStart) return false;
prevent_used = true; prevent_used = true;
return DefaultUniqueTrap(); return DefaultUniqueTrap();
} }
private bool SandaionTheTimloardeff() private bool SandaionTheTimelordeff()
{ {
Logger.DebugWriteLine("***********SandaionTheTimelordeff");
prevent_used = true;
return true; return true;
} }
private bool Wabokueff() private bool Wabokueff()
{ {
if (one_turn_kill_1) return UniqueFaceupSpell();
if (drawfirst) if (drawfirst)
{ {
Linkuribohused = false; Linkuribohused = false;
...@@ -470,7 +499,8 @@ namespace WindBot.Game.AI.Decks ...@@ -470,7 +499,8 @@ namespace WindBot.Game.AI.Decks
if (DefaultOnBecomeTarget()) if (DefaultOnBecomeTarget())
{ {
Linkuribohused = false; Linkuribohused = false;
return DefaultUniqueTrap(); prevent_used = true;
return true;
} }
if (prevent_used||Duel.Player == 0||Duel.Phase!=DuelPhase.BattleStart) return false; if (prevent_used||Duel.Player == 0||Duel.Phase!=DuelPhase.BattleStart) return false;
prevent_used = true; prevent_used = true;
...@@ -479,16 +509,38 @@ namespace WindBot.Game.AI.Decks ...@@ -479,16 +509,38 @@ namespace WindBot.Game.AI.Decks
} }
private bool BattleFadereff() private bool BattleFadereff()
{ {
if (AI.Utils.ChainContainsCard(CardId.BlazingMirrorForce) || AI.Utils.ChainContainsCard(CardId.MagicCylinder))
return false;
if (prevent_used || Duel.Player == 0) return false; if (prevent_used || Duel.Player == 0) return false;
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
prevent_used = true; prevent_used = true;
return true; return true;
} }
private bool BlazingMirrorForceeff()
{
if (prevent_used) return false;
IList<ClientCard> list = new List<ClientCard>();
foreach (ClientCard monster in Enemy.GetMonsters())
{
if (monster.IsAttack())
list.Add(monster);
}
if (GetTotalATK(list) / 2 >= Bot.LifePoints) return false;
Logger.DebugWriteLine("!!!!!!!!BlazingMirrorForceeff" + GetTotalATK(list) / 2);
if (GetTotalATK(list) / 2 >= Enemy.LifePoints) return DefaultUniqueTrap();
if (GetTotalATK(list) < 3000) return false;
prevent_used = true;
return DefaultUniqueTrap();
}
private bool MagicCylindereff() private bool MagicCylindereff()
{ {
if (prevent_used) return false; if (prevent_used) return false;
if (Bot.LifePoints <= Enemy.BattlingMonster.Attack) return DefaultUniqueTrap(); if (Bot.LifePoints <= Enemy.BattlingMonster.Attack) return DefaultUniqueTrap();
if(Enemy.BattlingMonster.Attack>1800) return DefaultUniqueTrap(); if (Enemy.LifePoints <= Enemy.BattlingMonster.Attack) return DefaultUniqueTrap();
if (Enemy.BattlingMonster.Attack>1800) return DefaultUniqueTrap();
return false; return false;
} }
public bool Ring_act() public bool Ring_act()
...@@ -509,6 +561,7 @@ namespace WindBot.Game.AI.Decks ...@@ -509,6 +561,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool RecklessGreedeff() private bool RecklessGreedeff()
{ {
if (one_turn_kill_1) return UniqueFaceupSpell();
int count=0; int count=0;
foreach (ClientCard card in Bot.GetSpells()) foreach (ClientCard card in Bot.GetSpells())
{ {
...@@ -517,33 +570,54 @@ namespace WindBot.Game.AI.Decks ...@@ -517,33 +570,54 @@ namespace WindBot.Game.AI.Decks
} }
bool Demiseused = AI.Utils.ChainContainsCard(CardId.CardOfDemise); bool Demiseused = AI.Utils.ChainContainsCard(CardId.CardOfDemise);
if (drawfirst) return DefaultUniqueTrap(); if (drawfirst) return UniqueFaceupSpell();
if (DefaultOnBecomeTarget() && count > 1) return true; if (DefaultOnBecomeTarget() && count > 1) return true;
if (Demiseused) return false; if (Demiseused) return false;
if (count > 1) return true; if (count > 1) return true;
if (Bot.LifePoints <= 2000) return true; if (Bot.LifePoints <= 3000) return true;
if (Bot.GetHandCount() <1 && Duel.Player==0 && Duel.Phase!=DuelPhase.Standby) return true; if (Bot.GetHandCount() <1 && Duel.Player==0 && Duel.Phase!=DuelPhase.Standby) return true;
return false; return false;
} }
private bool SectetBarreleff() private bool SectetBarreleff()
{ {
if (drawfirst) return DefaultUniqueTrap(); if (DefaultOnBecomeTarget()) return true;
if (one_turn_kill_1) return DefaultUniqueTrap(); if (Duel.Player == 0) return false;
if (one_turn_kill) return DefaultUniqueTrap(); if (drawfirst) return true;
if (one_turn_kill_1) return UniqueFaceupSpell();
if (one_turn_kill) return true;
if (DefaultOnBecomeTarget()) return true; if (DefaultOnBecomeTarget()) return true;
int count = Enemy.GetFieldHandCount(); int count = Enemy.GetFieldHandCount();
int monster_count = Enemy.GetMonsterCount() - Enemy.GetMonstersExtraZoneCount();
if (Enemy.LifePoints < count * 200) return true; if (Enemy.LifePoints < count * 200) return true;
if (Bot.HasInSpellZone(CardId.OjamaTrio) && monster_count <= 2 && monster_count >= 1)
{
if (count + 3 >= 8)
{
OjamaTrioused = true;
return true;
}
}
if (count >= 8) return true; if (count >= 8) return true;
return false; return false;
} }
private bool SecretBlasteff() private bool SecretBlasteff()
{ {
if (drawfirst) return DefaultUniqueTrap();
if (one_turn_kill_1) return DefaultUniqueTrap();
if (one_turn_kill) return DefaultUniqueTrap();
if (DefaultOnBecomeTarget()) return true; if (DefaultOnBecomeTarget()) return true;
if (Duel.Player == 0) return false;
if (drawfirst) return UniqueFaceupSpell();
if (one_turn_kill_1) return UniqueFaceupSpell();
if (one_turn_kill) return true;
int count = Enemy.GetFieldCount(); int count = Enemy.GetFieldCount();
int monster_count = Enemy.GetMonsterCount() - Enemy.GetMonstersExtraZoneCount();
if (Enemy.LifePoints < count * 300) return true; if (Enemy.LifePoints < count * 300) return true;
if(Bot.HasInSpellZone(CardId.OjamaTrio) && monster_count <= 2 && monster_count >= 1 )
{
if(count+3>=5)
{
OjamaTrioused = true;
return true;
}
}
if (count >= 5) return true; if (count >= 5) return true;
return false; return false;
...@@ -555,24 +629,25 @@ namespace WindBot.Game.AI.Decks ...@@ -555,24 +629,25 @@ namespace WindBot.Game.AI.Decks
} }
private bool JustDessertseff() private bool JustDessertseff()
{ {
if (Duel.Player == 0) return false;
if (drawfirst) return DefaultUniqueTrap();
if (one_turn_kill_1) return DefaultUniqueTrap();
if (one_turn_kill) return DefaultUniqueTrap();
if (DefaultOnBecomeTarget()) return true; if (DefaultOnBecomeTarget()) return true;
int count = Enemy.GetMonsterCount(); if (Duel.Player == 0) return false;
if (drawfirst) return UniqueFaceupSpell();
if (one_turn_kill_1) return UniqueFaceupSpell();
if (one_turn_kill) return true;
int count = Enemy.GetMonsterCount()-Enemy.GetMonstersExtraZoneCount();
if (Enemy.LifePoints <= count * 500) return true; if (Enemy.LifePoints <= count * 500) return true;
if (Bot.HasInSpellZone(CardId.OjamaTrio) && count <= 2 && count >= 1) if (Bot.HasInSpellZone(CardId.OjamaTrio) && count <= 2 && count >= 1)
{ {
OjamaTrioused = true; OjamaTrioused = true;
return true; return true;
} }
if (count >= 4) return true; if (count >= 3) return true;
return false; return false;
} }
private bool ChainStrikeeff() private bool ChainStrikeeff()
{ {
if (one_turn_kill) return true;
if (one_turn_kill_1) return true;
if (drawfirst) return true; if (drawfirst) return true;
if (DefaultOnBecomeTarget()) return true; if (DefaultOnBecomeTarget()) return true;
int chain = Duel.CurrentChain.Count; int chain = Duel.CurrentChain.Count;
...@@ -634,10 +709,10 @@ namespace WindBot.Game.AI.Decks ...@@ -634,10 +709,10 @@ namespace WindBot.Game.AI.Decks
} }
private bool Linkuriboheff() private bool Linkuriboheff()
{ {
IList<ClientCard> newlist = new List<ClientCard>(); IList<ClientCard> newlist = new List<ClientCard>();
foreach (ClientCard newmonster in Enemy.GetMonsters()) foreach (ClientCard newmonster in Enemy.GetMonsters())
{ {
if (newmonster.IsAttack())
newlist.Add(newmonster); newlist.Add(newmonster);
} }
if (!Linkuribohused) return false; if (!Linkuribohused) return false;
...@@ -645,47 +720,155 @@ namespace WindBot.Game.AI.Decks ...@@ -645,47 +720,155 @@ namespace WindBot.Game.AI.Decks
{ {
if (Enemy.BattlingMonster.Attack > 1800 && Bot.HasInSpellZone(CardId.MagicCylinder)) return false; if (Enemy.BattlingMonster.Attack > 1800 && Bot.HasInSpellZone(CardId.MagicCylinder)) return false;
} }
if (GetTotalATK(newlist) >= 3000 && Bot.HasInSpellZone(CardId.BlazingMirrorForce)) return false; if (GetTotalATK(newlist) / 2 >= Bot.LifePoints && Bot.HasInSpellZone(CardId.BlazingMirrorForce))
return true;
if (GetTotalATK(newlist) / 2 >= Enemy.LifePoints && Bot.HasInSpellZone(CardId.BlazingMirrorForce))
return false;
if (AI.Utils.GetLastChainCard() == null) return true; if (AI.Utils.GetLastChainCard() == null) return true;
if (AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh)return false; if (AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false;
return true; return true;
} }
public bool MonsterRepos()
{
if (Card.IsFacedown() && Card.Id!=CardId.DiceJar)
return true;
return base.DefaultMonsterRepos();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (attacker.Id == CardId.Linkuriboh && defender.IsFacedown()) return false; if (attacker.Id == CardId.Linkuriboh && defender.IsFacedown()) return false;
if (attacker.Id == CardId.SandaionTheTimelord && !attacker.IsDisabled())
{
attacker.RealPower = 9999;
return true;
}
if(attacker.Id==CardId.MichionTimelord && !attacker.IsDisabled())
{
attacker.RealPower = 9999;
return true;
}
return base.OnPreBattleBetween(attacker,defender); return base.OnPreBattleBetween(attacker,defender);
} }
/*private bool SwordsOfRevealingLight()
public override void OnChaining(int player, ClientCard card)
{ {
int count = Bot.SpellZone.GetCardCount(CardId.SwordsOfRevealingLight); expected_blood = 0;
return count == 0; one_turn_kill = false;
}*/ one_turn_kill_1 = false;
OjamaTrioused_draw = false;
OjamaTrioused_do = false;
drawfirst = false;
HasAccuulatedFortune = 0;
strike_count = 0;
greed_count = 0;
blast_count = 0;
barrel_count = 0;
just_count = 0;
Waboku_count = 0;
Roar_count = 0;
Ojama_count = 0;
/* IList<ClientCard> check = Bot.GetSpells();
private bool SetInvincibleMonster() foreach (ClientCard card1 in check)
{ {
foreach (ClientCard card in Bot.GetMonsters()) if (card1.Id == CardId.AccuulatedFortune)
HasAccuulatedFortune++;
}
foreach (ClientCard card1 in check)
{ {
if (card.Id == CardId.Marshmallon || card.Id == CardId.SpiritReaper) if (card1.Id == CardId.SecretBlast)
blast_count++;
}
foreach (ClientCard card1 in check)
{ {
return false; if (card1.Id == CardId.SectetBarrel)
barrel_count++;
} }
foreach (ClientCard card1 in check)
{
if (card1.Id == CardId.JustDesserts)
just_count++;
} }
return true; foreach (ClientCard card1 in check)
}*/ {
if (card1.Id == CardId.ChainStrike)
strike_count++;
}
foreach (ClientCard card1 in Bot.GetSpells())
{
if (card1.Id == CardId.RecklessGreed)
greed_count++;
/* }
private bool ReposEverything() foreach (ClientCard card1 in check)
{ {
if (Card.Id == CardId.ReflectBounder) if (card1.Id == CardId.Waboku)
return Card.IsDefense(); Waboku_count++;
if (Card.Id == CardId.FencingFireFerret)
return DefaultMonsterRepos(); }
if (Card.IsAttack()) foreach (ClientCard card1 in check)
return true; {
return false; if (card1.Id == CardId.ThreateningRoar)
Roar_count++;
}
/*if (Bot.HasInSpellZone(CardId.OjamaTrio) && Enemy.GetMonsterCount() <= 2 && Enemy.GetMonsterCount() >= 1)
{
if (HasAccuulatedFortune > 0) OjamaTrioused_draw = true;
}*/ }*/
if (Bot.HasInSpellZone(CardId.OjamaTrio) && (Enemy.GetMonsterCount() - Enemy.GetMonstersExtraZoneCount()) <= 2 &&
(Enemy.GetMonsterCount() - Enemy.GetMonstersExtraZoneCount()) >= 1)
{
OjamaTrioused_do = true;
}
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count);
if (Enemy.LifePoints <= expected_blood && Duel.Player == 1)
{
Logger.DebugWriteLine(" %%%%%%%%%%%%%%%%%one_turn_kill");
one_turn_kill = true;
}
expected_blood = 0;
if (greed_count >= 2) greed_count = 1;
if (blast_count >= 2) blast_count = 1;
if (just_count >= 2) just_count = 1;
if (barrel_count >= 2) barrel_count = 1;
if (Waboku_count >= 2) Waboku_count = 1;
if (Roar_count >= 2) Roar_count = 1;
int currentchain = 0;
if (OjamaTrioused_do)
currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + Roar_count + greed_count + Ojama_count;
else
currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + greed_count + Roar_count ;
//if (currentchain >= 3 && Duel.Player == 1) drawfirst = true;
if(Bot.HasInSpellZone(CardId.ChainStrike))
{
if (strike_count == 1)
{
if (OjamaTrioused_do)
expected_blood = ((Enemy.GetMonsterCount() + 3) * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1) * 400);
else
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1) * 400);
}
else
{
if (OjamaTrioused_do)
expected_blood = ((Enemy.GetMonsterCount() + 3) * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1 + currentchain + 2) * 400);
else
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count + (currentchain + 1 + currentchain + 2) * 400);
}
if (!one_turn_kill && Enemy.LifePoints <= expected_blood && Duel.Player == 1)
{
Logger.DebugWriteLine(" %%%%%%%%%%%%%%%%%one_turn_kill_1");
one_turn_kill_1 = true;
OjamaTrioused = true;
}
}
base.OnChaining(player, card);
}
} }
} }
\ No newline at end of file
using YGOSharp.OCGWrapper.Enums;
using System.Collections.Generic;
using WindBot;
using WindBot.Game;
using WindBot.Game.AI;
namespace WindBot.Game.AI.Decks
{
// NOT FINISHED YET
[Deck("DarkMagician", "AI_DarkMagician", "NotFinished")]
public class DarkMagicianExecutor : DefaultExecutor
{
public class CardId
{
public const int DarkMagician = 46986414;
public const int GrinderGolem = 75732622;
public const int MagicianOfLllusion = 35191415;
public const int ApprenticeLllusionMagician = 30603688;
public const int WindwitchGlassBell = 71007216;
public const int MagiciansRod = 7084129;
public const int WindwitchIceBell = 43722862;
public const int AshBlossom = 14558127;
public const int SpellbookMagicianOfProphecy = 14824019;
public const int MaxxC = 23434538;
public const int WindwitchSnowBell = 70117860;
public const int TheEyeOfTimaeus = 1784686;
public const int DarkMagicAttack = 2314238;
public const int SpellbookOfKnowledge = 23314220;
public const int UpstartGoblin = 70368879;
public const int SpellbookOfSecrets = 89739383;
public const int DarkMagicInheritance = 41735184;
public const int LllusionMagic = 73616671;
//public const int Scapegoat = 73915051;
public const int DarkMagicalCircle = 47222536;
public const int WonderWand = 67775894;
public const int MagicianNavigation = 7922915;
public const int EternalSoul = 48680970;
public const int SolemnStrike = 40605147;
public const int DarkMagicianTheDragonKnight = 41721210;
public const int CrystalWingSynchroDragon = 50954680;
public const int OddEyesWingDragon = 58074177;
public const int ClearWingFastDragon = 90036274;
public const int WindwitchWinterBell = 14577226;
public const int OddEyesAbsoluteDragon = 16691074;
public const int Dracossack = 22110647;
public const int BigEye = 80117527;
public const int TroymarePhoenix = 2857636;
public const int TroymareCerberus = 75452921;
public const int ApprenticeWitchling = 71384012;
public const int VentriloauistsClaraAndLucika = 1482001;
/*public const int EbonLllusionMagician = 96471335;
public const int BorreloadDragon = 31833038;
public const int SaryujaSkullDread = 74997493;
public const int Hidaruma = 64514892;
public const int AkashicMagician = 28776350;
public const int SecurityDragon = 99111753;
public const int LinkSpider = 98978921;
public const int Linkuriboh = 41999284;*/
public const int HarpiesFeatherDuster = 18144506;
public const int ElShaddollWinda = 94977269;
public const int DarkHole = 53129443;
public const int Ultimate = 86221741;
public const int LockBird = 94145021;
public const int Ghost = 59438930;
public const int GiantRex = 80280944;
public const int UltimateConductorTytanno = 18940556;
public const int SummonSorceress = 61665245;
public const int CrystronNeedlefiber = 50588353;
public const int FirewallDragon = 5043010;
public const int JackKnightOfTheLavenderDust = 28692962;
public const int JackKnightOfTheCobaltDepths = 92204263;
public const int JackKnightOfTheCrimsonLotus = 56809158;
public const int JackKnightOfTheGoldenBlossom = 29415459;
public const int JackKnightOfTheVerdantGale = 66022706;
public const int JackKnightOfTheAmberShade = 93020401;
public const int JackKnightOfTheAzureSky = 20537097;
public const int MekkKnightMorningStar = 72006609;
public const int JackKnightOfTheWorldScar = 38502358;
public const int WhisperOfTheWorldLegacy = 62530723;
public const int TrueDepthsOfTheWorldLegacy = 98935722;
public const int KeyToTheWorldLegacy = 2930675;
}
public DarkMagicianExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
//counter
AddExecutor(ExecutorType.Activate, CardId.SolemnStrike, SolemnStrikeeff);
AddExecutor(ExecutorType.Activate, CardId.AshBlossom, ChainEnemy);
AddExecutor(ExecutorType.Activate, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragoneff);
AddExecutor(ExecutorType.Activate, CardId.MaxxC, MaxxCeff);
//AddExecutor(ExecutorType.Activate, CardId.Scapegoat,Scapegoateff);
//first do
AddExecutor(ExecutorType.Activate, CardId.UpstartGoblin, UpstartGoblineff);
AddExecutor(ExecutorType.Activate, CardId.DarkMagicalCircle, DarkMagicalCircleeff);
AddExecutor(ExecutorType.Activate, CardId.SpellbookOfSecrets, SpellbookOfSecreteff);
AddExecutor(ExecutorType.Activate, CardId.DarkMagicInheritance, DarkMagicInheritanceeff);
AddExecutor(ExecutorType.Activate, CardId.DarkMagicAttack, DarkMagicAttackeff);
//trap set
AddExecutor(ExecutorType.SpellSet, CardId.SolemnStrike);
AddExecutor(ExecutorType.SpellSet, CardId.MagicianNavigation, MagicianNavigationset);
AddExecutor(ExecutorType.SpellSet, CardId.EternalSoul, EternalSoulset);
/*AddExecutor(ExecutorType.SpellSet, CardId.Scapegoat, Scapegoatset);
//sheep
AddExecutor(ExecutorType.SpSummon, CardId.Hidaruma, Hidarumasp);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh, Linkuribohsp);
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
AddExecutor(ExecutorType.SpSummon, CardId.LinkSpider, Linkuribohsp);
AddExecutor(ExecutorType.SpSummon, CardId.BorreloadDragon, BorreloadDragonsp);
AddExecutor(ExecutorType.SpSummon, CardId.BorreloadDragon, BorreloadDragoneff);*/
//plan A
AddExecutor(ExecutorType.Activate, CardId.WindwitchIceBell, WindwitchIceBelleff);
AddExecutor(ExecutorType.Activate, CardId.WindwitchGlassBell, WindwitchGlassBelleff);
AddExecutor(ExecutorType.Activate, CardId.WindwitchSnowBell, WindwitchSnowBellsp);
AddExecutor(ExecutorType.SpSummon, CardId.WindwitchWinterBell, WindwitchWinterBellsp);
AddExecutor(ExecutorType.Activate, CardId.WindwitchWinterBell, WindwitchWinterBelleff);
AddExecutor(ExecutorType.SpSummon, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragonsp);
// if fail
AddExecutor(ExecutorType.SpSummon, CardId.ClearWingFastDragon, ClearWingFastDragonsp);
AddExecutor(ExecutorType.Activate, CardId.ClearWingFastDragon, ClearWingFastDragoneff);
// plan B
//AddExecutor(ExecutorType.Activate, CardId.GrinderGolem, GrinderGolemeff);
// AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh, Linkuribohsp);
//AddExecutor(ExecutorType.SpSummon, CardId.LinkSpider, LinkSpidersp);
//AddExecutor(ExecutorType.SpSummon, CardId.AkashicMagician);
//plan C
AddExecutor(ExecutorType.SpSummon, CardId.OddEyesAbsoluteDragon, OddEyesAbsoluteDragonsp);
AddExecutor(ExecutorType.Activate, CardId.OddEyesAbsoluteDragon, OddEyesAbsoluteDragoneff);
AddExecutor(ExecutorType.Activate, CardId.OddEyesWingDragon);
//summon
AddExecutor(ExecutorType.Summon, CardId.WindwitchGlassBell, WindwitchGlassBellsummonfirst);
AddExecutor(ExecutorType.Summon, CardId.SpellbookMagicianOfProphecy, SpellbookMagicianOfProphecysummon);
AddExecutor(ExecutorType.Activate, CardId.SpellbookMagicianOfProphecy, SpellbookMagicianOfProphecyeff);
AddExecutor(ExecutorType.Summon, CardId.MagiciansRod, MagiciansRodsummon);
AddExecutor(ExecutorType.Activate, CardId.MagiciansRod, MagiciansRodeff);
AddExecutor(ExecutorType.Summon, CardId.WindwitchGlassBell, WindwitchGlassBellsummon);
//activate
AddExecutor(ExecutorType.Activate, CardId.LllusionMagic, LllusionMagiceff);
AddExecutor(ExecutorType.SpellSet, CardId.LllusionMagic, LllusionMagicset);
AddExecutor(ExecutorType.Activate, CardId.SpellbookOfKnowledge, SpellbookOfKnowledgeeff);
AddExecutor(ExecutorType.Activate, CardId.WonderWand, WonderWandeff);
AddExecutor(ExecutorType.Activate, CardId.TheEyeOfTimaeus, TheEyeOfTimaeuseff);
AddExecutor(ExecutorType.SpSummon, CardId.ApprenticeLllusionMagician, ApprenticeLllusionMagiciansp);
AddExecutor(ExecutorType.Activate, CardId.ApprenticeLllusionMagician, ApprenticeLllusionMagicianeff);
//other thing
AddExecutor(ExecutorType.Activate, CardId.MagicianOfLllusion);
AddExecutor(ExecutorType.Activate, CardId.MagicianNavigation, MagicianNavigationeff);
AddExecutor(ExecutorType.Activate, CardId.EternalSoul, EternalSouleff);
AddExecutor(ExecutorType.SpSummon, CardId.BigEye, BigEyesp);
AddExecutor(ExecutorType.Activate, CardId.BigEye, BigEyeeff);
AddExecutor(ExecutorType.SpSummon, CardId.Dracossack, Dracossacksp);
AddExecutor(ExecutorType.Activate, CardId.Dracossack, Dracossackeff);
AddExecutor(ExecutorType.SpSummon, CardId.ApprenticeWitchling, ApprenticeWitchlingsp);
AddExecutor(ExecutorType.Activate, CardId.ApprenticeWitchling, ApprenticeWitchlingeff);
AddExecutor(ExecutorType.SpSummon, CardId.VentriloauistsClaraAndLucika, VentriloauistsClaraAndLucikasp);
AddExecutor(ExecutorType.Repos, MonsterRepos);
}
private void EternalSoulSelect()
{
AI.SelectPosition(CardPosition.FaceUpAttack);
/*
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
int MekkKnightZone = 0;
int BotZone = 0;
for (int i = 0; i <= 6; i++)
{
if (Enemy.MonsterZone[i] != null && Enemy.MonsterZone[i].Id == CardId.MekkKnightMorningStar)
{
MekkKnightZone = i;
break;
}
}
if (Bot.MonsterZone[GetReverseColumnMainZone(MekkKnightZone)] == null)
{
BotZone = GetReverseColumnMainZone(MekkKnightZone);
AI.SelectPlace(ReverseZoneTo16bit(BotZone));
}
else
{
for (int i = 0; i <= 6; i++)
{
if (!NoJackKnightColumn(i))
{
if (Bot.MonsterZone[GetReverseColumnMainZone(i)] == null)
{
AI.SelectPlace(ReverseZoneTo16bit(GetReverseColumnMainZone(i)));
break;
}
}
}
}
Logger.DebugWriteLine("******************MekkKnightMorningStar");
}
else
{
for (int i = 0; i <= 6; i++)
{
if (!NoJackKnightColumn(i))
{
if (Bot.MonsterZone[GetReverseColumnMainZone(i)] == null)
{
AI.SelectPlace(ReverseZoneTo16bit(GetReverseColumnMainZone(i)));
break;
}
}
}
}
*/
}
int attackerzone = -1;
int defenderzone = -1;
bool Secret_used = false;
bool plan_A = false;
bool plan_C = false;
int maxxc_done = 0;
int lockbird_done = 0;
int ghost_done = 0;
bool maxxc_used = false;
bool lockbird_used = false;
bool ghost_used = false;
bool WindwitchGlassBelleff_used = false;
int ApprenticeLllusionMagician_count = 0;
bool Spellbook_summon = false;
bool Rod_summon = false;
bool GlassBell_summon = false;
bool magician_sp = false;
bool soul_used = false;
bool big_attack = false;
bool big_attack_used = false;
bool CrystalWingSynchroDragon_used = false;
public override void OnNewPhase()
{
//AI.Utils.UpdateLinkedZone();
//Logger.DebugWriteLine("Zones.CheckLinkedPointZones= " + Zones.CheckLinkedPointZones);
//Logger.DebugWriteLine("Zones.CheckMutualEnemyZoneCount= " + Zones.CheckMutualEnemyZoneCount);
plan_C = false;
ApprenticeLllusionMagician_count = 0;
foreach (ClientCard count in Bot.GetMonsters())
{
if (count.Id == CardId.ApprenticeLllusionMagician && count.IsFaceup())
ApprenticeLllusionMagician_count++;
}
foreach (ClientCard dangerous in Enemy.GetMonsters())
{
if (dangerous != null && dangerous.IsShouldNotBeTarget() && dangerous.Attack > 2500 &&
!Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{
plan_C = true;
Logger.DebugWriteLine("*********dangerous = " + dangerous.Id);
}
}
if (Bot.HasInHand(CardId.SpellbookMagicianOfProphecy) &&
Bot.HasInHand(CardId.MagiciansRod) &&
Bot.HasInHand(CardId.WindwitchGlassBell))
{
if (Bot.HasInHand(CardId.SpellbookOfKnowledge) ||
Bot.HasInHand(CardId.WonderWand))
Rod_summon = true;
else
Spellbook_summon = true;
}
else if
(Bot.HasInHand(CardId.SpellbookMagicianOfProphecy) &&
Bot.HasInHand(CardId.MagiciansRod))
{
if (Bot.HasInSpellZone(CardId.EternalSoul) &&
!(Bot.HasInHand(CardId.DarkMagician) || Bot.HasInHand(CardId.DarkMagician)))
Rod_summon = true;
else if (Bot.HasInHand(CardId.SpellbookOfKnowledge) ||
Bot.HasInHand(CardId.WonderWand))
Rod_summon = true;
else
Spellbook_summon = true;
}
else if
(Bot.HasInHand(CardId.SpellbookMagicianOfProphecy) &&
Bot.HasInHand(CardId.WindwitchGlassBell))
{
if (plan_A)
Rod_summon = true;
else
GlassBell_summon = true;
}
else if
(Bot.HasInHand(CardId.MagiciansRod) &&
Bot.HasInHand(CardId.WindwitchGlassBell))
{
if (plan_A)
Rod_summon = true;
else
GlassBell_summon = true;
}
else
{
Spellbook_summon = true;
Rod_summon = true;
GlassBell_summon = true;
}
}
public override void OnNewTurn()
{
CrystalWingSynchroDragon_used = false;
Secret_used = false;
maxxc_used = false;
lockbird_used = false;
ghost_used = false;
WindwitchGlassBelleff_used = false;
Spellbook_summon = false;
Rod_summon = false;
GlassBell_summon = false;
magician_sp = false;
big_attack = false;
big_attack_used = false;
soul_used = false;
}
public int GetTotalATK(IList<ClientCard> list)
{
int atk = 0;
foreach (ClientCard c in list)
{
if (c == null) continue;
atk += c.Attack;
}
return atk;
}
private bool WindwitchIceBelleff()
{
if (lockbird_used) return false;
if (Enemy.HasInMonstersZone(CardId.ElShaddollWinda)) return false;
if (maxxc_used) return false;
if (WindwitchGlassBelleff_used) return false;
//AI.SelectPlace(Zones.z2, 1);
if (Bot.GetRemainingCount(CardId.WindwitchGlassBell, 2) >= 1)
AI.SelectCard(CardId.WindwitchGlassBell);
else if (Bot.HasInHand(CardId.WindwitchGlassBell))
AI.SelectCard(CardId.WindwitchSnowBell);
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool WindwitchGlassBelleff()
{
if (Bot.HasInMonstersZone(CardId.WindwitchIceBell))
{
int ghost_count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.Ghost)
ghost_count++;
}
if (ghost_count != ghost_done)
AI.SelectCard(CardId.WindwitchIceBell);
else
AI.SelectCard(CardId.WindwitchSnowBell);
}
else
AI.SelectCard(CardId.WindwitchIceBell);
WindwitchGlassBelleff_used = true;
return true;
}
private bool WindwitchSnowBellsp()
{
if (Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
private bool WindwitchWinterBellsp()
{
if (Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchGlassBell) &&
Bot.HasInMonstersZone(CardId.WindwitchSnowBell))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
AI.SelectCard(new[] { CardId.WindwitchIceBell, CardId.WindwitchGlassBell });
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
return false;
}
private bool WindwitchWinterBelleff()
{
AI.SelectCard(CardId.WindwitchGlassBell);
return true;
}
private bool ClearWingFastDragonsp()
{
if (Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
{
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
return false;
}
private bool ClearWingFastDragoneff()
{
if (Card.Location == CardLocation.MonsterZone)
{
if (Duel.Player == 1)
return DefaultTrap();
return true;
}
return false;
}
private bool CrystalWingSynchroDragonsp()
{
if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell) && Bot.HasInMonstersZone(CardId.WindwitchWinterBell))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
plan_A = true;
return true;
}
return false;
}
/* private bool GrinderGolemeff()
{
if (plan_A) return false;
AI.SelectPosition(CardPosition.FaceUpDefence);
if (Bot.GetMonstersExtraZoneCount() == 0)
return true;
if (Bot.HasInMonstersZone(CardId.AkashicMagician) ||
Bot.HasInMonstersZone(CardId.SecurityDragon))
return true;
return false;
}*/
/* private bool Linkuribohsp()
{
if (Bot.HasInMonstersZone(CardId.GrinderGolem + 1))
{
AI.SelectCard(CardId.GrinderGolem + 1);
return true;
}
return false;
}
private bool LinkSpidersp()
{
if(Bot.HasInMonstersZone(CardId.GrinderGolem+1))
{
AI.SelectCard(CardId.GrinderGolem + 1);
return true;
}
return false;
}*/
private bool OddEyesAbsoluteDragonsp()
{
if (plan_C)
{
return true;
}
return false;
}
private bool OddEyesAbsoluteDragoneff()
{
Logger.DebugWriteLine("OddEyesAbsoluteDragonef 1");
if (Card.Location == CardLocation.MonsterZone/*ActivateDescription == AI.Utils.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/)
{
Logger.DebugWriteLine("OddEyesAbsoluteDragonef 2");
return Duel.Player == 1;
}
else if (Card.Location == CardLocation.Grave/*ActivateDescription == AI.Utils.GetStringId(CardId.OddEyesAbsoluteDragon, 0)*/)
{
Logger.DebugWriteLine("OddEyesAbsoluteDragonef 3");
AI.SelectCard(CardId.OddEyesWingDragon);
return true;
}
return false;
}
private bool SolemnStrikeeff()
{
if (Bot.LifePoints > 1500 && Duel.LastChainPlayer == 1)
return true;
return false;
}
private bool ChainEnemy()
{
if (AI.Utils.GetLastChainCard() != null &&
AI.Utils.GetLastChainCard().Id == CardId.UpstartGoblin)
return false;
return Duel.LastChainPlayer == 1;
}
private bool CrystalWingSynchroDragoneff()
{
if (Duel.LastChainPlayer == 1)
{
CrystalWingSynchroDragon_used = true;
return true;
}
return false;
}
private bool MaxxCeff()
{
return Duel.Player == 1;
}
/*
private bool Scapegoatset()
{
if (Bot.HasInSpellZone(CardId.Scapegoat)) return false;
return (Bot.GetMonsterCount() - Bot.GetMonstersExtraZoneCount()) < 2;
}
public bool Scapegoateff()
{
if (Duel.Player == 0) return false;
if (DefaultOnBecomeTarget() && !Enemy.HasInMonstersZone(CardId.UltimateConductorTytanno))
{
Logger.DebugWriteLine("*************************sheepeff");
return true;
}
if (Bot.HasInMonstersZone(CardId.CrystalWingSynchroDragon)) return false;
if(Duel.Phase == DuelPhase.End)
{
Logger.DebugWriteLine("*************************sheepeff");
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 && !Enemy.HasInMonstersZone(CardId.UltimateConductorTytanno)) return true;
}
return false;
}
private bool Hidarumasp()
{
if (!Bot.HasInMonstersZone(CardId.Scapegoat + 1)) return false;
if(Bot.MonsterZone[5]==null)
{
AI.SelectCard(new[] { CardId.Scapegoat + 1, CardId.Scapegoat + 1 });
return true;
}
if (Bot.MonsterZone[6] == null)
{
AI.SelectCard(new[] { CardId.Scapegoat + 1, CardId.Scapegoat + 1 });
return true;
}
return false;
}
private bool Linkuribohsp()
{
foreach (ClientCard c in Bot.GetMonsters())
{
if (c.Id != CardId.WindwitchSnowBell && c.Level == 1 && c.Id != CardId.LinkSpider && c.Id != CardId.Linkuriboh)
{
AI.SelectCard(c);
return true;
}
}
return false;
}
private bool Linkuriboheff()
{
if (Duel.LastChainPlayer == 0 && AI.Utils.GetLastChainCard().Id == CardId.Linkuriboh) return false;
if (Bot.HasInMonstersZone(CardId.WindwitchSnowBell)) return false;
return true;
}
private bool BorreloadDragonsp()
{
if(Bot.HasInMonstersZone(CardId.Hidaruma)&&
Bot.HasInMonstersZone(CardId.Linkuriboh))
{
AI.SelectCard(new[] { CardId.Hidaruma, CardId.Linkuriboh, CardId.LinkSpider ,CardId.Linkuriboh});
return true;
}
return false;
}
private bool BorreloadDragoneff()
{
if (ActivateDescription == -1)
{
ClientCard enemy_monster = Enemy.BattlingMonster;
if (enemy_monster != null && enemy_monster.HasPosition(CardPosition.Attack))
{
return enemy_monster.Attack > 2000;
}
return true;
};
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true,true);
if (BestEnemy == null || BestEnemy.HasPosition(CardPosition.FaceDown)) return false;
AI.SelectCard(BestEnemy);
return true;
}*/
private bool EternalSoulset()
{
if (Bot.GetHandCount() > 6) return true;
if (!Bot.HasInSpellZone(CardId.EternalSoul))
return true;
return false;
}
private bool EternalSouleff()
{
IList<ClientCard> grave = Bot.Graveyard;
IList<ClientCard> magician = new List<ClientCard>();
foreach (ClientCard check in grave)
{
if (check.Id == CardId.DarkMagician)
{
magician.Add(check);
}
}
if (AI.Utils.IsChainTarget(Card) && Bot.GetMonsterCount() == 0)
{
AI.SelectYesNo(false);
return true;
}
if (AI.Utils.ChainCountPlayer(0) > 0) return false;
if (Enemy.HasInSpellZone(CardId.HarpiesFeatherDuster) && Card.IsFacedown())
return false;
foreach (ClientCard target in Duel.ChainTargets)
{
if ((target.Id == CardId.DarkMagician || target.Id == CardId.DarkMagicianTheDragonKnight)
&& Card.IsFacedown())
{
AI.SelectYesNo(false);
return true;
}
}
if (Enemy.HasInSpellZone(CardId.DarkHole) && Card.IsFacedown() &&
(Bot.HasInMonstersZone(CardId.DarkMagician) || Bot.HasInMonstersZone(CardId.DarkMagicianTheDragonKnight)))
{
AI.SelectYesNo(false);
return true;
}
if (Bot.HasInGraveyard(CardId.DarkMagicianTheDragonKnight) &&
!Bot.HasInMonstersZone(CardId.DarkMagicianTheDragonKnight) && !plan_C)
{
EternalSoulSelect();
AI.SelectCard(CardId.DarkMagicianTheDragonKnight);
return true;
}
if (Duel.Player == 1 && Bot.HasInSpellZone(CardId.DarkMagicalCircle) &&
(Enemy.HasInMonstersZone(CardId.SummonSorceress) || Enemy.HasInMonstersZone(CardId.FirewallDragon)))
{
soul_used = true;
magician_sp = true;
EternalSoulSelect();
AI.SelectCard(magician);
return true;
}
if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && Enemy.GetMonsterCount() > 0)
{
if (Card.IsFacedown() && Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika))
{
AI.SelectYesNo(false);
return true;
}
if (Card.IsFacedown() &&
(Bot.HasInMonstersZone(CardId.DarkMagician) || Bot.HasInMonstersZone(CardId.DarkMagicianTheDragonKnight)))
{
AI.SelectYesNo(false);
return true;
}
if (Bot.HasInGraveyard(CardId.DarkMagicianTheDragonKnight) ||
Bot.HasInGraveyard(CardId.DarkMagician))
{
soul_used = true;
magician_sp = true;
EternalSoulSelect();
AI.SelectCard(magician);
return true;
}
if (Bot.HasInHand(CardId.DarkMagician))
{
soul_used = true;
magician_sp = true;
AI.SelectCard(CardId.DarkMagician);
EternalSoulSelect();
return true;
}
}
if (Duel.Player == 0 && Duel.Phase == DuelPhase.Main1)
{
if (Bot.HasInHand(CardId.DarkMagicalCircle) && !Bot.HasInSpellZone(CardId.DarkMagicalCircle))
return false;
if (Bot.HasInGraveyard(CardId.DarkMagicianTheDragonKnight) ||
Bot.HasInGraveyard(CardId.DarkMagician))
{
soul_used = true;
magician_sp = true;
AI.SelectCard(magician);
EternalSoulSelect();
return true;
}
if (Bot.HasInHand(CardId.DarkMagician))
{
soul_used = true;
magician_sp = true;
AI.SelectCard(CardId.DarkMagician);
EternalSoulSelect();
return true;
}
}
if (Duel.Phase == DuelPhase.End)
{
if (Card.IsFacedown() && Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika))
{
AI.SelectYesNo(false);
return true;
}
if (Bot.HasInGraveyard(CardId.DarkMagicianTheDragonKnight) ||
Bot.HasInGraveyard(CardId.DarkMagician))
{
soul_used = true;
magician_sp = true;
AI.SelectCard(magician);
EternalSoulSelect();
return true;
}
if (Bot.HasInHand(CardId.DarkMagician))
{
soul_used = true;
magician_sp = true;
AI.SelectCard(CardId.DarkMagician);
EternalSoulSelect();
return true;
}
return true;
}
return false;
}
private bool MagicianNavigationset()
{
if (Bot.GetHandCount() > 6) return true;
if (Bot.HasInSpellZone(CardId.LllusionMagic)) return true;
if (Bot.HasInHand(CardId.DarkMagician) && !Bot.HasInSpellZone(CardId.MagicianNavigation))
return true;
return false;
}
private bool MagicianNavigationeff()
{
bool spell_act = false;
IList<ClientCard> spell = new List<ClientCard>();
if (Duel.LastChainPlayer == 1)
{
foreach (ClientCard check in Enemy.GetSpells())
{
if (AI.Utils.GetLastChainCard() == check)
{
spell.Add(check);
spell_act = true;
break;
}
}
}
bool soul_faceup = false;
foreach (ClientCard check in Bot.GetSpells())
{
if (check.Id == CardId.EternalSoul && check.IsFaceup())
{
soul_faceup = true;
}
}
if (Card.Location == CardLocation.Grave && spell_act)
{
Logger.DebugWriteLine("**********************Navigationeff***********");
AI.SelectCard(spell);
return true;
}
if (AI.Utils.IsChainTarget(Card))
{
AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true);
if (check != null)
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
else
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
magician_sp = true;
return UniqueFaceupSpell();
}
if (DefaultOnBecomeTarget() && !soul_faceup)
{
AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true);
if (check != null)
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
else
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
magician_sp = true;
return true;
}
if (Duel.Player == 0 && Card.Location == CardLocation.SpellZone && !maxxc_used && Bot.HasInHand(CardId.DarkMagician))
{
AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true);
if (check != null)
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
else
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
magician_sp = true;
return UniqueFaceupSpell();
}
if (Duel.Player == 1 && Bot.HasInSpellZone(CardId.DarkMagicalCircle) &&
(Enemy.HasInMonstersZone(CardId.SummonSorceress) || Enemy.HasInMonstersZone(CardId.FirewallDragon))
&& Card.Location == CardLocation.SpellZone)
{
AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true);
if (check != null)
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
else
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
magician_sp = true;
return UniqueFaceupSpell();
}
if (Enemy.GetFieldCount() > 0 &&
(Duel.Phase == DuelPhase.BattleStart || Duel.Phase == DuelPhase.End) &&
Card.Location == CardLocation.SpellZone && !maxxc_used)
{
AI.SelectPlace(Zones.z0 | Zones.z4);
AI.SelectCard(CardId.DarkMagician);
ClientCard check = AI.Utils.GetOneEnemyBetterThanValue(2500, true);
if (check != null)
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
else
AI.SelectNextCard(new[] {
CardId.ApprenticeLllusionMagician,
CardId.DarkMagician,
CardId.MagicianOfLllusion});
magician_sp = true;
return UniqueFaceupSpell();
}
return false;
}
private bool DarkMagicalCircleeff()
{
if (Card.Location == CardLocation.Hand)
{
//AI.SelectPlace(Zones.z2, 2);
if (Bot.LifePoints <= 4000)
return true;
return UniqueFaceupSpell();
}
else
{
if (magician_sp)
{
AI.SelectCard(AI.Utils.GetBestEnemyCard(false, true));
if (AI.Utils.GetBestEnemyCard(false, true) != null)
Logger.DebugWriteLine("*************SelectCard= " + AI.Utils.GetBestEnemyCard(false, true).Id);
magician_sp = false;
}
}
return true;
}
private bool LllusionMagicset()
{
if (Bot.GetMonsterCount() >= 1 &&
!(Bot.GetMonsterCount() == 1 && Bot.HasInMonstersZone(CardId.CrystalWingSynchroDragon)) &&
!(Bot.GetMonsterCount() == 1 && Bot.HasInMonstersZone(CardId.ClearWingFastDragon)) &&
!(Bot.GetMonsterCount() == 1 && Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika)))
return true;
return false;
}
private bool LllusionMagiceff()
{
if (lockbird_used) return false;
if (Duel.LastChainPlayer == 0) return false;
ClientCard target = null;
bool soul_exist = false;
//AI.SelectPlace(Zones.z2, 2);
foreach (ClientCard m in Bot.GetSpells())
{
if (m.Id == CardId.EternalSoul && m.IsFaceup())
soul_exist = true;
}
if (!soul_used && soul_exist)
{
if (Bot.HasInMonstersZone(CardId.MagiciansRod))
{
AI.SelectCard(CardId.MagiciansRod);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
}
if (Duel.Player == 0)
{
int ghost_count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.Ghost)
ghost_count++;
}
if (ghost_count != ghost_done)
{
if (Duel.CurrentChain.Count >= 2 && AI.Utils.GetLastChainCard().Id == 0)
{
AI.SelectCard(CardId.MagiciansRod);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
}
int count = 0;
foreach (ClientCard m in Bot.GetMonsters())
{
if (AI.Utils.IsChainTarget(m))
{
count++;
target = m;
Logger.DebugWriteLine("************IsChainTarget= " + target.Id);
break;
}
}
if (count == 0) return false;
if ((target.Id == CardId.WindwitchGlassBell || target.Id == CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
return false;
AI.SelectCard(target);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if (Bot.HasInMonstersZone(CardId.MagiciansRod) || Bot.HasInMonstersZone(CardId.SpellbookMagicianOfProphecy))
{
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.SpellbookMagicianOfProphecy });
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if (Duel.Player == 1 && Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
{
AI.SelectCard(CardId.WindwitchGlassBell);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if (Duel.Player == 1 && Bot.HasInMonstersZone(CardId.WindwitchIceBell))
{
AI.SelectCard(CardId.WindwitchIceBell);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if (Duel.Player == 1 && Bot.HasInMonstersZone(CardId.WindwitchSnowBell))
{
AI.SelectCard(CardId.WindwitchSnowBell);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if (Duel.Player == 1 && Bot.HasInMonstersZone(CardId.SpellbookMagicianOfProphecy))
{
AI.SelectCard(CardId.SpellbookMagicianOfProphecy);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if (Duel.Player == 1 && Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician) &&
(Bot.HasInSpellZone(CardId.EternalSoul) || Bot.HasInSpellZone(CardId.MagicianNavigation)))
{
AI.SelectCard(CardId.ApprenticeLllusionMagician);
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
if ((Bot.GetRemainingCount(CardId.DarkMagician, 3) > 1 || Bot.HasInGraveyard(CardId.DarkMagician)) &&
Bot.HasInSpellZone(CardId.MagicianNavigation) &&
(Bot.HasInMonstersZone(CardId.DarkMagician) || Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician)) &&
Duel.Player == 1 && !Bot.HasInHand(CardId.DarkMagician))
{
AI.SelectCard(new[] { CardId.DarkMagician, CardId.ApprenticeLllusionMagician });
AI.SelectNextCard(new[] { CardId.DarkMagician, CardId.DarkMagician });
return true;
}
return false;
}
private bool SpellbookMagicianOfProphecyeff()
{
Logger.DebugWriteLine("*********Secret_used= " + Secret_used);
if (Secret_used)
AI.SelectCard(CardId.SpellbookOfKnowledge);
else
AI.SelectCard(new[] { CardId.SpellbookOfSecrets, CardId.SpellbookOfKnowledge });
return true;
}
private bool TheEyeOfTimaeuseff()
{
//AI.SelectPlace(Zones.z2, 2);
return true;
}
private bool UpstartGoblineff()
{
//AI.SelectPlace(Zones.z2, 2);
return true;
}
private bool SpellbookOfSecreteff()
{
if (lockbird_used) return false;
//AI.SelectPlace(Zones.z2, 2);
Secret_used = true;
if (Bot.HasInHand(CardId.SpellbookMagicianOfProphecy))
AI.SelectCard(CardId.SpellbookOfKnowledge);
else
AI.SelectCard(CardId.SpellbookMagicianOfProphecy);
return true;
}
private bool SpellbookOfKnowledgeeff()
{
int count = 0;
foreach (ClientCard check in Bot.GetMonsters())
{
if (check.Id != CardId.CrystalWingSynchroDragon)
count++;
}
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%SpellCaster= " + count);
if (lockbird_used) return false;
if (Bot.HasInSpellZone(CardId.LllusionMagic) && count < 2)
return false;
//AI.SelectPlace(Zones.z2, 2);
if (Bot.HasInMonstersZone(CardId.SpellbookMagicianOfProphecy) ||
Bot.HasInMonstersZone(CardId.MagiciansRod) ||
Bot.HasInMonstersZone(CardId.WindwitchGlassBell) ||
Bot.HasInMonstersZone(CardId.WindwitchIceBell))
{
AI.SelectCard(new[]
{
CardId.SpellbookMagicianOfProphecy,
CardId.MagiciansRod,
CardId.WindwitchGlassBell,
});
return true;
}
if (Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician) && Bot.GetSpellCount() < 2 && Duel.Phase == DuelPhase.Main2)
{
AI.SelectCard(CardId.ApprenticeLllusionMagician);
return true;
}
if (Bot.HasInMonstersZone(CardId.DarkMagician) &&
Bot.HasInSpellZone(CardId.EternalSoul) && Duel.Phase == DuelPhase.Main2)
{
AI.SelectCard(CardId.DarkMagician);
return true;
}
return false;
}
private bool WonderWandeff()
{
if (lockbird_used) return false;
int count = 0;
foreach (ClientCard check in Bot.GetMonsters())
{
if (check.Id != CardId.CrystalWingSynchroDragon)
count++;
}
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%SpellCaster= " + count);
if (Card.Location == CardLocation.Hand)
{
if (Bot.HasInSpellZone(CardId.LllusionMagic) && count < 2)
return false;
//AI.SelectPlace(Zones.z2, 2);
if (Bot.HasInMonstersZone(CardId.SpellbookMagicianOfProphecy) ||
Bot.HasInMonstersZone(CardId.MagiciansRod) ||
Bot.HasInMonstersZone(CardId.WindwitchGlassBell) ||
Bot.HasInMonstersZone(CardId.WindwitchIceBell))
{
AI.SelectCard(new[]
{
CardId.SpellbookMagicianOfProphecy,
CardId.MagiciansRod,
CardId.WindwitchGlassBell,
CardId.WindwitchIceBell,
});
return UniqueFaceupSpell();
}
if (Bot.HasInMonstersZone(CardId.DarkMagician) &&
Bot.HasInSpellZone(CardId.EternalSoul) && Duel.Phase == DuelPhase.Main2)
{
AI.SelectCard(CardId.DarkMagician);
return UniqueFaceupSpell();
}
if (Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician) && Bot.GetSpellCount() < 2 && Duel.Phase == DuelPhase.Main2)
{
AI.SelectCard(CardId.ApprenticeLllusionMagician);
return UniqueFaceupSpell();
}
if (Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician) && Bot.GetHandCount() <= 3 && Duel.Phase == DuelPhase.Main2)
{
AI.SelectCard(CardId.ApprenticeLllusionMagician);
return UniqueFaceupSpell();
}
}
else
{
if (Duel.Turn != 1)
{
if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 &&
AI.Utils.GetBestEnemyMonster(true, true) == null)
return false;
if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 &&
AI.Utils.GetBestEnemyMonster().IsFacedown())
return true;
if (Duel.Phase == DuelPhase.Main1 && Enemy.GetSpellCountWithoutField() == 0 &&
AI.Utils.GetBestBotMonster(true) != null &&
AI.Utils.GetBestBotMonster(true).Attack > AI.Utils.GetBestEnemyMonster(true).Attack)
return false;
}
return true;
}
return false;
}
private bool ApprenticeLllusionMagiciansp()
{
//AI.SelectPlace(Zones.z2, 1);
if (Bot.HasInHand(CardId.DarkMagician) && !Bot.HasInSpellZone(CardId.MagicianNavigation))
{
if (Bot.GetRemainingCount(CardId.DarkMagician, 3) > 0)
{
AI.SelectCard(CardId.DarkMagician);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
return false;
}
if ((Bot.HasInHand(CardId.SpellbookOfSecrets) ||
Bot.HasInHand(CardId.DarkMagicAttack)))
{
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(new[]
{
CardId.SpellbookOfSecrets,
CardId.DarkMagicAttack,
});
return true;
}
if (Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician))
return false;
int count = 0;
foreach (ClientCard check in Bot.Hand)
{
if (check.Id == CardId.WonderWand)
count++;
}
if (count >= 2)
{
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(CardId.WonderWand);
return true;
}
if(!Bot.HasInHandOrInSpellZone(CardId.EternalSoul) &&
Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation)&&
!Bot.HasInHand(CardId.DarkMagician) && Bot.GetHandCount()>2&&
Bot.GetMonsterCount()==0)
{
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectCard(new[]
{
CardId.MagicianOfLllusion,
CardId.ApprenticeLllusionMagician,
CardId.TheEyeOfTimaeus,
CardId.DarkMagicInheritance,
CardId.WonderWand,
});
return true;
}
if (!Bot.HasInHandOrInMonstersZoneOrInGraveyard(CardId.DarkMagician))
{
if (Bot.HasInHandOrInSpellZone(CardId.LllusionMagic) && Bot.GetMonsterCount() >= 1)
return false;
AI.SelectPosition(CardPosition.FaceUpAttack);
int Navigation_count = 0;
foreach (ClientCard Navigation in Bot.Hand)
{
if (Navigation.Id == CardId.MagicianNavigation)
Navigation_count++;
}
if (Navigation_count >= 2)
{
AI.SelectCard(CardId.MagicianNavigation);
return true;
}
AI.SelectCard(new[]
{
CardId.MagicianOfLllusion,
CardId.ApprenticeLllusionMagician,
CardId.TheEyeOfTimaeus,
CardId.DarkMagicInheritance,
CardId.WonderWand,
});
return true;
}
return false;
}
private bool ApprenticeLllusionMagicianeff()
{
if (AI.Utils.ChainContainsCard(CardId.ApprenticeLllusionMagician)) return false;
if (Duel.Phase == DuelPhase.Battle ||
Duel.Phase == DuelPhase.BattleStart ||
Duel.Phase == DuelPhase.BattleStep ||
Duel.Phase == DuelPhase.Damage ||
Duel.Phase == DuelPhase.DamageCal
)
{
if (ActivateDescription == -1)
{
Logger.DebugWriteLine("ApprenticeLllusionMagicianadd");
return true;
}
if (Card.IsDisabled()) return false;
if ((Bot.BattlingMonster == null)) return false;
if ((Enemy.BattlingMonster == null)) return false;
if (Bot.BattlingMonster.Attack < Enemy.BattlingMonster.Attack)
return true;
else
return false;
}
else
return true;
}
private bool SpellbookMagicianOfProphecysummon()
{
//AI.SelectPlace(Zones.z2, 1);
if (lockbird_used) return false;
if (Spellbook_summon)
{
if (Secret_used)
AI.SelectCard(CardId.SpellbookOfKnowledge);
else
AI.SelectCard(new[] { CardId.SpellbookOfSecrets, CardId.SpellbookOfKnowledge });
return true;
}
return false;
}
private bool MagiciansRodsummon()
{
if (lockbird_used) return false;
//AI.SelectPlace(Zones.z2, 1);
if (Rod_summon) return true;
return true;
}
private bool DarkMagicAttackeff()
{
//AI.SelectPlace(Zones.z1, 2);
return DefaultHarpiesFeatherDusterFirst();
}
private bool DarkMagicInheritanceeff()
{
if (lockbird_used) return false;
IList<ClientCard> grave = Bot.Graveyard;
IList<ClientCard> spell = new List<ClientCard>();
int count = 0;
foreach (ClientCard check in grave)
{
if (Card.HasType(CardType.Spell))
{
spell.Add(check);
count++;
}
}
if (count >= 2)
{
//AI.SelectPlace(Zones.z2, 2);
AI.SelectCard(spell);
if (Bot.HasInHandOrInSpellZone(CardId.EternalSoul) && Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle))
if (Bot.GetRemainingCount(CardId.DarkMagician, 3) >= 2 && !Bot.HasInHandOrInSpellZoneOrInGraveyard(CardId.LllusionMagic))
{
AI.SelectNextCard(CardId.LllusionMagic);
return true;
}
if (Bot.HasInHand(CardId.ApprenticeLllusionMagician) &&
(!Bot.HasInHandOrInSpellZone(CardId.EternalSoul) || !Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation)))
{
AI.SelectNextCard(CardId.MagicianNavigation);
return true;
}
if (Bot.HasInHandOrInSpellZone(CardId.EternalSoul) && !Bot.HasInHandOrInMonstersZoneOrInGraveyard(CardId.DarkMagician) &&
!Bot.HasInHandOrInSpellZoneOrInGraveyard(CardId.LllusionMagic))
{
AI.SelectNextCard(CardId.LllusionMagic);
return true;
}
if (Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation) &&
!Bot.HasInHand(CardId.DarkMagician) &&
!Bot.HasInHandOrInSpellZone(CardId.EternalSoul) &&
Bot.GetRemainingCount(CardId.LllusionMagic, 1) > 0)
{
AI.SelectNextCard(CardId.LllusionMagic);
return true;
}
if ((Bot.HasInHandOrInSpellZone(CardId.EternalSoul) || Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation)) &&
!Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle))
{
AI.SelectNextCard(CardId.DarkMagicalCircle);
return true;
}
if (Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle))
{
if (Bot.HasInGraveyard(CardId.MagicianNavigation))
{
AI.SelectNextCard(new[] {
CardId.EternalSoul,
CardId.MagicianNavigation,
CardId.DarkMagicalCircle});
}
else
AI.SelectNextCard(new[] {
CardId.EternalSoul,
CardId.MagicianNavigation,
CardId.DarkMagicalCircle});
return true;
}
if (Bot.HasInGraveyard(CardId.MagicianNavigation))
{
AI.SelectNextCard(new[]
{
CardId.EternalSoul,
CardId.DarkMagicalCircle,
CardId.MagicianNavigation,
});
}
else
AI.SelectNextCard(new[]
{
CardId.MagicianNavigation,
CardId.DarkMagicalCircle,
CardId.EternalSoul,
});
return true;
}
return false;
}
private bool MagiciansRodeff()
{
if (Card.Location == CardLocation.MonsterZone)
{
if (Bot.HasInHandOrInSpellZone(CardId.EternalSoul) && Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle))
if (Bot.GetRemainingCount(CardId.DarkMagician, 3) >= 2 && Bot.GetRemainingCount(CardId.LllusionMagic, 1) > 0)
{
AI.SelectCard(CardId.LllusionMagic);
return true;
}
if (Bot.HasInHand(CardId.ApprenticeLllusionMagician) &&
!Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation) &&
Bot.GetRemainingCount(CardId.MagicianNavigation, 3) > 0)
{
AI.SelectCard(CardId.MagicianNavigation);
return true;
}
if (Bot.HasInHandOrInSpellZone(CardId.EternalSoul) &&
!Bot.HasInHandOrInMonstersZoneOrInGraveyard(CardId.DarkMagician) &&
Bot.GetRemainingCount(CardId.LllusionMagic, 1) > 0)
{
AI.SelectCard(CardId.LllusionMagic);
return true;
}
if (Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation) &&
!Bot.HasInHand(CardId.DarkMagician) &&
!Bot.HasInHandOrInSpellZone(CardId.EternalSoul) &&
Bot.GetRemainingCount(CardId.LllusionMagic, 1) > 0)
{
AI.SelectCard(CardId.LllusionMagic);
return true;
}
if (!Bot.HasInHandOrInSpellZone(CardId.EternalSoul) &&
Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle) &&
Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation) &&
Bot.GetRemainingCount(CardId.EternalSoul, 3) > 0)
{
AI.SelectCard(CardId.EternalSoul);
return true;
}
if ((Bot.HasInHandOrInSpellZone(CardId.EternalSoul) || Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation)) &&
!Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle) &&
Bot.GetRemainingCount(CardId.DarkMagicalCircle, 3) > 0)
{
AI.SelectCard(CardId.DarkMagicalCircle);
return true;
}
if (!Bot.HasInHandOrInSpellZone(CardId.EternalSoul) &&
!Bot.HasInHandOrInSpellZone(CardId.MagicianNavigation))
{
if (Bot.HasInHand(CardId.DarkMagician) &&
!Bot.HasInGraveyard(CardId.MagicianNavigation) &&
Bot.GetRemainingCount(CardId.MagicianNavigation, 3) > 0
)
AI.SelectCard(CardId.MagicianNavigation);
else if (!Bot.HasInHandOrInSpellZone(CardId.DarkMagicalCircle))
AI.SelectCard(CardId.DarkMagicalCircle);
else
AI.SelectCard(CardId.EternalSoul);
return true;
}
if (!Bot.HasInHand(CardId.MagicianNavigation))
{
AI.SelectCard(CardId.MagicianNavigation);
return true;
}
if (!Bot.HasInHand(CardId.DarkMagicalCircle))
{
AI.SelectCard(CardId.DarkMagicalCircle);
return true;
}
if (!Bot.HasInHand(CardId.EternalSoul))
{
AI.SelectCard(CardId.EternalSoul);
return true;
}
AI.SelectCard(new[] {
CardId.LllusionMagic,
CardId.EternalSoul,
CardId.DarkMagicalCircle,
CardId.MagicianNavigation});
return true;
}
else
{
if (Bot.HasInMonstersZone(CardId.VentriloauistsClaraAndLucika))
{
AI.SelectCard(CardId.VentriloauistsClaraAndLucika);
return true;
}
int Enemy_atk = 0;
IList<ClientCard> list = new List<ClientCard>();
foreach (ClientCard monster in Enemy.GetMonsters())
{
if (monster.IsAttack())
list.Add(monster);
}
Enemy_atk = GetTotalATK(list);
int bot_atk = 0;
IList<ClientCard> list_1 = new List<ClientCard>();
foreach (ClientCard monster in Bot.GetMonsters())
{
if (AI.Utils.GetWorstBotMonster(true) != null)
{
if (monster.IsAttack() && monster.Id != AI.Utils.GetWorstBotMonster(true).Id)
list_1.Add(monster);
}
}
bot_atk = GetTotalATK(list);
if (Bot.HasInHand(CardId.MagiciansRod)) return false;
if (Bot.HasInMonstersZone(CardId.ApprenticeWitchling) && Bot.GetMonsterCount() == 1 && Bot.HasInSpellZone(CardId.EternalSoul))
return false;
if (Bot.LifePoints <= (Enemy_atk - bot_atk) &&
Bot.GetMonsterCount() > 1) return false;
if ((Bot.LifePoints - Enemy_atk <= 1000) &&
Bot.GetMonsterCount() == 1) return false;
AI.SelectCard(new[]
{
CardId.VentriloauistsClaraAndLucika,
CardId.SpellbookMagicianOfProphecy,
CardId.WindwitchGlassBell,
CardId.WindwitchIceBell,
CardId.MagiciansRod,
CardId.DarkMagician,
CardId.MagicianOfLllusion
});
return true;
}
}
private bool WindwitchGlassBellsummonfirst()
{
if (Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
Bot.HasInMonstersZone(CardId.WindwitchSnowBell) &&
!Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
return true;
return false;
}
private bool WindwitchGlassBellsummon()
{
if (lockbird_used) return false;
if (!plan_A && (Bot.HasInGraveyard(CardId.WindwitchGlassBell) || Bot.HasInMonstersZone(CardId.WindwitchGlassBell)))
return false;
//AI.SelectPlace(Zones.z2, 1);
if (GlassBell_summon && Bot.HasInMonstersZone(CardId.WindwitchIceBell) &&
!Bot.HasInMonstersZone(CardId.WindwitchGlassBell))
return true;
if (WindwitchGlassBelleff_used) return false;
if (GlassBell_summon) return true;
return false;
}
private bool BigEyesp()
{
if (plan_C) return false;
if (AI.Utils.IsOneEnemyBetterThanValue(2500, false) &&
!Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
return false;
}
private bool BigEyeeff()
{
ClientCard target = AI.Utils.GetBestEnemyMonster(false, true);
if (target != null && target.Attack >= 2500)
{
AI.SelectCard(CardId.DarkMagician);
AI.SelectNextCard(target);
return true;
}
return false;
}
private bool Dracossacksp()
{
if (plan_C) return false;
if (AI.Utils.IsOneEnemyBetterThanValue(2500, false) &&
!Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{
//AI.SelectPlace(Zones.z5, Zones.ExtraMonsterZones);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
return false;
}
private bool Dracossackeff()
{
if (ActivateDescription == AI.Utils.GetStringId(CardId.Dracossack, 0))
{
AI.SelectCard(CardId.DarkMagician);
return true;
}
ClientCard target = AI.Utils.GetBestEnemyCard(false, true);
if (target != null)
{
AI.SelectCard(CardId.Dracossack + 1);
AI.SelectNextCard(target);
return true;
}
return false;
}
private bool ApprenticeWitchlingsp()
{
int rod_count = 0;
foreach (ClientCard rod in Bot.GetMonsters())
{
if (rod.Id == CardId.MagiciansRod)
rod_count++;
}
if (rod_count >= 2)
{
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.MagiciansRod });
return true;
}
if (Bot.HasInMonstersZone(CardId.DarkMagician) &&
Bot.HasInMonstersZone(CardId.MagiciansRod) &&
(Bot.HasInSpellZone(CardId.EternalSoul) || Bot.GetMonsterCount() >= 4)
&& Duel.Phase == DuelPhase.Main2)
{
if (rod_count >= 2)
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.MagiciansRod });
else
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.DarkMagician });
return true;
}
if (Bot.HasInMonstersZone(CardId.MagiciansRod) &&
Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician) &&
(Bot.HasInSpellZone(CardId.EternalSoul) || Bot.HasInSpellZone(CardId.MagicianNavigation))
&& Duel.Phase == DuelPhase.Main2)
{
if (rod_count >= 2)
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.MagiciansRod });
else
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.DarkMagician });
return true;
}
return false;
}
private bool ApprenticeWitchlingeff()
{
AI.SelectCard(new[] { CardId.MagiciansRod, CardId.DarkMagician, CardId.ApprenticeLllusionMagician });
return true;
}
public override bool OnSelectHand()
{
return true;
}
private bool VentriloauistsClaraAndLucikasp()
{
if (Bot.HasInSpellZone(CardId.LllusionMagic)) return false;
if (Bot.HasInMonstersZone(CardId.MagiciansRod) && !Bot.HasInGraveyard(CardId.MagiciansRod) &&
(Bot.HasInSpellZone(CardId.EternalSoul) || Bot.HasInSpellZone(CardId.MagicianNavigation)))
{
AI.SelectCard(CardId.MagiciansRod);
return true;
}
return false;
}
public override void OnChaining(int player, ClientCard card)
{
base.OnChaining(player, card);
}
public override void OnChainEnd()
{
/*if (Enemy.MonsterZone[5] != null)
{
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[5].LinkMarker= " + Enemy.MonsterZone[5].LinkMarker);
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[5].LinkLevel= " + Enemy.MonsterZone[5].LinkLevel);
}
if (Enemy.MonsterZone[6] != null)
{
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[6].LinkMarker= " + Enemy.MonsterZone[6].LinkMarker);
Logger.DebugWriteLine("%%%%%%%%%%%%%%%%Enemy.MonsterZone[6].LinkLevel= " + Enemy.MonsterZone[6].LinkLevel);
}
for (int i = 0; i < 6; i++)
{
if (Enemy.MonsterZone[i] != null)
Logger.DebugWriteLine("++++++++MONSTER ZONE[" + i + "]= " + Enemy.MonsterZone[i].Attack);
}
for (int i = 0; i < 6; i++)
{
if (Bot.MonsterZone[i] != null)
Logger.DebugWriteLine("++++++++MONSTER ZONE[" + i + "]= " + Bot.MonsterZone[i].Id);
}
for (int i = 0; i < 4; i++)
{
if (Bot.SpellZone[i] != null)
Logger.DebugWriteLine("++++++++SpellZone[" + i + "]= " + Bot.SpellZone[i].Id);
}*/
if ((Duel.CurrentChain.Count >= 1 && AI.Utils.GetLastChainCard().Id == 0) ||
(Duel.CurrentChain.Count == 2 && !AI.Utils.ChainContainPlayer(0) && Duel.CurrentChain[0].Id == 0))
{
Logger.DebugWriteLine("current chain = " + Duel.CurrentChain.Count);
Logger.DebugWriteLine("******last chain card= " + AI.Utils.GetLastChainCard().Id);
int maxxc_count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.MaxxC)
maxxc_count++;
}
if (maxxc_count != maxxc_done)
{
Logger.DebugWriteLine("************************last chain card= " + AI.Utils.GetLastChainCard().Id);
maxxc_used = true;
}
int lockbird_count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.LockBird)
lockbird_count++;
}
if (lockbird_count != lockbird_done)
{
Logger.DebugWriteLine("************************last chain card= " + AI.Utils.GetLastChainCard().Id);
lockbird_used = true;
}
int ghost_count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.Ghost)
ghost_count++;
}
if (ghost_count != ghost_done)
{
Logger.DebugWriteLine("************************last chain card= " + AI.Utils.GetLastChainCard().Id);
ghost_used = true;
}
if (ghost_used && AI.Utils.ChainContainsCard(CardId.WindwitchGlassBell))
{
AI.SelectCard(CardId.WindwitchIceBell);
Logger.DebugWriteLine("***********WindwitchGlassBell*********************");
}
}
foreach (ClientCard dangerous in Enemy.GetMonsters())
{
if (dangerous != null && dangerous.IsShouldNotBeTarget() &&
(dangerous.Attack > 2500 || dangerous.Defense > 2500) &&
!Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{
plan_C = true;
Logger.DebugWriteLine("*********dangerous = " + dangerous.Id);
}
}
int count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.MaxxC)
count++;
}
maxxc_done = count;
count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.LockBird)
count++;
}
lockbird_done = count;
count = 0;
foreach (ClientCard check in Enemy.Graveyard)
{
if (check.Id == CardId.Ghost)
count++;
}
ghost_done = count;
base.OnChainEnd();
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
/*
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
attackerzone = -1;
defenderzone = -1;
for (int a = 0; a <= 6; a++)
for (int b = 0; b <= 6; b++)
{
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b] != null &&
SameMonsterColumn(a, b) &&
Bot.MonsterZone[a].Id == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id)
{
attackerzone = a;
defenderzone = b;
}
}
Logger.DebugWriteLine("**********attack_zone= " + attackerzone + " defender_zone= " + defenderzone);
if (!SameMonsterColumn(attackerzone, defenderzone) && IsJackKnightMonster(defenderzone))
{
Logger.DebugWriteLine("**********cant attack ");
return false;
}
}
*/
//Logger.DebugWriteLine("@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= " + ApprenticeLllusionMagician_count);
if (Bot.HasInSpellZone(CardId.OddEyesWingDragon))
big_attack = true;
if (Duel.Player == 0 && Bot.GetMonsterCount() >= 2 && plan_C)
{
Logger.DebugWriteLine("*********dangerous********************* ");
if (attacker.Id == CardId.OddEyesAbsoluteDragon || attacker.Id == CardId.OddEyesWingDragon)
attacker.RealPower = 9999;
}
if ((attacker.Id == CardId.DarkMagician ||
attacker.Id == CardId.MagiciansRod ||
attacker.Id == CardId.BigEye ||
attacker.Id == CardId.ApprenticeWitchling) &&
Bot.HasInHandOrHasInMonstersZone(CardId.ApprenticeLllusionMagician))
{
attacker.RealPower += 2000;
}
if (attacker.Id == CardId.ApprenticeLllusionMagician && ApprenticeLllusionMagician_count >= 2)
{
attacker.RealPower += 2000;
}
if ((attacker.Id == CardId.DarkMagician || attacker.Id == CardId.DarkMagicianTheDragonKnight)
&& Bot.HasInSpellZone(CardId.EternalSoul))
{
return true;
}
if (attacker.Id == CardId.CrystalWingSynchroDragon)
{
if (defender.Level >= 5)
attacker.RealPower = 9999;
if (CrystalWingSynchroDragon_used == false)
return true;
}
if (!big_attack_used && big_attack)
{
attacker.RealPower = 9999;
big_attack_used = true;
return true;
}
if (attacker.Id == CardId.ApprenticeLllusionMagician)
Logger.DebugWriteLine("@@@@@@@@@@@@@@@@@@@ApprenticeLllusionMagician= " + attacker.RealPower);
if (Bot.HasInSpellZone(CardId.EternalSoul) &&
(attacker.Id == CardId.DarkMagician || attacker.Id == CardId.DarkMagicianTheDragonKnight || attacker.Id == CardId.MagicianOfLllusion))
return true;
return base.OnPreBattleBetween(attacker, defender);
}
/*
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
for (int i = 0; i < defenders.Count; ++i)
{
ClientCard defender = defenders[i];
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
for (int b = 0; b <= 6; b++)
{
if (Enemy.MonsterZone[b] != null &&
SameMonsterColumn(attackerzone, b) &&
Bot.MonsterZone[attackerzone].Id == attacker.Id && Enemy.MonsterZone[b].Id == defender.Id)
{
defenderzone = b;
}
}
if (defenderzone == -1)
{
Logger.DebugWriteLine("**********firstattackerzone= " + attackerzone + " firstTargetzone= " + defenderzone);
return null;
}
}
}
defenderzone = -1;
return base.OnSelectAttackTarget(attacker,defenders);
}
*/
/*
public override ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
for (int i = 0; i < attackers.Count; ++i)
{
ClientCard attacker = attackers[i];
for(int j = 0;j < defenders.Count;++j)
{
ClientCard defender = defenders[j];
if (Enemy.HasInMonstersZone(CardId.MekkKnightMorningStar))
{
attackerzone = -1;
defenderzone = -1;
for(int a = 0;a <= 6;a++)
for(int b = 0;b <= 6;b++)
{
if (Bot.MonsterZone[a] != null && Enemy.MonsterZone[b]!=null &&
SameMonsterColumn(a,b) &&
Bot.MonsterZone[a].Id==attacker.Id && Enemy.MonsterZone[b].Id == defender.Id)
{
attackerzone = a;
defenderzone = b;
}
}
if (defenderzone != -1)
{
Logger.DebugWriteLine("**********firstattackerzone= " + attackerzone + " firstdefenderzone= " + defenderzone);
return attacker;
}
}
}
}
return base.OnSelectAttacker(attackers,defenders);
}
*/
public bool MonsterRepos()
{
if (Bot.HasInMonstersZone(CardId.OddEyesWingDragon) ||
Bot.HasInSpellZone(CardId.OddEyesWingDragon) ||
Bot.HasInMonstersZone(CardId.OddEyesAbsoluteDragon))
{
if (Card.IsAttack())
return false;
}
if (Bot.HasInMonstersZone(CardId.ApprenticeLllusionMagician) || (Bot.HasInHand(CardId.ApprenticeLllusionMagician)))
{
if (Card.IsAttack())
return false;
}
if (Card.IsFacedown())
return true;
return base.DefaultMonsterRepos();
}
}
}
\ No newline at end of file
...@@ -1052,7 +1052,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1052,7 +1052,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;
ClientCard select = AI.Utils.GetBestEnemyMonster(); ClientCard select = AI.Utils.GetBestEnemyCard();
if (select == null) return false; if (select == null) return false;
if(select!=null) if(select!=null)
{ {
......
...@@ -11,18 +11,18 @@ namespace WindBot.Game.AI.Decks ...@@ -11,18 +11,18 @@ namespace WindBot.Game.AI.Decks
{ {
public class CardId public class CardId
{ {
public const int Rei = 26077387; public const int Raye = 26077387;
public const int Kagari = 63288573; public const int Kagari = 63288573;
public const int Shizuku = 90673288; public const int Shizuku = 90673288;
public const int Hayate = 8491308; public const int Hayate = 8491308;
public const int Token = 52340445; public const int Token = 52340445;
public const int Engage = 63166095; public const int Engage = 63166095;
public const int HornetBit = 52340444; public const int HornetDrones = 52340444;
public const int WidowAnchor = 98338152; public const int WidowAnchor = 98338152;
public const int Afterburner = 99550630; public const int Afterburners = 99550630;
public const int JammingWave = 25955749; public const int JammingWave = 25955749;
public const int MultiRoll = 24010609; public const int Multirole = 24010609;
public const int HerculesBase = 97616504; public const int HerculesBase = 97616504;
public const int AreaZero = 50005218; public const int AreaZero = 50005218;
...@@ -73,22 +73,22 @@ namespace WindBot.Game.AI.Decks ...@@ -73,22 +73,22 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.TwinTwisters, TwinTwistersEffect); AddExecutor(ExecutorType.Activate, CardId.TwinTwisters, TwinTwistersEffect);
// //
AddExecutor(ExecutorType.Activate, CardId.MultiRoll, MultiRollHandEffect); AddExecutor(ExecutorType.Activate, CardId.Multirole, MultiroleHandEffect);
AddExecutor(ExecutorType.Activate, CardId.WidowAnchor, WidowAnchorEffectFirst); AddExecutor(ExecutorType.Activate, CardId.WidowAnchor, WidowAnchorEffectFirst);
AddExecutor(ExecutorType.Activate, CardId.Afterburner, AfterburnerEffect); AddExecutor(ExecutorType.Activate, CardId.Afterburners, AfterburnersEffect);
AddExecutor(ExecutorType.Activate, CardId.JammingWave, JammingWaveEffect); AddExecutor(ExecutorType.Activate, CardId.JammingWave, JammingWaveEffect);
AddExecutor(ExecutorType.Activate, CardId.Engage, EngageEffectFirst); AddExecutor(ExecutorType.Activate, CardId.Engage, EngageEffectFirst);
AddExecutor(ExecutorType.Activate, CardId.HornetBit, HornetBitEffect); AddExecutor(ExecutorType.Activate, CardId.HornetDrones, HornetDronesEffect);
AddExecutor(ExecutorType.Activate, CardId.WidowAnchor, WidowAnchorEffect); AddExecutor(ExecutorType.Activate, CardId.WidowAnchor, WidowAnchorEffect);
AddExecutor(ExecutorType.Activate, CardId.HerculesBase, HerculesBaseEffect); AddExecutor(ExecutorType.Activate, CardId.HerculesBase, HerculesBaseEffect);
AddExecutor(ExecutorType.Activate, CardId.AreaZero, AreaZeroEffect); AddExecutor(ExecutorType.Activate, CardId.AreaZero, AreaZeroEffect);
AddExecutor(ExecutorType.Activate, CardId.MultiRoll, MultiRollEffect); AddExecutor(ExecutorType.Activate, CardId.Multirole, MultiroleEffect);
AddExecutor(ExecutorType.Activate, CardId.Engage, EngageEffect); AddExecutor(ExecutorType.Activate, CardId.Engage, EngageEffect);
...@@ -98,7 +98,7 @@ namespace WindBot.Game.AI.Decks ...@@ -98,7 +98,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.GhostRabbit, TunerSummon); AddExecutor(ExecutorType.Summon, CardId.GhostRabbit, TunerSummon);
AddExecutor(ExecutorType.Summon, CardId.AshBlossom, TunerSummon); AddExecutor(ExecutorType.Summon, CardId.AshBlossom, TunerSummon);
AddExecutor(ExecutorType.Activate, CardId.Rei, ReiEffect); AddExecutor(ExecutorType.Activate, CardId.Raye, RayeEffect);
AddExecutor(ExecutorType.SpSummon, CardId.Kagari, KagariSummon); AddExecutor(ExecutorType.SpSummon, CardId.Kagari, KagariSummon);
AddExecutor(ExecutorType.Activate, CardId.Kagari, KagariEffect); AddExecutor(ExecutorType.Activate, CardId.Kagari, KagariEffect);
...@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks ...@@ -116,7 +116,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, CardId.TopologicBomberDragon, AI.Utils.IsTurn1OrMain2); AddExecutor(ExecutorType.SpSummon, CardId.TopologicBomberDragon, AI.Utils.IsTurn1OrMain2);
AddExecutor(ExecutorType.Summon, CardId.Rei, ReiSummon); AddExecutor(ExecutorType.Summon, CardId.Raye, RayeSummon);
// //
AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment); AddExecutor(ExecutorType.SpellSet, CardId.SolemnJudgment);
...@@ -125,11 +125,11 @@ namespace WindBot.Game.AI.Decks ...@@ -125,11 +125,11 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpellSet, CardId.HerculesBase); AddExecutor(ExecutorType.SpellSet, CardId.HerculesBase);
AddExecutor(ExecutorType.SpellSet, CardId.TwinTwisters, HandFull); AddExecutor(ExecutorType.SpellSet, CardId.TwinTwisters, HandFull);
AddExecutor(ExecutorType.SpellSet, CardId.HornetBit, HandFull); AddExecutor(ExecutorType.SpellSet, CardId.HornetDrones, HandFull);
// //
AddExecutor(ExecutorType.Activate, CardId.MetalfoesFusion); AddExecutor(ExecutorType.Activate, CardId.MetalfoesFusion);
AddExecutor(ExecutorType.Activate, CardId.MultiRoll, MultiRollEPEffect); AddExecutor(ExecutorType.Activate, CardId.Multirole, MultiroleEPEffect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
} }
...@@ -177,7 +177,7 @@ namespace WindBot.Game.AI.Decks ...@@ -177,7 +177,7 @@ namespace WindBot.Game.AI.Decks
else else
return false; return false;
} }
if (desc == AI.Utils.GetStringId(CardId.Afterburner, 0)) // destroy spell & trap? if (desc == AI.Utils.GetStringId(CardId.Afterburners, 0)) // destroy spell & trap?
{ {
ClientCard target = AI.Utils.GetBestEnemySpell(); ClientCard target = AI.Utils.GetBestEnemySpell();
if (target != null) if (target != null)
...@@ -233,24 +233,24 @@ namespace WindBot.Game.AI.Decks ...@@ -233,24 +233,24 @@ namespace WindBot.Game.AI.Decks
CardId.MetalfoesFusion, CardId.MetalfoesFusion,
CardId.WidowAnchor, CardId.WidowAnchor,
CardId.Engage, CardId.Engage,
CardId.HornetBit CardId.HornetDrones
}); });
return true; return true;
} }
private bool MultiRollHandEffect() private bool MultiroleHandEffect()
{ {
return Card.Location == CardLocation.Hand; return Card.Location == CardLocation.Hand;
} }
private bool MultiRollEPEffect() private bool MultiroleEPEffect()
{ {
if (Duel.Phase != DuelPhase.End) if (Duel.Phase != DuelPhase.End)
return false; return false;
IList<int> targets = new[] { IList<int> targets = new[] {
CardId.Engage, CardId.Engage,
CardId.HornetBit, CardId.HornetDrones,
CardId.WidowAnchor CardId.WidowAnchor
}; };
AI.SelectCard(targets); AI.SelectCard(targets);
...@@ -259,7 +259,7 @@ namespace WindBot.Game.AI.Decks ...@@ -259,7 +259,7 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
private bool AfterburnerEffect() private bool AfterburnersEffect()
{ {
ClientCard target = AI.Utils.GetBestEnemyMonster(true); ClientCard target = AI.Utils.GetBestEnemyMonster(true);
if (target != null) if (target != null)
...@@ -291,6 +291,8 @@ namespace WindBot.Game.AI.Decks ...@@ -291,6 +291,8 @@ namespace WindBot.Game.AI.Decks
private bool WidowAnchorEffectFirst() private bool WidowAnchorEffectFirst()
{ {
if (AI.Utils.ChainContainsCard(CardId.WidowAnchor))
return false;
ClientCard target = AI.Utils.GetProblematicEnemyMonster(); ClientCard target = AI.Utils.GetProblematicEnemyMonster();
if (target != null) if (target != null)
{ {
...@@ -311,11 +313,11 @@ namespace WindBot.Game.AI.Decks ...@@ -311,11 +313,11 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
else else
AI.SelectCard(new[] { AI.SelectCard(new[] {
CardId.MultiRoll, CardId.Multirole,
CardId.AreaZero, CardId.AreaZero,
CardId.Afterburner, CardId.Afterburners,
CardId.JammingWave, CardId.JammingWave,
CardId.Rei CardId.Raye
}); });
return true; return true;
...@@ -329,17 +331,17 @@ namespace WindBot.Game.AI.Decks ...@@ -329,17 +331,17 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(target); AI.SelectCard(target);
else else
AI.SelectCard(new[] { AI.SelectCard(new[] {
CardId.MultiRoll, CardId.Multirole,
CardId.AreaZero, CardId.AreaZero,
CardId.Afterburner, CardId.Afterburners,
CardId.JammingWave, CardId.JammingWave,
CardId.Rei CardId.Raye
}); });
return true; return true;
} }
private bool HornetBitEffect() private bool HornetDronesEffect()
{ {
if (Duel.Player == 1) if (Duel.Player == 1)
{ {
...@@ -449,7 +451,7 @@ namespace WindBot.Game.AI.Decks ...@@ -449,7 +451,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetMonsters()) foreach (ClientCard target in Bot.GetMonsters())
{ {
if (target.Id == CardId.Rei && Bot.GetMonstersExtraZoneCount() == 0) if (target.Id == CardId.Raye && Bot.GetMonstersExtraZoneCount() == 0)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -457,7 +459,7 @@ namespace WindBot.Game.AI.Decks ...@@ -457,7 +459,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetSpells()) foreach (ClientCard target in Bot.GetSpells())
{ {
if (target.Id != CardId.AreaZero && target.Id != CardId.MultiRoll && target.Id != CardId.WidowAnchor && target.IsSpell()) if (target.Id != CardId.AreaZero && target.Id != CardId.Multirole && target.Id != CardId.WidowAnchor && target.IsSpell())
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -466,7 +468,7 @@ namespace WindBot.Game.AI.Decks ...@@ -466,7 +468,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
private bool MultiRollEffect() private bool MultiroleEffect()
{ {
if (Card.Location == CardLocation.SpellZone) if (Card.Location == CardLocation.SpellZone)
{ {
...@@ -480,7 +482,7 @@ namespace WindBot.Game.AI.Decks ...@@ -480,7 +482,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetMonsters()) foreach (ClientCard target in Bot.GetMonsters())
{ {
if (target.Id == CardId.Rei && Bot.GetMonstersExtraZoneCount() == 0) if (target.Id == CardId.Raye && Bot.GetMonstersExtraZoneCount() == 0)
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -496,7 +498,7 @@ namespace WindBot.Game.AI.Decks ...@@ -496,7 +498,7 @@ namespace WindBot.Game.AI.Decks
} }
foreach (ClientCard target in Bot.GetSpells()) foreach (ClientCard target in Bot.GetSpells())
{ {
if (target.Id != CardId.MultiRoll && target.Id != CardId.WidowAnchor && target.IsSpell()) if (target.Id != CardId.Multirole && target.Id != CardId.WidowAnchor && target.IsSpell())
{ {
AI.SelectCard(target); AI.SelectCard(target);
return true; return true;
...@@ -506,7 +508,7 @@ namespace WindBot.Game.AI.Decks ...@@ -506,7 +508,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
private bool ReiSummon() private bool RayeSummon()
{ {
if (Bot.GetMonstersExtraZoneCount() == 0) if (Bot.GetMonstersExtraZoneCount() == 0)
{ {
...@@ -515,7 +517,7 @@ namespace WindBot.Game.AI.Decks ...@@ -515,7 +517,7 @@ namespace WindBot.Game.AI.Decks
return false; return false;
} }
private bool ReiEffect() private bool RayeEffect()
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
...@@ -527,32 +529,32 @@ namespace WindBot.Game.AI.Decks ...@@ -527,32 +529,32 @@ namespace WindBot.Game.AI.Decks
} }
if (AI.Utils.IsChainTarget(Card)) if (AI.Utils.IsChainTarget(Card))
{ {
ReiSelectTarget(); RayeSelectTarget();
return true; return true;
} }
if (Card.Attacked && Duel.Phase == DuelPhase.BattleStart) if (Card.Attacked && Duel.Phase == DuelPhase.BattleStart)
{ {
ReiSelectTarget(); RayeSelectTarget();
return true; return true;
} }
if (Card == Bot.BattlingMonster && Duel.Player == 1) if (Card == Bot.BattlingMonster && Duel.Player == 1)
{ {
ReiSelectTarget(); RayeSelectTarget();
return true; return true;
} }
if (Duel.Phase == DuelPhase.Main2) if (Duel.Phase == DuelPhase.Main2)
{ {
ReiSelectTarget(); RayeSelectTarget();
return true; return true;
} }
return false; return false;
} }
private void ReiSelectTarget() private void RayeSelectTarget()
{ {
if (!KagariSummoned && Bot.HasInGraveyard(new[] { if (!KagariSummoned && Bot.HasInGraveyard(new[] {
CardId.Engage, CardId.Engage,
CardId.HornetBit, CardId.HornetDrones,
CardId.WidowAnchor CardId.WidowAnchor
})) }))
{ {
...@@ -572,7 +574,7 @@ namespace WindBot.Game.AI.Decks ...@@ -572,7 +574,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInGraveyard(new[] { if (Bot.HasInGraveyard(new[] {
CardId.Engage, CardId.Engage,
CardId.HornetBit, CardId.HornetDrones,
CardId.WidowAnchor CardId.WidowAnchor
})) }))
{ {
...@@ -584,9 +586,9 @@ namespace WindBot.Game.AI.Decks ...@@ -584,9 +586,9 @@ namespace WindBot.Game.AI.Decks
private bool KagariEffect() private bool KagariEffect()
{ {
if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemyMonster() != null && Bot.HasInGraveyard(CardId.Afterburner)) if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemyMonster() != null && Bot.HasInGraveyard(CardId.Afterburners))
{ {
AI.SelectCard(CardId.Afterburner); AI.SelectCard(CardId.Afterburners);
} }
else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemySpell() != null && Bot.HasInGraveyard(CardId.JammingWave)) else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemySpell() != null && Bot.HasInGraveyard(CardId.JammingWave))
{ {
...@@ -595,7 +597,7 @@ namespace WindBot.Game.AI.Decks ...@@ -595,7 +597,7 @@ namespace WindBot.Game.AI.Decks
else else
AI.SelectCard(new[] { AI.SelectCard(new[] {
CardId.Engage, CardId.Engage,
CardId.HornetBit, CardId.HornetDrones,
CardId.WidowAnchor CardId.WidowAnchor
}); });
return true; return true;
...@@ -619,7 +621,7 @@ namespace WindBot.Game.AI.Decks ...@@ -619,7 +621,7 @@ namespace WindBot.Game.AI.Decks
else else
AI.SelectCard(new[] { AI.SelectCard(new[] {
CardId.Engage, CardId.Engage,
CardId.HornetBit, CardId.HornetDrones,
CardId.WidowAnchor CardId.WidowAnchor
}); });
return true; return true;
...@@ -635,10 +637,10 @@ namespace WindBot.Game.AI.Decks ...@@ -635,10 +637,10 @@ namespace WindBot.Game.AI.Decks
private bool HayateEffect() private bool HayateEffect()
{ {
if (!Bot.HasInGraveyard(CardId.Rei)) if (!Bot.HasInGraveyard(CardId.Raye))
AI.SelectCard(CardId.Rei); AI.SelectCard(CardId.Raye);
else if (!Bot.HasInGraveyard(CardId.HornetBit)) else if (!Bot.HasInGraveyard(CardId.HornetDrones))
AI.SelectCard(CardId.HornetBit); AI.SelectCard(CardId.HornetDrones);
else if (!Bot.HasInGraveyard(CardId.WidowAnchor)) else if (!Bot.HasInGraveyard(CardId.WidowAnchor))
AI.SelectCard(CardId.WidowAnchor); AI.SelectCard(CardId.WidowAnchor);
return true; return true;
...@@ -676,7 +678,7 @@ namespace WindBot.Game.AI.Decks ...@@ -676,7 +678,7 @@ namespace WindBot.Game.AI.Decks
private bool JetSynchronEffect() private bool JetSynchronEffect()
{ {
if (Bot.HasInMonstersZone(CardId.Rei) || Bot.HasInMonstersZone(CardId.CrystronNeedlefiber)) if (Bot.HasInMonstersZone(CardId.Raye) || Bot.HasInMonstersZone(CardId.CrystronNeedlefiber))
{ {
AI.SelectCard(GetDiscardHand()); AI.SelectCard(GetDiscardHand());
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectPosition(CardPosition.FaceUpDefence);
...@@ -694,8 +696,8 @@ namespace WindBot.Game.AI.Decks ...@@ -694,8 +696,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInHand(CardId.MetalfoesFusion)) if (Bot.HasInHand(CardId.MetalfoesFusion))
return CardId.MetalfoesFusion; return CardId.MetalfoesFusion;
if (Bot.HasInHand(CardId.Rei) && !Bot.HasInGraveyard(CardId.Rei)) if (Bot.HasInHand(CardId.Raye) && !Bot.HasInGraveyard(CardId.Raye))
return CardId.Rei; return CardId.Raye;
if (Bot.HasInHand(CardId.JetSynchron)) if (Bot.HasInHand(CardId.JetSynchron))
return CardId.JetSynchron; return CardId.JetSynchron;
if (Bot.HasInHand(CardId.ReinforcementOfTheArmy)) if (Bot.HasInHand(CardId.ReinforcementOfTheArmy))
...@@ -707,25 +709,25 @@ namespace WindBot.Game.AI.Decks ...@@ -707,25 +709,25 @@ namespace WindBot.Game.AI.Decks
private int GetCardToSearch() private int GetCardToSearch()
{ {
if (!Bot.HasInHand(CardId.HornetBit) && Bot.GetRemainingCount(CardId.HornetBit, 3) > 0) if (!Bot.HasInHand(CardId.HornetDrones) && Bot.GetRemainingCount(CardId.HornetDrones, 3) > 0)
{ {
return CardId.HornetBit; return CardId.HornetDrones;
} }
else if (AI.Utils.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.WidowAnchor, 3) > 0) else if (AI.Utils.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.WidowAnchor, 3) > 0)
{ {
return CardId.WidowAnchor; return CardId.WidowAnchor;
} }
else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.Afterburner, 1) > 0) else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemyMonster() != null && Bot.GetRemainingCount(CardId.Afterburners, 1) > 0)
{ {
return CardId.Afterburner; return CardId.Afterburners;
} }
else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemySpell() != null && Bot.GetRemainingCount(CardId.JammingWave, 1) > 0) else if (EmptyMainMonsterZone() && AI.Utils.GetProblematicEnemySpell() != null && Bot.GetRemainingCount(CardId.JammingWave, 1) > 0)
{ {
return CardId.JammingWave; return CardId.JammingWave;
} }
else if (!Bot.HasInHand(CardId.Rei) && !Bot.HasInMonstersZone(CardId.Rei) && Bot.GetRemainingCount(CardId.Rei, 3) > 0) else if (!Bot.HasInHand(CardId.Raye) && !Bot.HasInMonstersZone(CardId.Raye) && Bot.GetRemainingCount(CardId.Raye, 3) > 0)
{ {
return CardId.Rei; return CardId.Raye;
} }
else if (!Bot.HasInHand(CardId.WidowAnchor) && !Bot.HasInSpellZone(CardId.WidowAnchor) && Bot.GetRemainingCount(CardId.WidowAnchor, 3) > 0) else if (!Bot.HasInHand(CardId.WidowAnchor) && !Bot.HasInSpellZone(CardId.WidowAnchor) && Bot.GetRemainingCount(CardId.WidowAnchor, 3) > 0)
{ {
......
...@@ -25,7 +25,9 @@ namespace WindBot.Game.AI ...@@ -25,7 +25,9 @@ namespace WindBot.Game.AI
public const int DupeFrog = 46239604; public const int DupeFrog = 46239604;
public const int MaraudingCaptain = 2460565; public const int MaraudingCaptain = 2460565;
public const int EvilswarmExcitonKnight = 46772449;
public const int HarpiesFeatherDuster = 18144506; public const int HarpiesFeatherDuster = 18144506;
public const int DarkMagicAttack = 2314238;
public const int MysticalSpaceTyphoon = 5318639; public const int MysticalSpaceTyphoon = 5318639;
public const int CosmicCyclone = 8267140; public const int CosmicCyclone = 8267140;
public const int ChickenGame = 67616300; public const int ChickenGame = 67616300;
...@@ -39,6 +41,7 @@ namespace WindBot.Game.AI ...@@ -39,6 +41,7 @@ namespace WindBot.Game.AI
public const int VampireFräulein = 6039967; public const int VampireFräulein = 6039967;
public const int InjectionFairyLily = 79575620; public const int InjectionFairyLily = 79575620;
public const int BlueEyesChaosMAXDragon = 55410871;
} }
protected DefaultExecutor(GameAI ai, Duel duel) protected DefaultExecutor(GameAI ai, Duel duel)
...@@ -469,7 +472,13 @@ namespace WindBot.Game.AI ...@@ -469,7 +472,13 @@ namespace WindBot.Game.AI
{ {
if (Card.IsFaceup() && Card.IsDefense() && Card.Attack == 0) if (Card.IsFaceup() && Card.IsDefense() && Card.Attack == 0)
return false; return false;
if (Enemy.HasInMonstersZone(_CardId.BlueEyesChaosMAXDragon) &&
Card.IsAttack() && (4000-Card.Defense)*2>(4000 - Card.Attack))
return false;
if (Enemy.HasInMonstersZone(_CardId.BlueEyesChaosMAXDragon) &&
Card.IsDefense() && Card.IsFaceup() &&
(4000 - Card.Defense) * 2 > (4000 - Card.Attack))
return true;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true); bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
...@@ -485,7 +494,9 @@ namespace WindBot.Game.AI ...@@ -485,7 +494,9 @@ namespace WindBot.Game.AI
protected bool DefaultOnBecomeTarget() protected bool DefaultOnBecomeTarget()
{ {
if (AI.Utils.IsChainTarget(Card)) return true; if (AI.Utils.IsChainTarget(Card)) return true;
if (AI.Utils.ChainContainsCard(_CardId.EvilswarmExcitonKnight)) return true;
if (Enemy.HasInSpellZone(_CardId.HarpiesFeatherDuster, true)) return true; if (Enemy.HasInSpellZone(_CardId.HarpiesFeatherDuster, true)) return true;
if (Enemy.HasInSpellZone(_CardId.DarkMagicAttack, true)) return true;
return false; return false;
} }
/// <summary> /// <summary>
......
...@@ -80,15 +80,15 @@ namespace WindBot.Game.AI ...@@ -80,15 +80,15 @@ namespace WindBot.Game.AI
public void SendSorry() public void SendSorry()
{ {
InternalSendMessage(new[] { "Sorry, an error occurs." }); InternalSendMessageForced(new[] { "Sorry, an error occurs." });
} }
public void SendDeckSorry(string card) public void SendDeckSorry(string card)
{ {
if (card == "DECK") if (card == "DECK")
InternalSendMessage(new[] { "Deck illegal. Please check the database of your YGOPro and WindBot." }); InternalSendMessageForced(new[] { "Deck illegal. Please check the database of your YGOPro and WindBot." });
else else
InternalSendMessage(_deckerror, card); InternalSendMessageForced(_deckerror, card);
} }
public void SendWelcome() public void SendWelcome()
...@@ -159,6 +159,15 @@ namespace WindBot.Game.AI ...@@ -159,6 +159,15 @@ namespace WindBot.Game.AI
} }
private void InternalSendMessage(IList<string> array, params object[] opts) private void InternalSendMessage(IList<string> array, params object[] opts)
{
if (!_game._chat)
return;
string message = string.Format(array[Program.Rand.Next(array.Count)], opts);
if (message != "")
_game.Chat(message);
}
private void InternalSendMessageForced(IList<string> array, params object[] opts)
{ {
string message = string.Format(array[Program.Rand.Next(array.Count)], opts); string message = string.Format(array[Program.Rand.Next(array.Count)], opts);
if (message != "") if (message != "")
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
ElShaddollGrysra = 48424886, ElShaddollGrysra = 48424886,
ElShaddollWinda = 94977269, ElShaddollWinda = 94977269,
UltimateConductorTytanno = 18940556, UltimateConductorTytanno = 18940556,
OvertexCoatls = 41782653 OvertexCoatls = 41782653,
FirePrison = 269510
} }
} }
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
FlowerCardianLightshower = 42291297, FlowerCardianLightshower = 42291297,
YaziEviloftheYangZing = 43202238, YaziEviloftheYangZing = 43202238,
RaidraptorUltimateFalcon = 86221741, RaidraptorUltimateFalcon = 86221741,
DisdainfulBirdofParadise = 27240101 DisdainfulBirdofParadise = 27240101,
DarkestDiabolosLordOfTheLair = 50383626
} }
} }
...@@ -98,6 +98,11 @@ namespace WindBot.Game.AI ...@@ -98,6 +98,11 @@ namespace WindBot.Game.AI
// Some AI need do something on new turn // Some AI need do something on new turn
} }
public virtual void OnDraw(int player)
{
// Some AI need do something on draw
}
public virtual IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable) public virtual IList<ClientCard> OnSelectCard(IList<ClientCard> cards, int min, int max, int hint, bool cancelable)
{ {
// For overriding // For overriding
...@@ -146,6 +151,12 @@ namespace WindBot.Game.AI ...@@ -146,6 +151,12 @@ namespace WindBot.Game.AI
return null; return null;
} }
public virtual IList<ClientCard> OnCardSorting(IList<ClientCard> cards)
{
// For overriding
return null;
}
public virtual bool OnSelectYesNo(int desc) public virtual bool OnSelectYesNo(int desc)
{ {
return true; return true;
......
...@@ -23,7 +23,7 @@ namespace WindBot.Game ...@@ -23,7 +23,7 @@ namespace WindBot.Game
public int Defense { get; private set; } public int Defense { get; private set; }
public int LScale { get; private set; } public int LScale { get; private set; }
public int RScale { get; private set; } public int RScale { get; private set; }
public int Link { get; private set; } public int LinkCount { get; private set; }
public int LinkMarker { get; private set; } public int LinkMarker { get; private set; }
public int BaseAttack { get; private set; } public int BaseAttack { get; private set; }
public int BaseDefense { get; private set; } public int BaseDefense { get; private set; }
...@@ -136,11 +136,21 @@ namespace WindBot.Game ...@@ -136,11 +136,21 @@ namespace WindBot.Game
RScale = packet.ReadInt32(); RScale = packet.ReadInt32();
if ((flag & (int)Query.Link) != 0) if ((flag & (int)Query.Link) != 0)
{ {
Link = packet.ReadInt32(); LinkCount = packet.ReadInt32();
LinkMarker = packet.ReadInt32(); LinkMarker = packet.ReadInt32();
} }
} }
public bool HasLinkMarker(int dir)
{
return ((LinkMarker & dir) != 0);
}
public bool HasLinkMarker(LinkMarker dir)
{
return ((LinkMarker & (int)dir) != 0);
}
public bool HasType(CardType type) public bool HasType(CardType type)
{ {
return ((Type & (int)type) != 0); return ((Type & (int)type) != 0);
......
...@@ -71,6 +71,30 @@ namespace WindBot.Game ...@@ -71,6 +71,30 @@ namespace WindBot.Game
return count; return count;
} }
/// <summary>
/// Count Column
/// </summary>
/// <param zone>range of zone 0-4</param>
public int GetColumnCount(int zone, bool IncludeExtraMonsterZone = true)
{
int count = 0;
if (SpellZone[zone] != null)
count++;
if (MonsterZone[zone] != null)
count++;
if(zone == 1 && IncludeExtraMonsterZone)
{
if (MonsterZone[5] != null)
count++;
}
if (zone == 3 && IncludeExtraMonsterZone)
{
if (MonsterZone[6] != null)
count++;
}
return count;
}
public int GetFieldCount() public int GetFieldCount()
{ {
...@@ -218,6 +242,76 @@ namespace WindBot.Game ...@@ -218,6 +242,76 @@ namespace WindBot.Game
return HasInCards(SpellZone, cardId, notDisabled); return HasInCards(SpellZone, cardId, notDisabled);
} }
public bool HasInHandOrInSpellZone(int cardId)
{
return HasInHand(cardId) || HasInSpellZone(cardId);
}
public bool HasInHandOrHasInMonstersZone(int cardId)
{
return HasInHand(cardId) || HasInMonstersZone(cardId);
}
public bool HasInHandOrInGraveyard(int cardId)
{
return HasInHand(cardId) || HasInGraveyard(cardId);
}
public bool HasInMonstersZoneOrInGraveyard(int cardId)
{
return HasInMonstersZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInSpellZoneOrInGraveyard(int cardId)
{
return HasInSpellZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInHandOrInMonstersZoneOrInGraveyard(int cardId)
{
return HasInHand(cardId) || HasInMonstersZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInHandOrInSpellZoneOrInGraveyard(int cardId)
{
return HasInHand(cardId) || HasInSpellZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInHandOrInSpellZone(IList<int> cardId)
{
return HasInHand(cardId) || HasInSpellZone(cardId);
}
public bool HasInHandOrHasInMonstersZone(IList<int> cardId)
{
return HasInHand(cardId) || HasInMonstersZone(cardId);
}
public bool HasInHandOrInGraveyard(IList<int> cardId)
{
return HasInHand(cardId) || HasInGraveyard(cardId);
}
public bool HasInMonstersZoneOrInGraveyard(IList<int> cardId)
{
return HasInMonstersZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInSpellZoneOrInGraveyard(IList<int> cardId)
{
return HasInSpellZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInHandOrInMonstersZoneOrInGraveyard(IList<int> cardId)
{
return HasInHand(cardId) || HasInMonstersZone(cardId) || HasInGraveyard(cardId);
}
public bool HasInHandOrInSpellZoneOrInGraveyard(IList<int> cardId)
{
return HasInHand(cardId) || HasInSpellZone(cardId) || HasInGraveyard(cardId);
}
public int GetRemainingCount(int cardId, int initialCount) public int GetRemainingCount(int cardId, int initialCount)
{ {
int remaining = initialCount; int remaining = initialCount;
......
...@@ -70,6 +70,14 @@ namespace WindBot.Game ...@@ -70,6 +70,14 @@ namespace WindBot.Game
return Executor.OnSelectHand(); return Executor.OnSelectHand();
} }
/// <summary>
/// Called when any player draw card.
/// </summary>
public void OnDraw(int player)
{
Executor.OnDraw(player);
}
/// <summary> /// <summary>
/// Called when it's a new turn. /// Called when it's a new turn.
/// </summary> /// </summary>
...@@ -329,6 +337,26 @@ namespace WindBot.Game ...@@ -329,6 +337,26 @@ namespace WindBot.Game
return used; return used;
} }
/// <summary>
/// Called when the AI has to sort cards.
/// </summary>
/// <param name="cards">Cards to sort.</param>
/// <returns>List of sorted cards.</returns>
public IList<ClientCard> OnCardSorting(IList<ClientCard> cards)
{
IList<ClientCard> result = Executor.OnCardSorting(cards);
if (result != null)
return result;
result = new List<ClientCard>();
// TODO: use selector
for (int i = 0; i < cards.Count; i++)
{
result.Add(cards[i]);
}
return result;
}
/// <summary> /// <summary>
/// Called when the AI has to choose to activate or not an effect. /// Called when the AI has to choose to activate or not an effect.
/// </summary> /// </summary>
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
...@@ -25,6 +25,7 @@ namespace WindBot.Game ...@@ -25,6 +25,7 @@ namespace WindBot.Game
private Room _room; private Room _room;
private Duel _duel; private Duel _duel;
private int _hand; private int _hand;
private bool _debug;
private int _select_hint; private int _select_hint;
public GameBehavior(GameClient game) public GameBehavior(GameClient game)
...@@ -32,7 +33,7 @@ namespace WindBot.Game ...@@ -32,7 +33,7 @@ namespace WindBot.Game
Game = game; Game = game;
Connection = game.Connection; Connection = game.Connection;
_hand = game.Hand; _hand = game.Hand;
_debug = game.Debug;
_packets = new Dictionary<StocMessage, Action<BinaryReader>>(); _packets = new Dictionary<StocMessage, Action<BinaryReader>>();
_messages = new Dictionary<GameMessage, Action<BinaryReader>>(); _messages = new Dictionary<GameMessage, Action<BinaryReader>>();
RegisterPackets(); RegisterPackets();
...@@ -265,7 +266,6 @@ namespace WindBot.Game ...@@ -265,7 +266,6 @@ namespace WindBot.Game
private void OnDuelEnd(BinaryReader packet) private void OnDuelEnd(BinaryReader packet)
{ {
Connection.Close(); Connection.Close();
Logger.DebugWriteLine("********************* Duel end *********************");
} }
private void OnChat(BinaryReader packet) private void OnChat(BinaryReader packet)
...@@ -353,13 +353,15 @@ namespace WindBot.Game ...@@ -353,13 +353,15 @@ namespace WindBot.Game
{ {
int player = GetLocalPlayer(packet.ReadByte()); int player = GetLocalPlayer(packet.ReadByte());
int count = packet.ReadByte(); int count = packet.ReadByte();
Logger.DebugWriteLine("(" + player.ToString() + "抽了" + count.ToString() + "张卡)"); if (_debug)
Logger.WriteLine("(" + player.ToString() + " draw " + count.ToString() + " card)");
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
_duel.Fields[player].Deck.RemoveAt(_duel.Fields[player].Deck.Count - 1); _duel.Fields[player].Deck.RemoveAt(_duel.Fields[player].Deck.Count - 1);
_duel.Fields[player].Hand.Add(new ClientCard(0, CardLocation.Hand)); _duel.Fields[player].Hand.Add(new ClientCard(0, CardLocation.Hand));
} }
_ai.OnDraw(player);
} }
private void OnShuffleDeck(BinaryReader packet) private void OnShuffleDeck(BinaryReader packet)
...@@ -425,7 +427,17 @@ namespace WindBot.Game ...@@ -425,7 +427,17 @@ namespace WindBot.Game
private void OnNewPhase(BinaryReader packet) private void OnNewPhase(BinaryReader packet)
{ {
_duel.Phase = (DuelPhase)packet.ReadInt16(); _duel.Phase = (DuelPhase)packet.ReadInt16();
Logger.DebugWriteLine("(进入" + (_duel.Phase.ToString()) + ")"); if (_debug && _duel.Phase == DuelPhase.Standby)
{
Logger.WriteLine("*********Bot Hand*********");
foreach (ClientCard card in _duel.Fields[0].Hand)
{
Logger.WriteLine(card.Name);
}
Logger.WriteLine("*********Bot Hand*********");
}
if (_debug)
Logger.WriteLine("(Go to " + (_duel.Phase.ToString()) + ")");
_duel.LastSummonPlayer = -1; _duel.LastSummonPlayer = -1;
_duel.Fields[0].BattlingMonster = null; _duel.Fields[0].BattlingMonster = null;
_duel.Fields[1].BattlingMonster = null; _duel.Fields[1].BattlingMonster = null;
...@@ -437,7 +449,8 @@ namespace WindBot.Game ...@@ -437,7 +449,8 @@ namespace WindBot.Game
int player = GetLocalPlayer(packet.ReadByte()); int player = GetLocalPlayer(packet.ReadByte());
int final = _duel.Fields[player].LifePoints - packet.ReadInt32(); int final = _duel.Fields[player].LifePoints - packet.ReadInt32();
if (final < 0) final = 0; if (final < 0) final = 0;
Logger.DebugWriteLine("(" + player.ToString() + "受到了伤害,当前为" + final.ToString() + ")"); if (_debug)
Logger.WriteLine("(" + player.ToString() + " got damage , LifePoint left= " + final.ToString() + ")");
_duel.Fields[player].LifePoints = final; _duel.Fields[player].LifePoints = final;
} }
...@@ -467,13 +480,16 @@ namespace WindBot.Game ...@@ -467,13 +480,16 @@ 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 ((previousLocation & (int)CardLocation.Overlay) != 0) if ((previousLocation & (int)CardLocation.Overlay) != 0)
{ {
previousLocation = previousLocation & 0x7f; previousLocation = previousLocation & 0x7f;
card = _duel.GetCard(previousControler, (CardLocation)previousLocation, previousSequence); card = _duel.GetCard(previousControler, (CardLocation)previousLocation, previousSequence);
if (card != null) if (card != null)
{
if (_debug)
Logger.WriteLine("(" + previousControler.ToString() + " 's " + (card.Name ?? "UnKnowCard") + " deattach " + (NamedCard.Get(cardId)?.Name) + ")");
card.Overlays.Remove(cardId); card.Overlays.Remove(cardId);
}
previousLocation = 0; // the card is removed when it go to overlay, so here we treat it as a new card previousLocation = 0; // the card is removed when it go to overlay, so here we treat it as a new card
} }
else else
...@@ -484,15 +500,28 @@ namespace WindBot.Game ...@@ -484,15 +500,28 @@ namespace WindBot.Game
currentLocation = currentLocation & 0x7f; currentLocation = currentLocation & 0x7f;
card = _duel.GetCard(currentControler, (CardLocation)currentLocation, currentSequence); card = _duel.GetCard(currentControler, (CardLocation)currentLocation, currentSequence);
if (card != null) if (card != null)
{
if (_debug)
Logger.WriteLine("(" + previousControler.ToString() + " 's " + (card.Name ?? "UnKnowCard") + " overlay " + (NamedCard.Get(cardId)?.Name) + ")");
card.Overlays.Add(cardId); card.Overlays.Add(cardId);
} }
}
else else
{ {
if (previousLocation == 0) if (previousLocation == 0)
{
if (_debug)
Logger.WriteLine("(" + previousControler.ToString() + " 's " + (NamedCard.Get(cardId)?.Name)
+ " appear in " + (CardLocation)currentLocation + ")");
_duel.AddCard((CardLocation)currentLocation, cardId, currentControler, currentSequence, currentPosition); _duel.AddCard((CardLocation)currentLocation, cardId, currentControler, currentSequence, currentPosition);
}
else else
{ {
_duel.AddCard((CardLocation)currentLocation, card, currentControler, currentSequence, currentPosition, cardId); _duel.AddCard((CardLocation)currentLocation, card, currentControler, currentSequence, currentPosition, cardId);
if (_debug && card != null)
Logger.WriteLine("(" + previousControler.ToString() + " 's " + (card.Name ?? "UnKnowCard")
+ " from " +
(CardLocation)previousLocation + " move to " + (CardLocation)currentLocation + ")");
} }
} }
} }
...@@ -510,8 +539,11 @@ namespace WindBot.Game ...@@ -510,8 +539,11 @@ namespace WindBot.Game
ClientCard attackcard = _duel.GetCard(ca, (CardLocation)la, sa); ClientCard attackcard = _duel.GetCard(ca, (CardLocation)la, sa);
ClientCard defendcard = _duel.GetCard(cd, (CardLocation)ld, sd); ClientCard defendcard = _duel.GetCard(cd, (CardLocation)ld, sd);
if (defendcard == null) Logger.DebugWriteLine("(" + (attackcard.Name ?? "未知卡片") + "直接攻击)"); if (_debug)
else Logger.DebugWriteLine("(" + ca.ToString() + "的" + (attackcard.Name ?? "未知卡片") + "攻击了" + cd.ToString() + "的" + (defendcard.Name ?? "未知卡片") + ")"); {
if (defendcard == null) Logger.WriteLine("(" + (attackcard.Name ?? "UnKnowCard") + " direct attack!!)");
else Logger.WriteLine("(" + ca.ToString() + " 's " + (attackcard.Name ?? "UnKnowCard") + " attack " + cd.ToString() + " 's " + (defendcard.Name ?? "UnKnowCard") + ")");
}
_duel.Fields[attackcard.Controller].BattlingMonster = attackcard; _duel.Fields[attackcard.Controller].BattlingMonster = attackcard;
_duel.Fields[1 - attackcard.Controller].BattlingMonster = defendcard; _duel.Fields[1 - attackcard.Controller].BattlingMonster = defendcard;
...@@ -533,7 +565,8 @@ namespace WindBot.Game ...@@ -533,7 +565,8 @@ namespace WindBot.Game
if (card != null) if (card != null)
{ {
card.Position = cp; card.Position = cp;
Logger.DebugWriteLine("(" + (card.Name ?? "未知卡片") + "改变了表示形式为" + (CardPosition)cp + ")"); if (_debug)
Logger.WriteLine("(" + (card.Name ?? "UnKnowCard") + " change position to " + (CardPosition)cp + ")");
} }
} }
...@@ -546,12 +579,14 @@ namespace WindBot.Game ...@@ -546,12 +579,14 @@ namespace WindBot.Game
int subs = packet.ReadSByte(); int subs = packet.ReadSByte();
ClientCard card = _duel.GetCard(pcc, pcl, pcs, subs); ClientCard card = _duel.GetCard(pcc, pcl, pcs, subs);
int cc = GetLocalPlayer(packet.ReadByte()); int cc = GetLocalPlayer(packet.ReadByte());
if (card != null) Logger.DebugWriteLine("(" + cc.ToString() + "的" + (card.Name ?? "未知卡片") + "发动了效果)"); if (_debug)
if (card != null) Logger.WriteLine("(" + cc.ToString() + " 's " + (card.Name ?? "UnKnowCard") + " activate effect)");
_ai.OnChaining(card, cc); _ai.OnChaining(card, cc);
_duel.ChainTargets.Clear(); _duel.ChainTargets.Clear();
_duel.LastSummonPlayer = -1; _duel.LastSummonPlayer = -1;
_duel.CurrentChain.Add(card); _duel.CurrentChain.Add(card);
_duel.LastChainPlayer = cc; _duel.LastChainPlayer = cc;
} }
private void OnChainEnd(BinaryReader packet) private void OnChainEnd(BinaryReader packet)
...@@ -564,8 +599,48 @@ namespace WindBot.Game ...@@ -564,8 +599,48 @@ namespace WindBot.Game
private void OnCardSorting(BinaryReader packet) private void OnCardSorting(BinaryReader packet)
{ {
/*BinaryWriter writer =*/ GamePacketFactory.Create(CtosMessage.Response); /*int player =*/ GetLocalPlayer(packet.ReadByte());
Connection.Send(CtosMessage.Response, -1); IList<ClientCard> originalCards = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>();
int count = packet.ReadByte();
for (int i = 0; i < count; ++i)
{
int id = packet.ReadInt32();
int controler = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
ClientCard card;
if (((int)loc & (int)CardLocation.Overlay) != 0)
card = new ClientCard(id, CardLocation.Overlay);
else
card = _duel.GetCard(controler, loc, seq);
if (card == null) continue;
if (id != 0)
card.SetId(id);
originalCards.Add(card);
cards.Add(card);
}
IList<ClientCard> selected = _ai.OnCardSorting(cards);
byte[] result = new byte[count];
for (int i = 0; i < count; ++i)
{
int id = 0;
for (int j = 0; j < count; ++j)
{
if (selected[j] == null) continue;
if (selected[j].Equals(originalCards[i]))
{
id = j;
break;
}
}
result[i] = (byte)id;
}
BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response);
reply.Write(result);
Connection.Send(reply);
} }
private void OnChainSorting(BinaryReader packet) private void OnChainSorting(BinaryReader packet)
...@@ -641,7 +716,8 @@ namespace WindBot.Game ...@@ -641,7 +716,8 @@ namespace WindBot.Game
/*int sseq = */packet.ReadByte(); /*int sseq = */packet.ReadByte();
ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq); ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
if (card == null) continue; if (card == null) continue;
Logger.DebugWriteLine("(" + (CardLocation)loc + "的" + (card.Name ?? "未知卡片") + "成为了对象)"); if (_debug)
Logger.WriteLine("(" + (CardLocation)loc + " 's " + (card.Name ?? "UnKnowCard") + " become target)");
_duel.ChainTargets.Add(card); _duel.ChainTargets.Add(card);
} }
} }
......
...@@ -14,7 +14,8 @@ namespace WindBot.Game ...@@ -14,7 +14,8 @@ namespace WindBot.Game
public string Deck; public string Deck;
public string Dialog; public string Dialog;
public int Hand; public int Hand;
public bool Debug;
public bool _chat;
private string _serverHost; private string _serverHost;
private int _serverPort; private int _serverPort;
private short _proVersion; private short _proVersion;
...@@ -29,6 +30,8 @@ namespace WindBot.Game ...@@ -29,6 +30,8 @@ namespace WindBot.Game
Deck = Info.Deck; Deck = Info.Deck;
Dialog = Info.Dialog; Dialog = Info.Dialog;
Hand = Info.Hand; Hand = Info.Hand;
Debug = Info.Debug;
_chat = Info.Chat;
_serverHost = Info.Host; _serverHost = Info.Host;
_serverPort = Info.Port; _serverPort = Info.Port;
_roomInfo = Info.HostInfo; _roomInfo = Info.HostInfo;
......
...@@ -74,6 +74,8 @@ namespace WindBot ...@@ -74,6 +74,8 @@ namespace WindBot
Info.HostInfo = Config.GetString("HostInfo", Info.HostInfo); Info.HostInfo = Config.GetString("HostInfo", Info.HostInfo);
Info.Version = Config.GetInt("Version", Info.Version); Info.Version = Config.GetInt("Version", Info.Version);
Info.Hand = Config.GetInt("Hand", Info.Hand); Info.Hand = Config.GetInt("Hand", Info.Hand);
Info.Debug = Config.GetBool("Debug", Info.Debug);
Info.Chat = Config.GetBool("Chat", Info.Chat);
Run(Info); Run(Info);
} }
...@@ -114,6 +116,12 @@ namespace WindBot ...@@ -114,6 +116,12 @@ namespace WindBot
string hand = HttpUtility.ParseQueryString(RawUrl).Get("hand"); string hand = HttpUtility.ParseQueryString(RawUrl).Get("hand");
if (hand != null) if (hand != null)
Info.Hand = Int32.Parse(hand); Info.Hand = Int32.Parse(hand);
string debug = HttpUtility.ParseQueryString(RawUrl).Get("debug");
if (debug != null)
Info.Debug= bool.Parse(debug);
string chat = HttpUtility.ParseQueryString(RawUrl).Get("chat");
if (chat != null)
Info.Chat = bool.Parse(chat);
if (Info.Name == null || Info.Host == null || port == null) if (Info.Name == null || Info.Host == null || port == null)
{ {
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
<Compile Include="Game\AI\DecksManager.cs" /> <Compile Include="Game\AI\DecksManager.cs" />
<Compile Include="Game\AI\Decks\BlackwingExecutor.cs" /> <Compile Include="Game\AI\Decks\BlackwingExecutor.cs" />
<Compile Include="Game\AI\Decks\CyberDragonExecutor.cs" /> <Compile Include="Game\AI\Decks\CyberDragonExecutor.cs" />
<Compile Include="Game\AI\Decks\DarkMagicianExecutor.cs" />
<Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" /> <Compile Include="Game\AI\Decks\SkyStrikerExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" /> <Compile Include="Game\AI\Decks\MokeyMokeyKingExecutor.cs" />
<Compile Include="Game\AI\Decks\MokeyMokeyExecutor.cs" /> <Compile Include="Game\AI\Decks\MokeyMokeyExecutor.cs" />
......
...@@ -12,7 +12,8 @@ namespace WindBot ...@@ -12,7 +12,8 @@ namespace WindBot
public string HostInfo { get; set; } public string HostInfo { get; set; }
public int Version { get; set; } public int Version { get; set; }
public int Hand { get; set; } public int Hand { get; set; }
public bool Debug { get; set; }
public bool Chat { get; set; }
public WindBotInfo() public WindBotInfo()
{ {
Name = "WindBot"; Name = "WindBot";
...@@ -23,6 +24,8 @@ namespace WindBot ...@@ -23,6 +24,8 @@ namespace WindBot
HostInfo = ""; HostInfo = "";
Version = 0x1343; Version = 0x1343;
Hand = 0; Hand = 0;
Debug = false;
Chat = true;
} }
} }
} }
...@@ -120,6 +120,16 @@ ...@@ -120,6 +120,16 @@
"deck": "LightswornShaddoldinosour", "deck": "LightswornShaddoldinosour",
"dialog": "kiwi.zh-TW" "dialog": "kiwi.zh-TW"
}, },
{
"name": "奇魔果",
"deck": "DarkMagician",
"dialog": "kiwi.zh-TW"
},
{
"name": "奇魔果",
"deck": "DarkMagician",
"dialog": "kiwi.zh-TW"
},
{ {
"name": "燃血鬥士", "name": "燃血鬥士",
"deck": "ChainBurn", "deck": "ChainBurn",
......
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