Commit 0974c33d authored by mercury233's avatar mercury233
parents 124f7da2 e85abe26
......@@ -76,18 +76,3 @@
50588353
50588353
!side
67696066
73176465
37742478
15341821
54757758
13529466
74586817
6983839
82633039
46772449
1861629
1845204
53129443
43898403
48130397
{
"welcome": [
"真難得有人發現這個。",
"真沒想到你能跟我對戰呢!決鬥者。不過也就到此為止了,接下來由我V.F.D(非常友善的決鬥者)來做你的對手。"
],
"deckerror": [
"阿,可能BA又把CBD修壞導致{0}消失了。"
],
"duelstart": [
"這只是AI,打贏不要太高興阿。",
"十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。",
"反主流學院請洽NOVA。",
"Wryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy."
],
"newturn": [
"到我的回合了,抽牌!",
"我的回合,抽牌!",
"我抽了一張卡。"
],
"endturn": [
"回合结束。",
"我的回合结束了。",
"這樣算是成功的展開嗎......",
"輪到你了。你的下一句是......我要發動灰流麗對吧!"
],
"directattack": [
"{0},直接攻擊!",
"{0},直接攻擊對手!",
"{0},没有防守的地方,攻擊!",
"{0},攻擊對手的生命值!",
"{0},直接攻擊對手的生命值!",
"{0},通過直接攻擊打倒對手!",
"{0},使用直接攻擊打倒對手!",
"{0},直接攻擊釋放你的力量吧!",
"我的{0}將會粉碎你的生命值!",
"向對手展示你的力量吧,{0}!",
"你已經無法阻止我了。{0},攻擊!"
],
"attack": [
"{0},攻擊這體{1}!",
"{0},消滅這體{1}!",
"{0},打倒{1}!",
"{0},衝向那體{1}!",
"{0},把你的力量释放到{1}上吧!"
],
"ondirectattack": [
"可惡......",
"不過是{0}而已!",
"果然我還是太弱了......"
],
"facedownmonstername": "怪獸",
"activate": [
"我發動{0}。",
"我使用{0}的效果。",
"我使用{0}的力量。"
],
"summon": [
"真是HIGH的最高點!出來吧{0}。",
"出來吧,{0}!",
"出現吧,{0}!",
"我召喚了強大的{0}!",
"我呼喚{0}參加戰鬥!",
"我呼喚出{0}。",
"我召喚{0}。"
],
"setmonster": [
"我放置了一體怪獸。",
"我裡側表示放置了一體怪獸。"
],
"chaining": [
"看這裡!發動{0}!",
"我使用{0}的力量。",
"很不錯的戰術...但是我拒絕!{0}!",
"真不愧是納粹,竟然能識破我的蓋牌......你說你只是單純的決鬥者?{0},發動!",
"看樣子你忘了我的{0}!",
"你考慮過我有{0}嗎?"
]
}
......@@ -9,8 +9,7 @@
"duelstart": [
"這只是AI,打贏不要太高興阿。",
"十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。",
"反主流學院請洽NOVA。",
"反主流學院請洽NOVA。"
],
"newturn": [
"到我的回合了,抽牌!",
......@@ -71,7 +70,6 @@
"看這裡!發動{0}!",
"我使用{0}的力量。",
"很不錯的戰術...但是我拒絕!{0}!",
"真不愧是納粹,竟然能識破我的蓋牌......你說你只是單純的決鬥者?{0},發動!",
"看樣子你忘了我的{0}!",
"你考慮過我有{0}嗎?"
]
......
......@@ -22,7 +22,7 @@ namespace WindBot.Game.AI.Decks
public const int GiantRex = 80280944;
public const int ShaddollDragon = 77723643;
public const int FairyTailSnow = 55623480;
public const int KeeeperOfDragonicMagic = 48048590;
public const int KeeperOfDragonicMagic = 48048590;
public const int ShaddollSquamata = 30328508;
public const int SouleatingOviraptor = 44335251;
public const int Raiden = 77558536;
......@@ -72,36 +72,38 @@ namespace WindBot.Game.AI.Decks
}
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);
//first do
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst);
AddExecutor(ExecutorType.Activate, CardId.infiniteTransience, infiniteTransience);
AddExecutor(ExecutorType.Activate, CardId.infiniteTransience, DefaultBreakthroughSkill);
AddExecutor(ExecutorType.Activate, CardId.ThatGrassLooksgreener);
AddExecutor(ExecutorType.Summon, CardId.SouleatingOviraptor);
AddExecutor(ExecutorType.Activate, CardId.SouleatingOviraptor, SouleatingOviraptor);
AddExecutor(ExecutorType.Activate, CardId.AllureofDarkness, AllureofDarkness);
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.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.Activate, CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFusion, ShaddollFusion);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFusion, ShaddollFusioneff);
//Reborn
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, RebornEffect);
//Normal Summon
AddExecutor(ExecutorType.Summon, CardId.Raiden);
AddExecutor(ExecutorType.Activate, CardId.Raiden);
AddExecutor(ExecutorType.Summon , CardId.KeeeperOfDragonicMagic);
AddExecutor(ExecutorType.Activate, CardId.KeeeperOfDragonicMagic, KeeeperOfDragonicMagic);
AddExecutor(ExecutorType.Summon , CardId.KeeperOfDragonicMagic);
AddExecutor(ExecutorType.Activate, CardId.KeeperOfDragonicMagic, KeeperOfDragonicMagic);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollSquamata);
AddExecutor(ExecutorType.MonsterSet, CardId.GlowUpBulb);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollHedgehog);
......@@ -112,28 +114,30 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Lumina);
//Sp Summon
AddExecutor(ExecutorType.SpSummon, CardId.UltimateConductorTytanno, UltimateConductorTytannosp);
AddExecutor(ExecutorType.Activate, CardId.UltimateConductorTytanno, UltimateConductorTytanno);
AddExecutor(ExecutorType.Activate, CardId.DoubleEvolutionPill, DoubleEvolutionPill);
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,GlowUpBulb);
AddExecutor(ExecutorType.SpSummon , CardId.GlowUpBulb,GlowUpBulbeff);
//activate chain
AddExecutor(ExecutorType.Activate, CardId.OvertexCoatls);
AddExecutor(ExecutorType.Activate, CardId.OvertexCoatls, OvertexCoatlseff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollBeast);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFalco, ShaddollFalco);
AddExecutor(ExecutorType.Activate, CardId.ShaddollSquamata, ShaddollSquamata);
AddExecutor(ExecutorType.Activate, CardId.ShaddollDragon);
AddExecutor(ExecutorType.Activate, CardId.ShaddollHedgehog);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFalco, ShaddollFalcoeff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollSquamata, ShaddollSquamataeff);
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.ElShaddollShekhinaga);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollShekhinaga, ElShaddollShekhinagaeff);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollWinda);
AddExecutor(ExecutorType.Activate, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragoneff);
AddExecutor(ExecutorType.Activate, CardId.TG_WonderMagician);
//spellset
AddExecutor(ExecutorType.SpellSet, CardId.MonsterReborn, spellset);
......@@ -163,7 +167,7 @@ namespace WindBot.Game.AI.Decks
CardId.GiantRex,
CardId.ShaddollDragon,
CardId.FairyTailSnow,
CardId.KeeeperOfDragonicMagic,
CardId.KeeperOfDragonicMagic,
CardId.ShaddollSquamata,
CardId.SouleatingOviraptor,
CardId.Raiden,
......@@ -215,10 +219,66 @@ namespace WindBot.Game.AI.Decks
};
}
private bool UltimateConductorTytanno()
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,
});
return true;
}
return false;
}
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;
}
private bool UltimateConductorTytannoeff()
{
if (Duel.Phase == DuelPhase.Main1 || Duel.Phase == DuelPhase.Main2)
{
IList<int> targets = new[] {
CardId.OvertexCoatls,
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
......@@ -227,11 +287,35 @@ namespace WindBot.Game.AI.Decks
CardId.GlowUpBulb,
CardId.PlaguespreaderZombie,
CardId.FairyTailSnow,
});
CardId.KeeperOfDragonicMagic,
CardId.Raiden,
CardId.Lumina,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.GiantRex,
CardId.ShaddollSquamata,
CardId.SouleatingOviraptor,
CardId.Raiden,
CardId.Lumina,
CardId.AshBlossom,
CardId.GhostOgre,
CardId.MaxxC,
};
if (!Bot.HasInHand(targets))
{
if (!Bot.HasInMonstersZone(targets))
{
return false;
}
}
AI.SelectCard(targets);
}
if (Duel.Phase == DuelPhase.Damage)
AI.SelectYesNo(true);
return true;
}
private bool UltimateConductorTytannosp()
{
Pillused = true;
......@@ -243,22 +327,126 @@ namespace WindBot.Game.AI.Decks
return true;
}
private bool KeeeperOfDragonicMagic()
private bool KeeperOfDragonicMagic()
{
if (ActivateDescription == -1)
{
AI.SelectCard(Useless_List());
return true;
}
return true;
}
private bool MonsterRepos()
{
if (Card.Id == CardId.ElShaddollConstruct && Card.IsAttack())
return false;
return base.DefaultMonsterRepos();
}
public override void OnNewTurn()
private bool OvertexCoatlseff()
{
Pillused = false;
if (OvertexCoatlseff_used == true)
return false;
return true;
}
private bool DoubleEvolutionPilleff()
{
if (Pillused == true) return false;
Pillused = true;
IList<int> targets = new[] {
CardId.GiantRex,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.OvertexCoatls,
CardId.SouleatingOviraptor,
CardId.UltimateConductorTytanno,
};
if (Bot.HasInGraveyard(targets))
{
AI.SelectCard(new[] {
CardId.GiantRex,
CardId.DogorantheMadFlameKaiju,
CardId.OvertexCoatls,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.SouleatingOviraptor,
CardId.UltimateConductorTytanno,
});
}
else
{
AI.SelectCard(new[] {
CardId.GiantRex,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.OvertexCoatls,
CardId.SouleatingOviraptor,
CardId.UltimateConductorTytanno,
});
}
IList<int> targets2 = new[] {
CardId.GiantRex,
CardId.DogorantheMadFlameKaiju,
CardId.GamecieltheSeaTurtleKaiju,
CardId.RadiantheMultidimensionalKaiju,
CardId.OvertexCoatls,
CardId.SouleatingOviraptor,
CardId.UltimateConductorTytanno,
};
if (Bot.HasInGraveyard(targets))
{
AI.SelectNextCard(new[] {
CardId.ShaddollBeast,
CardId.ShaddollDragon,
CardId.KeeperOfDragonicMagic,
CardId.ShaddollSquamata,
CardId.SouleatingOviraptor,
CardId.Raiden,
CardId.Lumina,
CardId.ShaddollHedgehog,
CardId.AshBlossom,
CardId.GhostOgre,
CardId.ShaddollFalco,
CardId.MaxxC,
CardId.PlaguespreaderZombie,
CardId.GlowUpBulb,
CardId.FairyTailSnow,
});
}
else
AI.SelectNextCard(new[] {
CardId.ShaddollBeast,
CardId.ShaddollDragon,
CardId.KeeperOfDragonicMagic,
CardId.ShaddollSquamata,
CardId.SouleatingOviraptor,
CardId.Raiden,
CardId.Lumina,
CardId.ShaddollHedgehog,
CardId.AshBlossom,
CardId.GhostOgre,
CardId.ShaddollFalco,
CardId.MaxxC,
CardId.PlaguespreaderZombie,
CardId.GlowUpBulb,
CardId.FairyTailSnow,
});
AI.SelectThirdCard(new[] {
CardId.UltimateConductorTytanno,
});
return Enemy.GetMonsterCount() >= 1;
}
private bool ShaddollCoreeff()
{
if (Card.Location == CardLocation.SpellZone)
......@@ -273,6 +461,7 @@ namespace WindBot.Game.AI.Decks
}
return true;
}
private bool FairyTailSnow()
{
......@@ -282,130 +471,48 @@ namespace WindBot.Game.AI.Decks
}
return false;
}
private bool SouleatingOviraptor()
private bool SouleatingOviraptoreff()
{
if (!OvertexCoatlseff_used)
{
AI.SelectCard(CardId.OvertexCoatls);
AI.SelectYesNo(false);
return true;
}
private bool GlowUpBulb()
else
{
AI.SelectPosition(CardPosition.FaceUpDefence);
AI.SelectCard(CardId.UltimateConductorTytanno);
AI.SelectYesNo(true);
}
return true;
}
private bool ShaddollFusion()
{
if (Enemy.GetMonstersExtraZoneCount() != 0)
{
IList<ClientCard> materials0 = Bot.Deck;
IList<ClientCard> materials1 = Bot.Deck;
IList<ClientCard> mats = new List<ClientCard>();
ClientCard mat = null;
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Light))
private bool GlowUpBulbeff()
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollConstruct);
AI.SelectPosition(CardPosition.FaceUpAttack);
if(Bot.HasInMonstersZone(CardId.Lumina)||
Bot.HasInMonstersZone(CardId.FairyTailSnow)||
Bot.HasInMonstersZone(CardId.KeeperOfDragonicMagic)||
Bot.HasInMonstersZone(CardId.SouleatingOviraptor)
)
AI.SelectPosition(CardPosition.FaceUpDefence);
return true;
}
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Earth))
private bool ShaddollFusioneff()
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
});
}
if (mat != null)
if (Enemy.GetMonstersExtraZoneCount() != 0)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollShekhinaga);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Fire))
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
CardId.ElShaddollConstruct,
CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollGrysra);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Dark))
{
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
AI.SelectNextCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
......@@ -414,17 +521,9 @@ namespace WindBot.Game.AI.Decks
CardId.ShaddollFalco,
});
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollWinda);
AI.SelectPosition(CardPosition.FaceUpAttack);
return true;
}
}
else
{
if (!Bot.IsFieldEmpty())
......@@ -436,44 +535,6 @@ namespace WindBot.Game.AI.Decks
}
/* private ClientCard GetAleisterInGrave()
{
foreach (ClientCard card in Enemy.Graveyard)
{
if (card.Id == CardId.AleisterTheInvoker)
{
return card;
}
}
foreach (ClientCard card in Bot.Graveyard)
{
if (card.Id == CardId.AleisterTheInvoker)
{
return card;
}
}
return null;
}*/
private bool DoubleEvolutionPill()
{
if (Pillused == true)return false;
Pillused = true;
if (Bot.HasInGraveyard(CardId.UltimateConductorTytanno) )
{
AI.SelectCard(CardId.UltimateConductorTytanno);
}
AI.SelectThirdCard(new[] {
CardId.UltimateConductorTytanno,
});
return Enemy.GetMonsterCount()>=1;
}
private bool ShaddollCore()
{
return Bot.HasInGraveyard(CardId.ShaddollFusion);
......@@ -503,6 +564,7 @@ namespace WindBot.Game.AI.Decks
}
private bool RebornEffect()
{
IList<int> targets = new[] {
CardId.UltimateConductorTytanno,
CardId.ElShaddollConstruct,
......@@ -519,12 +581,10 @@ namespace WindBot.Game.AI.Decks
}
private bool PotofAvarice()
{
return true;
}
private bool infiniteTransience()
{
return Duel.LastChainPlayer == 1;
}
private bool MaxxC()
{
return Duel.Player == 1;
......@@ -551,23 +611,41 @@ namespace WindBot.Game.AI.Decks
return true;
}
private bool SinisterShadowGames()
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
});
return true;
}
private bool ElShaddollShekhinagaeff()
{
if (Card.Location != CardLocation.MonsterZone)
return true;
else
{
if(Duel.LastChainPlayer==1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollCore,
CardId.ElShaddollConstruct,
CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda,
CardId.ShaddollSquamata,
}
);
}
}
return true;
}
private bool ShaddollFalco()
private bool ShaddollFalcoeff()
{
if (Card.Location != CardLocation.MonsterZone)
return true;
......@@ -586,35 +664,84 @@ namespace WindBot.Game.AI.Decks
}
return true;
}
private bool ShaddollSquamata()
private bool ShaddollHedgehogeff()
{
if (Card.Location != CardLocation.MonsterZone)
{
AI.SelectCard(new[]
{
CardId.ShaddollSquamata,
});
}
else
{
AI.SelectCard(new[] { CardId.ShaddollFusion, CardId.SinisterShadowGames });
}
return true;
}
private bool ShaddollDragoneff()
{
if (Card.Location == CardLocation.MonsterZone)
{
ClientCard target = AI.Utils.GetBestEnemyCard();
AI.SelectCard(target);
return true;
}
else
{
ClientCard target = AI.Utils.GetBestEnemySpell();
AI.SelectCard(target);
return true;
}
}
private bool ShaddollSquamataeff()
{
if (Card.Location != CardLocation.MonsterZone)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
});
}
else
{
ClientCard target = AI.Utils.GetBestEnemyMonster();
AI.SelectCard(target);
}
);
return true;
}
private bool FoolishBurialEffect()
{
if (Bot.GetRemainingCount(CardId.DoubleEvolutionPill, 3) > 0)
{
if (!OvertexCoatlseff_used)
{
AI.SelectCard(new[]
{
CardId.OvertexCoatls,
});
}
else return false;
}
else
{
AI.SelectCard(new[]
{
CardId.OvertexCoatls,
CardId.ShaddollSquamata,
CardId.ShaddollBeast,
CardId.ShaddollCore,
CardId.ShaddollHedgehog,
CardId.ShaddollFalco,
CardId.ShaddollDragon,
CardId.FairyTailSnow,
});
}
return true;
}
private bool GoblindberghSummon()
{
foreach (ClientCard card in Bot.Hand.GetMonsters())
......
using System;
using System;
using System.Collections.Generic;
using YGOSharp.OCGWrapper.Enums;
using WindBot;
......@@ -12,14 +12,15 @@ namespace WindBot.Game.AI
protected class _CardId
{
public const int JizukirutheStarDestroyingKaiju = 63941210;
public const int GadarlatheMysteryDustKaiju = 36956512;
public const int GamecieltheSeaTurtleKaiju = 55063751;
public const int RadiantheMultidimensionalKaiju = 28674152;
public const int KumongoustheStickyStringKaiju = 29726552;
public const int ThunderKingtheLightningstrikeKaiju = 48770333;
public const int DogorantheMadFlameKaiju = 93332803;
public const int RadiantheMultidimensionalKaiju = 28674152;
public const int GadarlatheMysteryDustKaiju = 36956512;
public const int KumongoustheStickyStringKaiju = 29726552;
public const int GamecieltheSeaTurtleKaiju = 55063751;
public const int SuperAntiKaijuWarMachineMechaDogoran = 84769941;
public const int DupeFrog = 46239604;
public const int MaraudingCaptain = 2460565;
......@@ -44,13 +45,40 @@ namespace WindBot.Game.AI
AddExecutor(ExecutorType.Activate, _CardId.ChickenGame, DefaultChickenGame);
}
/// <summary>
/// Decide which card should the attacker attack.
/// </summary>
/// <param name="attacker">Card that attack.</param>
/// <param name="defenders">Cards that defend.</param>
/// <returns>BattlePhaseAction including the target, or null (in this situation, GameAI will check the next attacker)</returns>
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))
return AI.Attack(attacker, defender);
}
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
return null;
}
/// <summary>
/// Decide whether to declare attack between attacker and defender.
/// Can be overrided to update the RealPower of attacker for cards like Honest.
/// </summary>
/// <param name="attacker">Card that attack.</param>
/// <param name="defender">Card that defend.</param>
/// <returns>false if the attack can't be done.</returns>
/// <returns>false if the attack shouldn't be done.</returns>
public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{
if (attacker.RealPower <= 0)
......@@ -68,9 +96,9 @@ namespace WindBot.Game.AI
defender.RealPower = 5000;
if (defender.Id == _CardId.VampireFräulein && !defender.IsDisabled())
defender.RealPower += (Duel.LifePoints[defender.Controller] > 3000) ? 3000 : (Duel.LifePoints[defender.Controller] - 100);
defender.RealPower += (Enemy.LifePoints > 3000) ? 3000 : (Enemy.LifePoints - 100);
if (defender.Id == _CardId.InjectionFairyLily && !defender.IsDisabled() && Duel.LifePoints[defender.Controller] > 2000)
if (defender.Id == _CardId.InjectionFairyLily && !defender.IsDisabled() && Enemy.LifePoints > 2000)
defender.RealPower += 3000;
}
......@@ -99,6 +127,21 @@ namespace WindBot.Game.AI
return true;
}
public override bool OnSelectBattleReplay()
{
if (Bot.BattlingMonster == null)
return false;
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower);
defenders.Reverse();
BattlePhaseAction result = OnSelectAttackTarget(Bot.BattlingMonster, defenders);
if (result != null && result.Action == BattlePhaseAction.BattleAction.Attack)
{
return true;
}
return false;
}
/// <summary>
/// Destroy face-down cards first, in our turn.
/// </summary>
......@@ -469,6 +512,29 @@ namespace WindBot.Game.AI
return false;
}
/// <summary>
/// Draw when we have Dark monster in hand,and banish random one. Can be overrided.
/// </summary>
protected bool DefaultAllureofDarkness()
{
IList<ClientCard> condition = Bot.Hand;
IList<ClientCard> check = new List<ClientCard>();
ClientCard con = null;
foreach (ClientCard card in condition)
{
if (card.HasAttribute(CardAttribute.Dark))
{
con = card;
break;
}
}
if (con != null)
{
return true;
}
return false;
}
/// <summary>
/// Clever enough.
/// </summary>
......@@ -557,7 +623,7 @@ namespace WindBot.Game.AI
}
/// <summary>
/// Clever enough.
/// Clever enough
/// </summary>
protected bool DefaultInterruptedKaijuSlumber()
{
......@@ -567,24 +633,34 @@ namespace WindBot.Game.AI
{
_CardId.GamecieltheSeaTurtleKaiju,
_CardId.KumongoustheStickyStringKaiju,
_CardId.GadarlatheMysteryDustKaiju,
_CardId.RadiantheMultidimensionalKaiju,
_CardId.GadarlatheMysteryDustKaiju
_CardId.DogorantheMadFlameKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
_CardId.JizukirutheStarDestroyingKaiju,
});
return true;
}
AI.SelectCard(new[]
{
_CardId.JizukirutheStarDestroyingKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
_CardId.DogorantheMadFlameKaiju,
_CardId.RadiantheMultidimensionalKaiju,
_CardId.GadarlatheMysteryDustKaiju,
_CardId.KumongoustheStickyStringKaiju
_CardId.KumongoustheStickyStringKaiju,
_CardId.GamecieltheSeaTurtleKaiju,
});
AI.SelectNextCard(new[]
{
_CardId.SuperAntiKaijuWarMachineMechaDogoran,
_CardId.GamecieltheSeaTurtleKaiju,
_CardId.KumongoustheStickyStringKaiju,
_CardId.GadarlatheMysteryDustKaiju,
_CardId.RadiantheMultidimensionalKaiju
_CardId.RadiantheMultidimensionalKaiju,
_CardId.DogorantheMadFlameKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
});
return DefaultDarkHole();
}
......
......@@ -14,6 +14,7 @@
MetaionTheTimelord = 74530899,
KamionTheTimelord = 91712985,
LazionTheTimelord = 92435533,
EaterOfMillions = 63845230
}
EaterOfMillions = 63845230,
ElShaddollConstruct = 20366274,
}
}
......@@ -52,47 +52,26 @@ namespace WindBot.Game.AI
/// <returns>A new BattlePhaseAction containing the action to do.</returns>
public virtual BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
if (attackers.Count == 0)
return AI.ToMainPhase2();
if (defenders.Count == 0)
{
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.Attack > 0)
return AI.Attack(attacker, null);
}
}
else
{
for (int i = defenders.Count - 1; i >= 0; --i)
{
ClientCard defender = defenders[i];
for (int j = 0; j < attackers.Count; ++j)
{
ClientCard attacker = attackers[j];
attacker.RealPower = attacker.Attack;
defender.RealPower = defender.GetDefensePower();
if (!OnPreBattleBetween(attacker, defender))
continue;
if (attacker.RealPower > defender.RealPower || (attacker.RealPower >= defender.RealPower && j == attackers.Count - 1))
return AI.Attack(attacker, defender);
}
// For overriding
return null;
}
for (int i = attackers.Count - 1; i >= 0; --i)
/// <summary>
/// Called when the AI has to decide which card to attack first
/// </summary>
/// <param name="attackers">List of monsters that can attcack.</param>
/// <param name="defenders">List of monsters of enemy.</param>
/// <returns>The card to attack first.</returns>
public virtual ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
ClientCard attacker = attackers[i];
if (attacker.CanDirectAttack)
return AI.Attack(attacker, null);
}
// For overriding
return null;
}
if (!Battle.CanMainPhaseTwo)
return AI.Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]);
return AI.ToMainPhase2();
public virtual BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
{
// Overrided in DefalultExecutor
return null;
}
public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
......@@ -174,6 +153,12 @@ namespace WindBot.Game.AI
return -1;
}
public virtual bool OnSelectBattleReplay()
{
// Overrided in DefalultExecutor
return false;
}
public void SetMain(MainPhase main)
{
Main = main;
......
......@@ -36,6 +36,7 @@ namespace WindBot.Game
public bool CanDirectAttack { get; set; }
public bool ShouldDirectAttack { get; set; }
public bool Attacked { get; set; }
public bool IsLastAttacker { get; set; }
public int[] ActionIndex { get; set; }
public IDictionary<int, int> ActionActivateIndex { get; private set; }
......
......@@ -71,6 +71,19 @@ namespace WindBot.Game
return count;
}
public int GetFieldCount()
{
return GetSpellCount() + GetMonsterCount();
}
public int GetFieldHandCount()
{
return GetSpellCount() + GetMonsterCount() + GetHandCount();
}
public bool IsFieldEmpty()
{
return GetMonsters().Count == 0 && GetSpells().Count == 0;
......
......@@ -143,13 +143,57 @@ namespace WindBot.Game
}
}
// Sort the attackers and defenders, make monster with higher attack go first.
List<ClientCard> attackers = new List<ClientCard>(battle.AttackableCards);
attackers.Sort(AIFunctions.CompareCardAttack);
attackers.Reverse();
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower);
defenders.Reverse();
return Executor.OnBattle(attackers, defenders);
// Let executor decide which card should attack first.
ClientCard selected = Executor.OnSelectAttacker(attackers, defenders);
if (selected != null && attackers.Contains(selected))
{
attackers.Remove(selected);
attackers.Insert(0, selected);
}
// Check for the executor.
BattlePhaseAction result = Executor.OnBattle(attackers, defenders);
if (result != null)
return result;
if (attackers.Count == 0)
return ToMainPhase2();
if (defenders.Count == 0)
{
// Attack with the monster with the lowest attack first
for (int i = attackers.Count - 1; i >= 0; --i)
{
ClientCard attacker = attackers[i];
if (attacker.Attack > 0)
return Attack(attacker, null);
}
}
else
{
for (int k = 0; k < attackers.Count; ++k)
{
ClientCard attacker = attackers[k];
attacker.IsLastAttacker = (k == attackers.Count - 1);
result = Executor.OnSelectAttackTarget(attacker, defenders);
if (result != null)
return result;
}
}
if (!battle.CanMainPhaseTwo)
return Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]);
return ToMainPhase2();
}
/// <summary>
......@@ -220,9 +264,11 @@ namespace WindBot.Game
// Always select the first available cards and choose the minimum.
IList<ClientCard> selected = new List<ClientCard>();
if (cards.Count >= min)
{
for (int i = 0; i < min; ++i)
selected.Add(cards[i]);
}
return selected;
}
......@@ -601,6 +647,15 @@ namespace WindBot.Game
return Executor.OnSelectYesNo(desc);
}
/// <summary>
/// Called when the AI has to select if to continue attacking when replay.
/// </summary>
/// <returns>True for yes, false for no.</returns>
public bool OnSelectBattleReplay()
{
return Executor.OnSelectBattleReplay();
}
/// <summary>
/// Called when the AI has to declare a card.
/// </summary>
......
......@@ -108,6 +108,7 @@ namespace WindBot.Game
_messages.Add(GameMessage.BecomeTarget, OnBecomeTarget);
_messages.Add(GameMessage.SelectBattleCmd, OnSelectBattleCmd);
_messages.Add(GameMessage.SelectCard, OnSelectCard);
_messages.Add(GameMessage.SelectUnselectCard, OnSelectUnselectCard);
_messages.Add(GameMessage.SelectChain, OnSelectChain);
_messages.Add(GameMessage.SelectCounter, OnSelectCounter);
_messages.Add(GameMessage.SelectDisfield, OnSelectDisfield);
......@@ -750,11 +751,84 @@ namespace WindBot.Game
Connection.Send(reply);
}
private void InternalOnSelectUnselectCard(BinaryReader packet, Func<IList<ClientCard>, int, int, int, bool, IList<ClientCard>> func)
{
packet.ReadByte(); // player
packet.ReadByte(); // buttonok
bool cancelable = packet.ReadByte() != 0;
int min = packet.ReadByte();
int max = packet.ReadByte();
IList<ClientCard> cards = new List<ClientCard>();
int count = packet.ReadByte();
for (int i = 0; i < count; ++i)
{
int id = packet.ReadInt32();
int player = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
packet.ReadByte(); // pos
ClientCard card;
if (((int)loc & (int)CardLocation.Overlay) != 0)
card = new ClientCard(id, CardLocation.Overlay);
else
card = _duel.GetCard(player, loc, seq);
if (card == null) continue;
if (card.Id == 0)
card.SetId(id);
cards.Add(card);
}
int count2 = packet.ReadByte();
for (int i = 0; i < count2; ++i)
{
int id = packet.ReadInt32();
int player = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
packet.ReadByte(); // pos
}
IList<ClientCard> selected = func(cards, min, max, _select_hint, cancelable);
_select_hint = 0;
if (selected.Count == 0 && cancelable)
{
Connection.Send(CtosMessage.Response, -1);
return;
}
byte[] result = new byte[selected.Count + 1];
result[0] = (byte)selected.Count;
for (int i = 0; i < selected.Count; ++i)
{
int id = 0;
for (int j = 0; j < count; ++j)
{
if (cards[j] == null) continue;
if (cards[j].Equals(selected[i]))
{
id = j;
break;
}
}
result[i + 1] = (byte)id;
}
BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response);
reply.Write(result);
Connection.Send(reply);
}
private void OnSelectCard(BinaryReader packet)
{
InternalOnSelectCard(packet, _ai.OnSelectCard);
}
private void OnSelectUnselectCard(BinaryReader packet)
{
InternalOnSelectUnselectCard(packet, _ai.OnSelectCard);
}
private void OnSelectChain(BinaryReader packet)
{
packet.ReadByte(); // player
......@@ -1106,7 +1180,12 @@ namespace WindBot.Game
private void OnSelectYesNo(BinaryReader packet)
{
packet.ReadByte(); // player
int reply = _ai.OnSelectYesNo(packet.ReadInt32()) ? (1) : (0);
int desc = packet.ReadInt32();
int reply;
if (desc == 30)
reply = _ai.OnSelectBattleReplay() ? 1 : 0;
else
reply = _ai.OnSelectYesNo(desc) ? 1 : 0;
Connection.Send(CtosMessage.Response, reply);
}
......
using System;
using System;
namespace WindBot
{
......
No preview for this file type
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