Commit e5d5696d authored by nanahira's avatar nanahira

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

parents 4eaca351 b2bf309b
......@@ -37,7 +37,6 @@
36361633
36361633
36361633
36468556
37576645
37576645
37576645
......@@ -52,7 +51,6 @@
75249652
83555666
98444741
98444741
#extra
41999284
41999284
......@@ -65,4 +63,6 @@
98444741
100227025
100227025
100227025
\ No newline at end of file
100227025
36468556
98444741
\ No newline at end of file
......@@ -62,6 +62,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpellSet, CardId.Waboku);
AddExecutor(ExecutorType.SpellSet, CardId.ThreateningRoar);
AddExecutor(ExecutorType.SpellSet, CardId.BlazingMirrorForce);
AddExecutor(ExecutorType.SpellSet, CardId.OjamaTrio, OjamaTrioset);
AddExecutor(ExecutorType.SpellSet, BrunSpellSet);
//afer set
AddExecutor(ExecutorType.Activate, CardId.CardcarD);
......@@ -69,8 +70,7 @@ namespace WindBot.Game.AI.Decks
//activate trap
AddExecutor(ExecutorType.Activate, CardId.BalanceOfJudgment, BalanceOfJudgmenteff);
AddExecutor(ExecutorType.Activate, CardId.AccuulatedFortune);
AddExecutor(ExecutorType.Activate, CardId.ChainStrike, ChainStrikeeff);
//battle
//battle
AddExecutor(ExecutorType.Activate, CardId.ThreateningRoar, ThreateningRoareff);
AddExecutor(ExecutorType.Activate, CardId.Waboku, Wabokueff);
......@@ -85,7 +85,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.SecretBlast, SecretBlasteff);
AddExecutor(ExecutorType.Activate, CardId.SectetBarrel, SectetBarreleff);
AddExecutor(ExecutorType.Activate, CardId.RecklessGreed, RecklessGreedeff);
AddExecutor(ExecutorType.Activate, CardId.ChainStrike, ChainStrikeeff);
//sp
AddExecutor(ExecutorType.SpSummon, CardId.Linkuriboh);
AddExecutor(ExecutorType.Activate, CardId.Linkuriboh, Linkuriboheff);
......@@ -129,15 +129,15 @@ namespace WindBot.Game.AI.Decks
CardId.Waboku,
CardId.ThreateningRoar,
CardId.MagicCylinder,
CardId.RingOfDestruction,
CardId.RingOfDestruction,
CardId.RecklessGreed,
CardId.SecretBlast,
CardId.JustDesserts,
CardId.OjamaTrio,
CardId.SectetBarrel,
CardId.Ceasefire,
CardId.BalanceOfJudgment,
CardId.AccuulatedFortune,
CardId.OjamaTrio,
CardId.SectetBarrel,
CardId.Ceasefire,
CardId.BalanceOfJudgment,
CardId.AccuulatedFortune,
};
}
public int[] AbouluteKingBackJack_List_2()
......@@ -148,7 +148,7 @@ namespace WindBot.Game.AI.Decks
CardId.Mathematician,
CardId.DiceJar,
CardId.CardcarD,
CardId.BattleFader,
CardId.BattleFader,
CardId.BlazingMirrorForce,
CardId.Waboku,
CardId.ThreateningRoar,
......@@ -168,7 +168,7 @@ namespace WindBot.Game.AI.Decks
{
return new[]
{
CardId.Waboku,
CardId.SecretBlast,
CardId.JustDesserts,
......@@ -177,14 +177,15 @@ namespace WindBot.Game.AI.Decks
CardId.Ceasefire,
CardId.RecklessGreed,
CardId.RingOfDestruction,
};
}
public int[] prevent_list()
public int[] pot_list()
{
return new[]
{
CardId.PotOfDesires,
CardId.SandaionTheTimloard,
CardId.BattleFader,
......@@ -205,10 +206,9 @@ namespace WindBot.Game.AI.Decks
}
return atk;
}
public bool Has_prevent_list(int id)
public bool Has_prevent_list_0(int id)
{
return (id == CardId.SandaionTheTimloard ||
id == CardId.BattleFader ||
return (
id == CardId.Waboku ||
id == CardId.ThreateningRoar||
id == CardId.MagicCylinder||
......@@ -216,13 +216,31 @@ namespace WindBot.Game.AI.Decks
id == CardId.RingOfDestruction
);
}
bool pot_used = false;
public bool Has_prevent_list_1(int id)
{
return (id == CardId.SandaionTheTimloard ||
id == CardId.BattleFader
);
}
bool no_sp = false;
bool one_turn_kill = false;
bool one_turn_kill_1 = false;
int expected_blood = 0;
bool prevent_used = false;
int preventcount = 0;
bool prevent_used = false;
int preventcount = 0;
bool battleprevent = false;
bool OjamaTrioused = false;
bool HasAccuulatedFortune = false;
bool OjamaTrioused = false;
bool OjamaTrioused_draw = false;
bool drawfirst = false;
int Waboku_count = 0;
int Roar_count = 0;
int strike_count = 0;
int greed_count = 0;
int blast_count = 0;
int barrel_count = 0;
int just_count = 0;
int Ojama_count = 0;
int HasAccuulatedFortune = 0;
public override bool OnSelectHand()
{
return true;
......@@ -230,25 +248,24 @@ namespace WindBot.Game.AI.Decks
public override void OnNewTurn()
{
pot_used = false;
prevent_used = false;
battleprevent = false;
OjamaTrioused = false;
no_sp = false;
prevent_used = false;
}
public override void OnNewPhase()
{
preventcount = 0;
battleprevent = false;
HasAccuulatedFortune = false;
OjamaTrioused = false;
IList<ClientCard> trap = Bot.SpellZone;
IList<ClientCard> monster = Bot.MonsterZone;
foreach(ClientCard card in trap)
{
if (card.Id == CardId.AccuulatedFortune) HasAccuulatedFortune = true;
}
foreach (ClientCard card in trap)
{
if (Has_prevent_list(card.Id))
if (Has_prevent_list_0(card.Id))
{
preventcount++;
battleprevent = true;
......@@ -257,16 +274,105 @@ namespace WindBot.Game.AI.Decks
}
foreach (ClientCard card in monster)
{
if (Has_prevent_list(card.Id))
if (Has_prevent_list_1(card.Id))
{
preventcount++;
battleprevent = true;
}
}
expected_blood = 0;
one_turn_kill = false;
one_turn_kill_1 = false;
OjamaTrioused_draw = 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.SpellZone;
foreach (ClientCard card in check)
{
if (card.Id == CardId.AccuulatedFortune)
HasAccuulatedFortune++;
}
foreach (ClientCard card in check)
{
if (card.Id == CardId.SecretBlast)
blast_count++;
}
foreach (ClientCard card in check)
{
if (card.Id == CardId.SectetBarrel)
barrel_count++;
}
foreach (ClientCard card in check)
{
if (card.Id == CardId.JustDesserts)
just_count++;
}
foreach (ClientCard card in check)
{
if (card.Id == CardId.ChainStrike)
strike_count++;
}
foreach (ClientCard card in Bot.GetSpells())
{
if (card.Id == CardId.RecklessGreed)
greed_count++;
}
foreach (ClientCard card in check)
{
if (card.Id == CardId.Waboku)
Waboku_count++;
}
foreach (ClientCard card in check)
{
if (card.Id == CardId.ThreateningRoar)
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);
if (Enemy.LifePoints <= expected_blood) one_turn_kill = true;
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;
if (strike_count >= 2) strike_count = 1;
int currentchain = 0;
if (OjamaTrioused_draw)
currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + Roar_count + greed_count + strike_count + Ojama_count;
else
currentchain = Duel.CurrentChain.Count + blast_count + just_count + barrel_count + Waboku_count + Waboku_count + greed_count + Roar_count + strike_count;
if (currentchain >= 3) drawfirst = true;
currentchain = Duel.CurrentChain.Count+ blast_count + just_count+barrel_count;
expected_blood = (Enemy.GetMonsterCount() * 500 * just_count + Enemy.GetFieldHandCount() * 200 * barrel_count + Enemy.GetFieldCount() * 300 * blast_count+(currentchain+1)*400);
if (Enemy.LifePoints <= expected_blood) one_turn_kill_1 = true;
}
private bool must_chain()
{
if (AI.Utils.IsChainTarget(Card)) return true;
......@@ -279,8 +385,14 @@ namespace WindBot.Game.AI.Decks
}
return false;
}
private bool OjamaTrioset()
{
if (Bot.HasInSpellZone(CardId.OjamaTrio)) return false;
return true;
}
private bool BrunSpellSet()
{
if (Card.Id == CardId.OjamaTrio && Bot.HasInSpellZone(CardId.OjamaTrio))return false;
return (Card.IsTrap() || Card.HasType(CardType.QuickPlay)) && Bot.GetSpellCountWithoutField() < 5;
}
private bool SandaionTheTimloard_summon()
......@@ -291,7 +403,7 @@ namespace WindBot.Game.AI.Decks
}
private bool AbouluteKingBackJacksummon()
{
return !pot_used;
return !no_sp;
}
private bool AbouluteKingBackJackeff()
{
......@@ -301,14 +413,15 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(AbouluteKingBackJack_List_1());
AI.SelectNextCard(AbouluteKingBackJack_List_2());
}
return true;
}
private bool PotOfDualityeff()
{
pot_used = true;
AI.SelectCard(prevent_list());
no_sp = true;
AI.SelectCard(pot_list());
return true;
}
private bool BlazingMirrorForceeff()
......@@ -319,25 +432,29 @@ namespace WindBot.Game.AI.Decks
{
list.Add(monster);
}
if (GetTotalATK(list) <= 3000) return false;
//if (GetTotalATK(list) / 2 >= Bot.LifePoints) return false;
if (GetTotalATK(list) < 3000) return false;
return Enemy.HasAttackingMonster() && DefaultUniqueTrap();
}
private bool ThreateningRoareff()
{
if (drawfirst) return true;
if (must_chain()) return true;
if (prevent_used||Duel.Phase==DuelPhase.End||Duel.Phase==DuelPhase.Main2) return false;
if (prevent_used || Duel.Phase != DuelPhase.BattleStart) return false;
prevent_used = true;
return DefaultUniqueTrap();
}
private bool SandaionTheTimloardeff()
{
prevent_used = true;
return true;
}
private bool Wabokueff()
{
if (drawfirst) return true;
if (must_chain()) return true;
if (drawfirst) return true;
if (prevent_used||Duel.Player == 0||Duel.Phase!=DuelPhase.BattleStart) return false;
prevent_used = true;
return DefaultUniqueTrap();
......@@ -374,12 +491,27 @@ namespace WindBot.Game.AI.Decks
}
private bool RecklessGreedeff()
{
int count=0;
foreach (ClientCard card in Bot.GetSpells())
{
if (card.Id == CardId.RecklessGreed)
count++;
}
bool Demiseused = AI.Utils.ChainContainsCard(CardId.CardOfDemise);
if (drawfirst) return DefaultUniqueTrap();
if (must_chain() && count > 1) return true;
if (Demiseused) return false;
if (count > 1) return true;
if (Bot.LifePoints <= 2000) return true;
if (Bot.GetHandCount() <1 && Duel.Player==0 && Duel.Phase!=DuelPhase.Standby) return true;
return false;
}
private bool SectetBarreleff()
{
if (drawfirst) return DefaultUniqueTrap();
if (one_turn_kill_1) return DefaultUniqueTrap();
if (one_turn_kill) return DefaultUniqueTrap();
if (must_chain()) return true;
int count = Enemy.GetFieldHandCount();
if (Enemy.LifePoints < count * 200) return true;
......@@ -388,19 +520,27 @@ namespace WindBot.Game.AI.Decks
}
private bool SecretBlasteff()
{
if (drawfirst) return DefaultUniqueTrap();
if (one_turn_kill_1) return DefaultUniqueTrap();
if (one_turn_kill) return DefaultUniqueTrap();
if (must_chain()) return true;
int count = Enemy.GetFieldCount();
if (Enemy.LifePoints < count * 300) return true;
if (count >= 5) return true;
return false;
}
private bool OjamaTrioeff()
{
return OjamaTrioused;
return OjamaTrioused||OjamaTrioused_draw;
}
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 (must_chain()) return true;
int count = Enemy.GetMonsterCount();
if (Enemy.LifePoints <= count * 500) return true;
......@@ -414,21 +554,16 @@ namespace WindBot.Game.AI.Decks
}
private bool ChainStrikeeff()
{
if (drawfirst) return true;
if (must_chain()) return true;
int chain = Duel.CurrentChain.Count;
if (strike_count >= 2 && chain >= 2) return true;
if (Enemy.LifePoints <= (chain + 1) * 400) return true;
if (Duel.CurrentChain.Count == 4) return true;
if (Duel.CurrentChain.Count >= 3) return true;
return false;
}
private bool Ceasefireeff()
{
if (must_chain()) return true;
int count = Bot.GetMonsterCount() + Enemy.GetMonsterCount();
if (Enemy.LifePoints <= count * 500) return true;
if (count >= 3) return true;
return false;
}
private bool BalanceOfJudgmenteff()
{
if (must_chain()) return true;
......@@ -439,7 +574,10 @@ namespace WindBot.Game.AI.Decks
private bool CardOfDemiseeff()
{
if (Bot.GetHandCount() == 1 && Bot.GetSpellCountWithoutField() <= 3)
{
no_sp = true;
return true;
}
return false;
}
private bool Mathematicianeff()
......@@ -450,30 +588,40 @@ namespace WindBot.Game.AI.Decks
return true;
}
return true;
}
private bool DiceJarfacedown()
{
IList<ClientCard> check = Bot.MonsterZone;
foreach (ClientCard card in check)
foreach (ClientCard card in Bot.GetMonsters())
{
if (card.Id == CardId.DiceJar && card.IsFacedown())
return true;
break;
}
return false;
}
private bool Ceasefire()
private bool Ceasefireeff()
{
if (Bot.GetMonsterCount() >= 3) return true;
if (Enemy.GetMonsterCount() >= 3) return true;
if (DiceJarfacedown()) return false;
if ((Bot.GetMonsterCount() + Enemy.GetMonsterCount()) >= 4) return true;
return false;
}
private bool Linkuriboheff()
{
ClientCard lastchaincard = AI.Utils.GetLastChainCard();
if (lastchaincard == null) return true;
if (lastchaincard.Id == CardId.Linkuriboh) return false;
return true;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (attacker.Id == CardId.Linkuriboh && defender.IsFacedown()) return false;
return base.OnPreBattleBetween(attacker,defender);
}
/*private bool SwordsOfRevealingLight()
{
int count = Bot.SpellZone.GetCardCount(CardId.SwordsOfRevealingLight);
......
......@@ -41,7 +41,7 @@ namespace WindBot.Game.AI.Decks
public const int HarpiesFeatherDuster = 18144506;
public const int DoubleEvolutionPill = 38179121;
public const int ShaddollFusion = 44394295;
public const int PotOfAvarice = 67169026;
public const int PotOfAvarice = 67169062;
public const int FoolishBurial = 81439173;
public const int MonsterReborn = 83764718;
public const int ChargeOfTheLightBrigade = 94886282;
......@@ -71,15 +71,13 @@ namespace WindBot.Game.AI.Decks
public const int CrystronNeedlefiber = 50588353;
}
bool Pillused = false;
bool CrystalWingSynchroDragoneff_used = false;
bool OvertexCoatlseff_used = false;
public LightswornShaddoldinosour(GameAI ai, Duel duel)
: base(ai, duel)
{
//counter
AddExecutor(ExecutorType.SpSummon, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragonesp);
AddExecutor(ExecutorType.Activate, CardId.GhostOgre, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.AshBlossom, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.MaxxC,MaxxC);
......@@ -90,8 +88,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.SouleatingOviraptor);
AddExecutor(ExecutorType.Activate, CardId.SouleatingOviraptor, SouleatingOviraptoreff);
AddExecutor(ExecutorType.Activate, CardId.AllureofDarkness, DefaultAllureofDarkness);
AddExecutor(ExecutorType.Activate, CardId.PotOfAvarice, PotofAvarice);
// AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.PotOfAvarice, PotofAvariceeff);
AddExecutor(ExecutorType.Activate, CardId.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.Activate, CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
......@@ -101,29 +98,35 @@ namespace WindBot.Game.AI.Decks
//Normal Summon
AddExecutor(ExecutorType.Summon, CardId.Raiden);
AddExecutor(ExecutorType.Activate, CardId.Raiden);
AddExecutor(ExecutorType.Summon , CardId.KeeperOfDragonicMagic);
AddExecutor(ExecutorType.Activate, CardId.KeeperOfDragonicMagic, KeeperOfDragonicMagiceff);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollSquamata);
AddExecutor(ExecutorType.MonsterSet, CardId.GlowUpBulb);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollHedgehog);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollDragon);
AddExecutor(ExecutorType.Summon, CardId.FairyTailSnow,FairyTailSnow);
AddExecutor(ExecutorType.Activate, CardId.FairyTailSnow, FairyTailSnow);
AddExecutor(ExecutorType.Summon, CardId.FairyTailSnow,FairyTailSnowsummon);
AddExecutor(ExecutorType.Activate, CardId.FairyTailSnow, FairyTailSnoweff);
AddExecutor(ExecutorType.Summon, CardId.Lumina);
AddExecutor(ExecutorType.Activate, CardId.Lumina);
//activate
AddExecutor(ExecutorType.Activate, CardId.GlowUpBulb, GlowUpBulbeff);
AddExecutor(ExecutorType.Activate, CardId.CrystronNeedlefiber, CrystronNeedlefibereff);
AddExecutor(ExecutorType.Activate, CardId.TG_WonderMagician);
AddExecutor(ExecutorType.Activate, CardId.CoralDragon, CoralDragoneff);
AddExecutor(ExecutorType.Activate, CardId.RedWyvern, RedWyverneff);
AddExecutor(ExecutorType.Activate, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragoneff);
AddExecutor(ExecutorType.Activate, CardId.BlackRoseMoonlightDragon, BlackRoseMoonlightDragoneff);
AddExecutor(ExecutorType.Activate, CardId.Sdulldeat, Sdulldeateff);
AddExecutor(ExecutorType.Activate, CardId.Michael, Michaeleff);
AddExecutor(ExecutorType.Activate, CardId.ScarlightRedDragon, ScarlightRedDragoneff);
//Sp Summon
//AddExecutor(ExecutorType.SpSummon, CardId.CrystronNeedlefiber, CrystronNeedlefibersp);
AddExecutor(ExecutorType.SpSummon, CardId.UltimateConductorTytanno, UltimateConductorTytannosp);
AddExecutor(ExecutorType.Activate, CardId.UltimateConductorTytanno, UltimateConductorTytannoeff);
AddExecutor(ExecutorType.Activate, CardId.DoubleEvolutionPill, DoubleEvolutionPilleff);
AddExecutor(ExecutorType.SpSummon, CardId.MinervaTheExalte);
AddExecutor(ExecutorType.Activate, CardId.MinervaTheExalte, MinervaTheExaltedEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
//activate
AddExecutor(ExecutorType.Activate , CardId.GlowUpBulb,GlowUpBulbeff);
AddExecutor(ExecutorType.SpSummon, CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
//activate chain
AddExecutor(ExecutorType.Activate, CardId.OvertexCoatls, OvertexCoatlseff);
......@@ -133,24 +136,22 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.ShaddollDragon, ShaddollDragoneff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollHedgehog, ShaddollHedgehogeff);
AddExecutor(ExecutorType.Activate, CardId.GiantRex);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollConstruct);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollGrysra);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollConstruct, ElShaddollConstructeff);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollGrysra, ElShaddollGrysraeff);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollShekhinaga, ElShaddollShekhinagaeff);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollWinda);
AddExecutor(ExecutorType.Activate, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragoneff);
AddExecutor(ExecutorType.Activate, CardId.TG_WonderMagician);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollWinda);
//spellset
AddExecutor(ExecutorType.SpellSet, CardId.MonsterReborn, spellset);
AddExecutor(ExecutorType.SpellSet, CardId.PotOfAvarice, spellset);
AddExecutor(ExecutorType.SpellSet, CardId.ThatGrassLooksgreener, spellset);
//trap
//trapset
AddExecutor(ExecutorType.SpellSet, CardId.LostWind, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.SinisterShadowGames, TrapSetWhenZoneFree);
AddExecutor(ExecutorType.SpellSet, CardId.ShaddollCore);
AddExecutor(ExecutorType.SpellSet, CardId.infiniteTransience, SetIsFieldEmpty);
//trap activate
AddExecutor(ExecutorType.Activate, CardId.LostWind, DefaultBreakthroughSkill);
AddExecutor(ExecutorType.Activate, CardId.SinisterShadowGames, SinisterShadowGames);
AddExecutor(ExecutorType.Activate, CardId.LostWind, LostWindeff);
AddExecutor(ExecutorType.Activate, CardId.SinisterShadowGames, SinisterShadowGameseff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollCore, ShaddollCoreeff);
AddExecutor(ExecutorType.Repos, MonsterRepos);
}
......@@ -218,86 +219,19 @@ namespace WindBot.Game.AI.Decks
};
}
public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
for (int i = 0; i < defenders.Count; ++i)
{
ClientCard defender = defenders[i];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.RealPower > defender.RealPower ||
(attacker.RealPower >= defender.RealPower && attacker.IsLastAttacker)||
attacker.Id==CardId.UltimateConductorTytanno
)
return AI.Attack(attacker, defender);
}
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
int Ultimate_ss = 0;
bool Pillused = false;
bool CrystronNeedlefibereff_used = false;
bool OvertexCoatlseff_used = false;
return null;
}
public override bool OnSelectHand()
{
return true;
}
public override void OnNewTurn()
{
Pillused = false;
OvertexCoatlseff_used = false;
CrystalWingSynchroDragoneff_used = false;
}
public bool CrystalWingSynchroDragonesp()
{
if (CrystalWingSynchroDragoneff_used) return false;
if (Bot.HasInMonstersZone(CardId.FairyTailSnow) ||
Bot.HasInMonstersZone(CardId.Lumina) ||
Bot.HasInMonstersZone(CardId.KeeperOfDragonicMagic)||
Bot.HasInMonstersZone(CardId.SouleatingOviraptor)
)
{
AI.SelectCard(new[]
{
CardId.KeeperOfDragonicMagic,
CardId.Lumina,
CardId.FairyTailSnow,
CardId.SouleatingOviraptor,
});
AI.SelectNextCard(CardId.GlowUpBulb);
}
return true;
}
public bool CrystalWingSynchroDragoneff()
{
if (Duel.Player == 0)
{
CrystalWingSynchroDragoneff_used = true;
AI.SelectCard(new[] { CardId.GhostOgre, CardId.GlowUpBulb, CardId.PlaguespreaderZombie, CardId.ShaddollFalco });
return true;
}
else if (AI.Utils.IsChainTarget(Card) || AI.Utils.GetProblematicEnemySpell() != null) return true;
else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && AI.Utils.IsOneEnemyBetterThanValue(1500, true))
{
if (AI.Utils.IsOneEnemyBetterThanValue(1900, true))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
}
else
{
AI.SelectPosition(CardPosition.FaceUpAttack);
}
return true;
}
return false;
CrystronNeedlefibereff_used = false;
}
private bool UltimateConductorTytannoeff()
{
......@@ -310,6 +244,7 @@ namespace WindBot.Game.AI.Decks
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
CardId.GlowUpBulb,
CardId.PlaguespreaderZombie,
CardId.FairyTailSnow,
......@@ -319,8 +254,7 @@ namespace WindBot.Game.AI.Decks
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.GiantRex,
CardId.ShaddollSquamata,
CardId.GiantRex,
CardId.SouleatingOviraptor,
CardId.Raiden,
CardId.Lumina,
......@@ -328,22 +262,25 @@ namespace WindBot.Game.AI.Decks
CardId.GhostOgre,
CardId.MaxxC,
};
if (!Bot.HasInHand(targets))
{
if (!Bot.HasInMonstersZone(targets))
{
return false;
}
if (!Bot.HasInHand(targets) || !Bot.HasInMonstersZone(targets))
{
return false;
}
AI.SelectCard(targets);
return true;
}
if (Duel.Phase == DuelPhase.Damage)
if (Duel.Phase == DuelPhase.BattleStart)
{
AI.SelectYesNo(true);
return true;
return true;
}
return false;
}
private bool UltimateConductorTytannosp()
{
Ultimate_ss++;
Pillused = true;
foreach (ClientCard card in Bot.GetMonsters())
{
......@@ -375,13 +312,18 @@ namespace WindBot.Game.AI.Decks
private bool OvertexCoatlseff()
{
if (OvertexCoatlseff_used == true)
return false;
if (Card.Location == CardLocation.MonsterZone) return false;
OvertexCoatlseff_used = true;
return true;
}
private bool DoubleEvolutionPilleff()
{
{
foreach (ClientCard card in Bot.GetMonsters())
{
if (card.Id == CardId.UltimateConductorTytanno && card.IsFaceup())
return false;
}
if (Pillused == true) return false;
Pillused = true;
IList<int> targets = new[] {
......@@ -473,22 +415,16 @@ namespace WindBot.Game.AI.Decks
return Enemy.GetMonsterCount() >= 1;
}
private bool ShaddollCoreeff()
private bool FairyTailSnowsummon()
{
if (Card.Location == CardLocation.SpellZone)
{
if(Enemy.HasAttackingMonster())
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
return true;
return Enemy.GetMonsterCount()>=2;
}
private bool FairyTailSnow()
private bool FairyTailSnoweff()
{
if (Card.Location == CardLocation.MonsterZone)
......@@ -498,6 +434,7 @@ namespace WindBot.Game.AI.Decks
return false;
}
private bool SouleatingOviraptoreff()
{
if (!OvertexCoatlseff_used)
......@@ -515,58 +452,25 @@ namespace WindBot.Game.AI.Decks
private bool GlowUpBulbeff()
{
/*if(Bot.HasInMonstersZone(CardId.Lumina)||
Bot.HasInMonstersZone(CardId.FairyTailSnow)||
Bot.HasInMonstersZone(CardId.KeeperOfDragonicMagic)||
Bot.HasInMonstersZone(CardId.SouleatingOviraptor)
)*/
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
private bool ShaddollFusioneff()
{
if(Enemy.GetMonstersExtraZoneCount()>0)
if (Bot.HasInMonstersZone(CardId.Lumina) ||
Bot.HasInMonstersZone(CardId.FairyTailSnow) ||
Bot.HasInMonstersZone(CardId.KeeperOfDragonicMagic) ||
Bot.HasInMonstersZone(CardId.SouleatingOviraptor) ||
Bot.HasInMonstersZone(CardId.GiantRex) ||
Bot.HasInMonstersZone(CardId.Raiden)
)
{
AI.SelectCard(new[]
{
CardId.ElShaddollConstruct,
CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda
});
AI.SelectNextCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
AI.SelectPosition(CardPosition.FaceUpAttack);
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
else
{
if (!Bot.IsFieldEmpty())
return false;
AI.SelectCard(CardId.ElShaddollConstruct);
AI.SelectPosition(CardPosition.FaceUpAttack);
}
return true;
}
private bool ShaddollCore()
{
return Bot.HasInGraveyard(CardId.ShaddollFusion);
}
return false;
}
private bool AllureofDarkness()
{
IList<ClientCard> materials = Bot.Hand;
IList<ClientCard> check = new List<ClientCard>();
// IList<ClientCard> check = new List<ClientCard>();
ClientCard mat = null;
foreach (ClientCard card in materials)
{
......@@ -582,15 +486,22 @@ namespace WindBot.Game.AI.Decks
}
return false;
}
private bool spellset()
{
return Bot.Hand.Count > 6;
}
private bool RebornEffect()
{
IList<int> targets = new[] {
CardId.UltimateConductorTytanno,
if(Bot.HasInGraveyard(CardId.UltimateConductorTytanno)&&Ultimate_ss>0)
{
AI.SelectCard(CardId.UltimateConductorTytanno);
return true;
}
IList<int> targets = new[] {
CardId.ElShaddollConstruct,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
......@@ -603,9 +514,10 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(targets);
return true;
}
private bool PotofAvarice()
{
private bool PotofAvariceeff()
{
return true;
}
......@@ -613,10 +525,14 @@ namespace WindBot.Game.AI.Decks
{
return Duel.Player == 1;
}
private bool SetIsFieldEmpty()
{
return !Bot.IsFieldEmpty();
}
private bool TrapSetWhenZoneFree()
{
return Bot.GetSpellCountWithoutField() < 4;
......@@ -634,19 +550,22 @@ namespace WindBot.Game.AI.Decks
});
return true;
}
private bool SinisterShadowGames()
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
});
// all Shaddoll
private bool ElShaddollConstructeff()
{
/* if (Duel.Phase == DuelPhase.Battle)
if (Enemy.BattlingMonster.Attack < 2800)
return false;*/
if(ActivateDescription==-1)
{
AI.SelectCard(CardId.ShaddollSquamata);
}
return true;
}
private bool ElShaddollShekhinagaeff()
{
if (Card.Location != CardLocation.MonsterZone)
......@@ -657,11 +576,11 @@ namespace WindBot.Game.AI.Decks
{
AI.SelectCard(new[]
{
CardId.ElShaddollConstruct,
CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda,
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
}
);
}
......@@ -671,6 +590,102 @@ namespace WindBot.Game.AI.Decks
return true;
}
private bool ElShaddollGrysraeff()
{
if (Card.Location != CardLocation.MonsterZone)
return true;
return true;
}
private bool ShaddollFusioneff()
{
bool deck_check = false;
List<ClientCard> monsters = Enemy.GetMonsters();
foreach (ClientCard monster in monsters)
{
if (monster.HasType(CardType.Synchro) || monster.HasType(CardType.Fusion) || monster.HasType(CardType.Xyz))
deck_check = true;
}
if (deck_check)
{
AI.SelectCard(new[]
{
CardId.ElShaddollConstruct,
CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda
});
AI.SelectNextCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
if (!Bot.IsFieldEmpty()) return false;
foreach (ClientCard monster in Bot.Hand)
{
if (monster.HasAttribute(CardAttribute.Light))
{
AI.SelectCard(CardId.ElShaddollConstruct);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
}
List<ClientCard> material_1 = Bot.GetMonsters();
foreach (ClientCard monster in material_1)
{
if (monster.HasAttribute(CardAttribute.Light))
{
AI.SelectCard(CardId.ElShaddollConstruct);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
}
return false;
}
private bool SinisterShadowGameseff()
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
});
return true;
}
private bool ShaddollCoreeff()
{
if (Card.Location == CardLocation.SpellZone)
{
if (Enemy.HasAttackingMonster() && Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart)
{
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
return false;
}
return true;
}
private bool ShaddollFalcoeff()
{
if (Card.Location != CardLocation.MonsterZone)
......@@ -690,6 +705,8 @@ namespace WindBot.Game.AI.Decks
}
return true;
}
private bool ShaddollHedgehogeff()
{
if (Card.Location != CardLocation.MonsterZone)
......@@ -705,6 +722,8 @@ namespace WindBot.Game.AI.Decks
}
return true;
}
private bool ShaddollDragoneff()
{
if (Card.Location == CardLocation.MonsterZone)
......@@ -720,6 +739,8 @@ namespace WindBot.Game.AI.Decks
return true;
}
}
private bool ShaddollSquamataeff()
{
if (Card.Location != CardLocation.MonsterZone)
......@@ -739,6 +760,17 @@ namespace WindBot.Game.AI.Decks
}
return true;
}
private bool LostWindeff()
{
List<ClientCard> check = Enemy.GetMonsters();
foreach (ClientCard m in check)
{
if (m.Attack>=2000) return DefaultBreakthroughSkill();
}
return false;
}
private bool FoolishBurialEffect()
{
if (Bot.GetRemainingCount(CardId.DoubleEvolutionPill, 3) > 0)
......@@ -749,34 +781,21 @@ namespace WindBot.Game.AI.Decks
{
CardId.OvertexCoatls,
});
return true;
}
else return false;
return false;
}
else
{
AI.SelectCard(new[]
{
CardId.OvertexCoatls,
{
CardId.ShaddollSquamata,
CardId.FairyTailSnow,
});
}
return true;
}
private bool GoblindberghSummon()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Level == 4)
return true;
}
return false;
}
}
public bool Hand_act_eff()
{
......@@ -784,6 +803,16 @@ namespace WindBot.Game.AI.Decks
if (Card.Id == CardId.GhostOgre && Card.Location == CardLocation.Hand && Bot.HasInMonstersZone(CardId.GhostOgre)) return false;
return (Duel.LastChainPlayer == 1);
}
//other extra
private bool Michaeleff()
{
if (Card.Location == CardLocation.Grave)
return true;
if (Bot.LifePoints <= 1000) return false;
return true;
}
private bool MinervaTheExaltedEffect()
{
if (Card.Location == CardLocation.MonsterZone)
......@@ -822,7 +851,198 @@ namespace WindBot.Game.AI.Decks
return true;
}
}
public bool CrystronNeedlefibersp()
{
if (Bot.HasInMonstersZone(CardId.ElShaddollConstruct) ||
Bot.HasInMonstersZone(CardId.ElShaddollGrysra) ||
Bot.HasInMonstersZone(CardId.ElShaddollShekhinaga) ||
Bot.HasInMonstersZone(CardId.ElShaddollWinda))
return false;
if (CrystronNeedlefibereff_used) return false;
if (Bot.HasInMonstersZone(CardId.CrystronNeedlefiber)) return false;
if (Bot.HasInMonstersZone(CardId.FairyTailSnow) ||
Bot.HasInMonstersZone(CardId.Lumina) ||
Bot.HasInMonstersZone(CardId.KeeperOfDragonicMagic) ||
Bot.HasInMonstersZone(CardId.SouleatingOviraptor) ||
Bot.HasInMonstersZone(CardId.Raiden)
)
{
AI.SelectCard(new[]
{
CardId.KeeperOfDragonicMagic,
CardId.Lumina,
CardId.FairyTailSnow,
CardId.SouleatingOviraptor,
CardId.Raiden,
CardId.GiantRex,
});
AI.SelectNextCard(CardId.GlowUpBulb);
}
return true;
}
public bool CrystronNeedlefibereff()
{
if (Duel.Player == 0)
{
CrystronNeedlefibereff_used = true;
AI.SelectCard(new[] { CardId.GhostOgre, CardId.GlowUpBulb, CardId.PlaguespreaderZombie, CardId.ShaddollFalco });
return true;
}
else if (AI.Utils.IsChainTarget(Card) || AI.Utils.GetProblematicEnemySpell() != null) return true;
else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && AI.Utils.IsOneEnemyBetterThanValue(1500, true))
{
if (AI.Utils.IsOneEnemyBetterThanValue(1900, true))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
}
else
{
AI.SelectPosition(CardPosition.FaceUpAttack);
}
return true;
}
return false;
}
private bool ScarlightRedDragoneff()
{
IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster();
if (target1 != null)
{
targets.Add(target1);
AI.SelectCard(targets);
return true;
}
return false;
}
private bool CrystalWingSynchroDragoneff()
{
return Duel.LastChainPlayer != 0;
}
private bool Sdulldeateff()
{
/* if (snake_four_s)
{
snake_four_s = false;
AI.SelectCard(Useless_List());
return true;
}
//if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 2)) return true;
if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 1))
{
foreach (ClientCard hand in Bot.Hand)
{
if (hand.Id == CardId.Red || hand.Id == CardId.Pink)
{
AI.SelectCard(hand);
return true;
}
if (hand.Id == CardId.Urara || hand.Id == CardId.Ghost)
{
if (Tuner_ss())
{
AI.SelectCard(hand);
return true;
}
}
}
}*/
return false;
}
private bool BlackRoseMoonlightDragoneff()
{
IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster();
if (target1 != null)
{
targets.Add(target1);
AI.SelectCard(targets);
return true;
}
return false;
}
private bool RedWyverneff()
{
IList<ClientCard> check = Enemy.MonsterZone;
ClientCard best = null;
foreach (ClientCard monster in check)
{
if (monster.Attack >= 2400) best = monster;
}
if (best != null)
{
AI.SelectCard(best);
return true;
}
return false;
}
private bool CoralDragoneff()
{
if (Card.Location != CardLocation.MonsterZone)
return true;
IList<ClientCard> targets = new List<ClientCard>();
ClientCard target1 = AI.Utils.GetBestEnemyMonster();
if (target1 != null)
targets.Add(target1);
ClientCard target2 = AI.Utils.GetBestEnemySpell();
if (target2 != null)
targets.Add(target2);
else if (AI.Utils.IsChainTarget(Card) || AI.Utils.GetProblematicEnemySpell() != null)
{
AI.SelectCard(targets);
return true;
}
else if (Duel.Player == 1 && Duel.Phase == DuelPhase.BattleStart && AI.Utils.IsOneEnemyBetterThanValue(2400, true))
{
AI.SelectCard(targets);
return true;
}
return false;
}
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (!defender.IsMonsterHasPreventActivationEffectInBattle())
{
if (attacker.Id == CardId.ElShaddollConstruct && !attacker.IsDisabled()) // TODO: && defender.IsSpecialSummoned
attacker.RealPower = 9999;
if (attacker.Id == CardId.UltimateConductorTytanno && !attacker.IsDisabled() && defender.IsDefense())
attacker.RealPower = 9999;
}
return base.OnPreBattleBetween(attacker, defender);
}
public override bool OnSelectHand()
{
return true;
}
/*
private bool GoblindberghSummon()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
{
if (!card.Equals(Card) && card.Level == 4)
return true;
}
return false;
}*/
}
}
\ No newline at end of file
......@@ -43,10 +43,10 @@ namespace WindBot.Game.AI.Decks
public const int Linkspi = 98978921;
public const int SafeDra = 99111753;
public const int Crystal = 50588353;
public const int phoneix = 2857636;
public const int unicorn = 38342335;
public const int snake = 74997493;
public const int borrel = 31833038;
public const int Phoneix = 2857636;
public const int Unicorn = 38342335;
public const int Snake = 74997493;
public const int Borrel = 31833038;
public const int TG = 98558751;
public const int Beelze = 34408491;
......@@ -60,10 +60,10 @@ namespace WindBot.Game.AI.Decks
public int getLinkMarker(int id)
{
if (id == CardId.borrel || id == CardId.snake) return 4;
else if (id == CardId.Abyss || id == CardId.Beelze || id == CardId.Exterio || id == CardId.Ultimate) return 5;
else if (id == CardId.unicorn) return 3;
else if (id == CardId.Crystal || id == CardId.phoneix || id == CardId.SafeDra || id == CardId.Missus) return 2;
if (id == CardId.Borrel || id == CardId.Snake) return 4;
else if (id == CardId.Abyss || id == CardId.Beelze || id == CardId.Exterio || id == CardId.Ultimate || id == CardId.Cardian) return 5;
else if (id == CardId.Unicorn) return 3;
else if (id == CardId.Crystal || id == CardId.Phoneix || id == CardId.SafeDra || id == CardId.Missus) return 2;
return 1;
}
......@@ -108,26 +108,26 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Tuner,Tuner_eff);
// ex ss
AddExecutor(ExecutorType.SpSummon, CardId.borrel, Borrel_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Borrel, Borrel_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Missus, Missus_ss);
AddExecutor(ExecutorType.SpSummon, CardId.phoneix, Phoneix_ss);
AddExecutor(ExecutorType.SpSummon, CardId.snake, Snake_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Phoneix, Phoneix_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Snake, Snake_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Crystal, Crystal_ss);
AddExecutor(ExecutorType.SpSummon, CardId.SafeDra, Safedragon_ss);
AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.Linkuri, Linkuri_eff);
AddExecutor(ExecutorType.SpSummon, CardId.Linkuri, Linkuri_ss);
AddExecutor(ExecutorType.SpSummon, CardId.unicorn, Unicorn_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Unicorn, Unicorn_ss);
AddExecutor(ExecutorType.SpSummon, CardId.Linkspi);
// ex_monster act
AddExecutor(ExecutorType.Activate, CardId.Beelze);
AddExecutor(ExecutorType.Activate, CardId.Missus, Missus_eff);
AddExecutor(ExecutorType.Activate, CardId.Crystal, Crystal_eff);
AddExecutor(ExecutorType.Activate, CardId.SafeDra, DefaultCompulsoryEvacuationDevice);
AddExecutor(ExecutorType.Activate, CardId.phoneix, Phoneix_eff);
AddExecutor(ExecutorType.Activate, CardId.unicorn, Unicorn_eff);
AddExecutor(ExecutorType.Activate, CardId.snake, Snake_eff);
AddExecutor(ExecutorType.Activate, CardId.borrel, Borrel_eff);
AddExecutor(ExecutorType.Activate, CardId.Phoneix, Phoneix_eff);
AddExecutor(ExecutorType.Activate, CardId.Unicorn, Unicorn_eff);
AddExecutor(ExecutorType.Activate, CardId.Snake, Snake_eff);
AddExecutor(ExecutorType.Activate, CardId.Borrel, Borrel_eff);
// normal act
AddExecutor(ExecutorType.Activate, CardId.Trans);
......@@ -157,12 +157,18 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, MonsterRepos);
AddExecutor(ExecutorType.SummonOrSet, CardId.Red);
AddExecutor(ExecutorType.SummonOrSet, CardId.Pink);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
AddExecutor(ExecutorType.SpellSet, SpellSet);
}
public bool SpellSet()
{
if (Card.Id == CardId.Sheep && Bot.HasInSpellZone(CardId.Sheep)) return false;
return DefaultSpellSet();
}
public bool Has_down_arrow(int id)
{
return (id == CardId.Linkuri || id == CardId.Linkspi || id == CardId.unicorn);
return (id == CardId.Linkuri || id == CardId.Linkspi || id == CardId.Unicorn);
}
public bool IsTrickstar(int id)
......@@ -212,18 +218,71 @@ namespace WindBot.Game.AI.Decks
public bool Grass_ss()
{
if (Bot.ExtraDeck.Count > 0)
// judge whether can ss from exdeck
bool judge = (Bot.ExtraDeck.Count > 0);
if (Enemy.GetMonstersExtraZoneCount() > 1) judge = false; // exlink
if (Bot.GetMonstersExtraZoneCount() >= 1)
{
foreach (ClientCard card in Bot.GetMonstersInExtraZone())
{
if (getLinkMarker(card.Id) == 5) judge = false;
}
}
// can ss from exdeck
if (judge)
{
bool fornextss = AI.Utils.ChainContainsCard(CardId.Grass);
IList<ClientCard> ex = Bot.ExtraDeck;
ClientCard ex_best = null;
foreach (ClientCard ex_card in ex)
{
if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card;
if (!fornextss)
{
if (ex_best == null || ex_card.Attack > ex_best.Attack) ex_best = ex_card;
}
else
{
if (getLinkMarker(ex_card.Id) != 5 && (ex_best == null || ex_card.Attack > ex_best.Attack)) ex_best = ex_card;
}
}
if (ex_best != null) {
if (ex_best != null)
{
AI.SelectCard(ex_best);
}
return true;
}
if (!judge || AI.Utils.ChainContainsCard(CardId.Grass))
{
// cannot ss from exdeck or have more than 1 grass in chain
int[] secondselect = new[]
{
CardId.Borrel,
CardId.Ultimate,
CardId.Abyss,
CardId.Cardian,
CardId.Exterio,
CardId.Ghost,
CardId.White,
CardId.Red,
CardId.Yellow,
CardId.Pink
};
if (!AI.Utils.ChainContainsCard(CardId.Grass))
{
if (!judge && Bot.GetRemainingCount(CardId.Ghost, 2) > 0)
{
AI.SelectCard(CardId.Ghost);
AI.SelectPosition(CardPosition.FaceUpDefence);
}
else
AI.SelectCard(secondselect);
}
else
{
if (!judge)
AI.SelectCard(secondselect);
AI.SelectNextCard(secondselect);
AI.SelectThirdCard(secondselect);
}
}
return true;
}
......@@ -264,10 +323,23 @@ namespace WindBot.Game.AI.Decks
return false;
}
public void RandomSort(List<ClientCard> list) {
int n = list.Count;
while(n-- > 1)
{
int index = Program.Rand.Next(n + 1);
ClientCard temp = list[index];
list[index] = list[n];
list[n] = temp;
}
}
public bool Stage_Lock()
{
if (Card.Location != CardLocation.SpellZone) return false;
List<ClientCard> spells = Enemy.GetSpells();
RandomSort(spells);
if (spells.Count == 0) return false;
foreach (ClientCard card in spells)
{
......@@ -545,6 +617,7 @@ namespace WindBot.Game.AI.Decks
public bool Eater_ss()
{
if (AI.Utils.GetProblematicEnemyMonster() == null && Bot.ExtraDeck.Count < 5) return false;
if (Bot.GetMonstersInMainZone().Count >= 5) return false;
if (AI.Utils.IsTurn1OrMain2()) return false;
AI.SelectPosition(CardPosition.FaceUpAttack);
IList<ClientCard> targets = new List<ClientCard>();
......@@ -584,6 +657,29 @@ namespace WindBot.Game.AI.Decks
return true;
}
public void Red_SelectPos(ClientCard return_card = null)
{
int self_power = (Bot.HasInHand(CardId.White) && !white_eff_used) ? 3200 : 1600;
if (Duel.Player == 0)
{
List<ClientCard> monster_list = Bot.GetMonsters();
monster_list.Sort(AIFunctions.CompareCardAttack);
monster_list.Reverse();
foreach(ClientCard card in monster_list)
{
if (IsTrickstar(card.Id) && card != return_card && card.HasPosition(CardPosition.Attack))
{
int this_power = (Bot.HasInHand(CardId.White) && !white_eff_used) ? (card.RealPower + card.Attack) : card.RealPower;
if (this_power >= self_power) self_power = this_power;
} else if (card.RealPower >= self_power) self_power = card.RealPower;
}
}
ClientCard bestenemy = AI.Utils.GetOneEnemyBetterThanValue(self_power, true);
if (bestenemy != null) AI.SelectPosition(CardPosition.FaceUpDefence);
else AI.SelectPosition(CardPosition.FaceUpAttack);
return;
}
public bool Red_ss()
{
if (red_ss_count >= 6) return false;
......@@ -596,6 +692,7 @@ namespace WindBot.Game.AI.Decks
{
red_ss_count += 1;
AI.SelectCard(m);
Red_SelectPos();
return true;
}
}
......@@ -615,6 +712,7 @@ namespace WindBot.Game.AI.Decks
if (c.Attacked)
{
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
......@@ -625,12 +723,14 @@ namespace WindBot.Game.AI.Decks
{
if (tosolve_enemy.Attack > 3200) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
if (!Bot.HasInHand(CardId.White) && tosolve_enemy.Attack <= 3200 && c.Id == CardId.White)
{
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
......@@ -647,6 +747,7 @@ namespace WindBot.Game.AI.Decks
}
if (tosolve_enemy.Attack > 1600) AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(c);
Red_SelectPos(c);
red_ss_count += 1;
return true;
}
......@@ -658,18 +759,20 @@ namespace WindBot.Game.AI.Decks
{
if (Duel.Phase > DuelPhase.Main1 && Duel.Phase < DuelPhase.Main2)
{
if (!Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(1600, true))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
}
else if (Bot.HasInHand(CardId.White) && AI.Utils.IsOneEnemyBetterThanValue(3200, true))
{
AI.SelectPosition(CardPosition.FaceUpDefence);
}
if (AI.Utils.GetOneEnemyBetterThanMyBest() != null)
{
red_ss_count += 1;
return true;
List<ClientCard> self_monster = Bot.GetMonsters();
self_monster.Sort(AIFunctions.CompareDefensePower);
foreach(ClientCard card in self_monster)
{
if (IsTrickstar(card.Id) && card.Id != CardId.Red)
{
AI.SelectCard(card);
Red_SelectPos(card);
red_ss_count += 1;
return true;
}
}
}
}
}
......@@ -1408,8 +1511,8 @@ namespace WindBot.Game.AI.Decks
AI.SelectCard(Useless_List());
return true;
}
//if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 2)) return true;
if (ActivateDescription == AI.Utils.GetStringId(CardId.snake, 1))
//if (ActivateDescription == AI.Utils.GetStringId(CardId.Snake, 2)) return true;
if (ActivateDescription == AI.Utils.GetStringId(CardId.Snake, 1))
{
foreach(ClientCard hand in Bot.Hand)
{
......@@ -1444,7 +1547,7 @@ namespace WindBot.Game.AI.Decks
{
AI.SelectMaterials(material_list);
return true;
} else if (AI.Utils.GetProblematicEnemyMonster(2000) != null && Bot.HasInExtra(CardId.borrel) && !Bot.HasInMonstersZone(CardId.Missus))
} else if (AI.Utils.GetProblematicEnemyMonster(2000) != null && Bot.HasInExtra(CardId.Borrel) && !Bot.HasInMonstersZone(CardId.Missus))
{
AI.SelectMaterials(material_list);
return true;
......@@ -1458,7 +1561,7 @@ namespace WindBot.Game.AI.Decks
{
CardId.MG,
CardId.Missus,
CardId.snake
CardId.Snake
});
return true;
}
......@@ -1518,7 +1621,7 @@ namespace WindBot.Game.AI.Decks
{
return (Card.Attack - enemy_monster.Attack < Enemy.LifePoints);
}
else return false;
return true;
};
ClientCard BestEnemy = AI.Utils.GetBestEnemyMonster(true);
ClientCard WorstBot = Bot.GetMonsters().GetLowestAttackMonster();
......@@ -1568,15 +1671,30 @@ namespace WindBot.Game.AI.Decks
return false;
}
public bool IsAllEnemyBetter()
{
int bestPower = -1;
for (int i = 0; i < 7; ++i)
{
ClientCard card = Bot.MonsterZone[i];
if (card == null || card.Data == null) continue;
int newPower = card.Attack;
if (IsTrickstar(card.Id) && Bot.HasInHand(CardId.White) && !white_eff_used) newPower += card.RealPower;
if (newPower > bestPower)
bestPower = newPower;
}
return AI.Utils.IsAllEnemyBetterThanValue(bestPower,true);
}
public bool MonsterRepos()
{
if (Card.Id == CardId.Eater && Card.IsAttack()) return false;
if (Card.Id == CardId.Eater) return (!Card.HasPosition(CardPosition.Attack));
if (IsTrickstar(Card.Id) && !white_eff_used && Bot.HasInHand(CardId.White) && Card.IsAttack() && Duel.Phase == DuelPhase.Main1) return false;
if (Card.IsFaceup() && Card.IsDefense() && Card.Attack == 0)
return false;
bool enemyBetter = AI.Utils.IsAllEnemyBetter(true);
bool enemyBetter = IsAllEnemyBetter();
if (Card.IsAttack() && enemyBetter)
return true;
......@@ -1629,7 +1747,8 @@ namespace WindBot.Game.AI.Decks
if (!defender.IsMonsterHasPreventActivationEffectInBattle() && !attacker.IsDisabled())
{
if ((attacker.Id == CardId.Eater && !defender.HasType(CardType.Token) && GraveCall_id != CardId.Eater) || attacker.Id == CardId.borrel) return AI.Attack(attacker, defender);
if ((attacker.Id == CardId.Eater && !defender.HasType(CardType.Token)) || attacker.Id == CardId.Borrel) return AI.Attack(attacker, defender);
if ((attacker.Id == CardId.Ultimate || attacker.Id == CardId.Cardian) && attacker.RealPower > defender.RealPower) return AI.Attack(attacker, defender);
}
if (!OnPreBattleBetween(attacker, defender))
......@@ -1650,7 +1769,7 @@ namespace WindBot.Game.AI.Decks
for (int i = 0; i < attackers.Count; ++i)
{
ClientCard attacker = attackers[i];
if (attacker.Id == CardId.borrel || attacker.Id == CardId.Eater) return attacker;
if (attacker.Id == CardId.Borrel || attacker.Id == CardId.Eater) return attacker;
}
return null;
}
......
......@@ -127,6 +127,23 @@ namespace WindBot.Game.AI
return true;
}
/// <summary>
/// Called when the AI has to select a card position.
/// </summary>
/// <param name="cardId">Id of the card to position on the field.</param>
/// <param name="positions">List of available positions.</param>
/// <returns>Selected position, or 0 if no position is set for this card.</returns>
public override CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
YGOSharp.OCGWrapper.NamedCard cardData = YGOSharp.OCGWrapper.NamedCard.Get(cardId);
if (cardData != null)
{
if (cardData.Attack == 0)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override bool OnSelectBattleReplay()
{
if (Bot.BattlingMonster == null)
......@@ -290,9 +307,10 @@ namespace WindBot.Game.AI
if (LastChainCard == null)
return false;
if (LastChainCard.Controller != 1 || LastChainCard.Location != CardLocation.MonsterZone || !DefaultUniqueTrap())
return false;
AI.SelectCard(LastChainCard);
return LastChainCard.Controller == 1 && LastChainCard.Location == CardLocation.MonsterZone && DefaultUniqueTrap();
return true;
}
/// <summary>
......
......@@ -156,6 +156,12 @@ namespace WindBot.Game.AI
return -1;
}
public virtual CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
// Overrided in DefalultExecutor
return 0;
}
public virtual bool OnSelectBattleReplay()
{
// Overrided in DefalultExecutor
......
......@@ -443,13 +443,17 @@ namespace WindBot.Game
/// <returns>Selected position.</returns>
public CardPosition OnSelectPosition(int cardId, IList<CardPosition> positions)
{
CardPosition selector_selected = m_position;
m_position = CardPosition.FaceUpAttack;
CardPosition executor_selected = Executor.OnSelectPosition(cardId, positions);
// Selects the selected position if available, the first available otherwise.
if (positions.Contains(m_position))
{
CardPosition old = m_position;
m_position = CardPosition.FaceUpAttack;
return old;
}
if (positions.Contains(executor_selected))
return executor_selected;
if (positions.Contains(selector_selected))
return selector_selected;
return positions[0];
}
......
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
......@@ -265,6 +265,7 @@ namespace WindBot.Game
private void OnDuelEnd(BinaryReader packet)
{
Connection.Close();
Logger.DebugWriteLine("********************* Duel end *********************");
}
private void OnChat(BinaryReader packet)
......@@ -352,6 +353,7 @@ namespace WindBot.Game
{
int player = GetLocalPlayer(packet.ReadByte());
int count = packet.ReadByte();
Logger.DebugWriteLine("(" + player.ToString() + "抽了" + count.ToString() + "张卡)");
for (int i = 0; i < count; ++i)
{
......@@ -423,6 +425,7 @@ namespace WindBot.Game
private void OnNewPhase(BinaryReader packet)
{
_duel.Phase = (DuelPhase)packet.ReadInt16();
Logger.DebugWriteLine("(进入" + (_duel.Phase.ToString()) + ")");
_duel.LastSummonPlayer = -1;
_duel.Fields[0].BattlingMonster = null;
_duel.Fields[1].BattlingMonster = null;
......@@ -434,6 +437,7 @@ namespace WindBot.Game
int player = GetLocalPlayer(packet.ReadByte());
int final = _duel.Fields[player].LifePoints - packet.ReadInt32();
if (final < 0) final = 0;
Logger.DebugWriteLine("(" + player.ToString() + "受到了伤害,当前为" + final.ToString() + ")");
_duel.Fields[player].LifePoints = final;
}
......@@ -463,6 +467,7 @@ namespace WindBot.Game
packet.ReadInt32(); // reason
ClientCard card = _duel.GetCard(pc, (CardLocation)pl, ps);
if (card != null) Logger.DebugWriteLine("(" + pc.ToString() + "的" + (card.Name ?? "未知卡片") + "从" + (CardLocation)pl + "移动到了" + (CardLocation)cl + ")");
if ((pl & (int)CardLocation.Overlay) != 0)
{
......@@ -506,6 +511,8 @@ namespace WindBot.Game
ClientCard attackcard = _duel.GetCard(ca, (CardLocation)la, sa);
ClientCard defendcard = _duel.GetCard(cd, (CardLocation)ld, sd);
if (defendcard == null) Logger.DebugWriteLine("(" + (attackcard.Name ?? "未知卡片") + "直接攻击)");
else Logger.DebugWriteLine("(" + ca.ToString() + "的" + (attackcard.Name ?? "未知卡片") + "攻击了" + cd.ToString() + "的" + (defendcard.Name ?? "未知卡片") + ")");
_duel.Fields[attackcard.Controller].BattlingMonster = attackcard;
_duel.Fields[1 - attackcard.Controller].BattlingMonster = defendcard;
......@@ -525,7 +532,10 @@ namespace WindBot.Game
int cp = packet.ReadSByte();
ClientCard card = _duel.GetCard(pc, (CardLocation)pl, ps);
if (card != null)
{
card.Position = cp;
Logger.DebugWriteLine("(" + (card.Name ?? "未知卡片") + "改变了表示形式为" + (CardPosition)cp + ")");
}
}
private void OnChaining(BinaryReader packet)
......@@ -537,12 +547,12 @@ namespace WindBot.Game
int subs = packet.ReadSByte();
ClientCard card = _duel.GetCard(pcc, pcl, pcs, subs);
int cc = GetLocalPlayer(packet.ReadByte());
if (card != null) Logger.DebugWriteLine("(" + cc.ToString() + "的" + (card.Name ?? "未知卡片") + "发动了效果)");
_ai.OnChaining(card, cc);
_duel.ChainTargets.Clear();
_duel.LastSummonPlayer = -1;
_duel.CurrentChain.Add(card);
_duel.LastChainPlayer = cc;
}
private void OnChainEnd(BinaryReader packet)
......@@ -632,6 +642,7 @@ namespace WindBot.Game
/*int sseq = */packet.ReadByte();
ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
if (card == null) continue;
Logger.DebugWriteLine("(" + (CardLocation)loc + "的" + (card.Name ?? "未知卡片") + "成为了对象)");
_duel.ChainTargets.Add(card);
}
}
......
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