Commit 0974c33d authored by mercury233's avatar mercury233
parents 124f7da2 e85abe26
...@@ -76,18 +76,3 @@ ...@@ -76,18 +76,3 @@
50588353 50588353
50588353 50588353
!side !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 @@ ...@@ -9,8 +9,7 @@
"duelstart": [ "duelstart": [
"這只是AI,打贏不要太高興阿。", "這只是AI,打贏不要太高興阿。",
"十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。", "十分致謝233服讓我們有遊戲可以玩,別忘記去拜訪他們。",
"反主流學院請洽NOVA。", "反主流學院請洽NOVA。"
], ],
"newturn": [ "newturn": [
"到我的回合了,抽牌!", "到我的回合了,抽牌!",
...@@ -71,7 +70,6 @@ ...@@ -71,7 +70,6 @@
"看這裡!發動{0}!", "看這裡!發動{0}!",
"我使用{0}的力量。", "我使用{0}的力量。",
"很不錯的戰術...但是我拒絕!{0}!", "很不錯的戰術...但是我拒絕!{0}!",
"真不愧是納粹,竟然能識破我的蓋牌......你說你只是單純的決鬥者?{0},發動!",
"看樣子你忘了我的{0}!", "看樣子你忘了我的{0}!",
"你考慮過我有{0}嗎?" "你考慮過我有{0}嗎?"
] ]
......
...@@ -22,7 +22,7 @@ namespace WindBot.Game.AI.Decks ...@@ -22,7 +22,7 @@ namespace WindBot.Game.AI.Decks
public const int GiantRex = 80280944; public const int GiantRex = 80280944;
public const int ShaddollDragon = 77723643; public const int ShaddollDragon = 77723643;
public const int FairyTailSnow = 55623480; public const int FairyTailSnow = 55623480;
public const int KeeeperOfDragonicMagic = 48048590; public const int KeeperOfDragonicMagic = 48048590;
public const int ShaddollSquamata = 30328508; public const int ShaddollSquamata = 30328508;
public const int SouleatingOviraptor = 44335251; public const int SouleatingOviraptor = 44335251;
public const int Raiden = 77558536; public const int Raiden = 77558536;
...@@ -72,36 +72,38 @@ namespace WindBot.Game.AI.Decks ...@@ -72,36 +72,38 @@ namespace WindBot.Game.AI.Decks
} }
bool Pillused = false; bool Pillused = false;
bool CrystalWingSynchroDragoneff_used = false;
bool OvertexCoatlseff_used = false;
public LightswornShaddoldinosour(GameAI ai, Duel duel) public LightswornShaddoldinosour(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
//counter //counter
AddExecutor(ExecutorType.SpSummon, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragonesp);
AddExecutor(ExecutorType.Activate, CardId.GhostOgre, Hand_act_eff); AddExecutor(ExecutorType.Activate, CardId.GhostOgre, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.AshBlossom, Hand_act_eff); AddExecutor(ExecutorType.Activate, CardId.AshBlossom, Hand_act_eff);
AddExecutor(ExecutorType.Activate, CardId.MaxxC,MaxxC); AddExecutor(ExecutorType.Activate, CardId.MaxxC,MaxxC);
//first do //first do
AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster, DefaultHarpiesFeatherDusterFirst); 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.Activate, CardId.ThatGrassLooksgreener);
AddExecutor(ExecutorType.Summon, CardId.SouleatingOviraptor); AddExecutor(ExecutorType.Summon, CardId.SouleatingOviraptor);
AddExecutor(ExecutorType.Activate, CardId.SouleatingOviraptor, SouleatingOviraptor); AddExecutor(ExecutorType.Activate, CardId.SouleatingOviraptor, SouleatingOviraptoreff);
AddExecutor(ExecutorType.Activate, CardId.AllureofDarkness, AllureofDarkness); AddExecutor(ExecutorType.Activate, CardId.AllureofDarkness, DefaultAllureofDarkness);
AddExecutor(ExecutorType.Activate, CardId.PotOfAvarice, PotofAvarice); AddExecutor(ExecutorType.Activate, CardId.PotOfAvarice, PotofAvarice);
// AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster); // AddExecutor(ExecutorType.Activate, CardId.HarpiesFeatherDuster);
AddExecutor(ExecutorType.Activate, CardId.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect); AddExecutor(ExecutorType.Activate, CardId.ChargeOfTheLightBrigade, ChargeOfTheLightBrigadeEffect);
AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect); AddExecutor(ExecutorType.Activate, CardId.FoolishBurial, FoolishBurialEffect);
AddExecutor(ExecutorType.Activate, CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber); AddExecutor(ExecutorType.Activate, CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFusion, ShaddollFusion); AddExecutor(ExecutorType.Activate, CardId.ShaddollFusion, ShaddollFusioneff);
//Reborn //Reborn
AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, RebornEffect); AddExecutor(ExecutorType.Activate, CardId.MonsterReborn, RebornEffect);
//Normal Summon //Normal Summon
AddExecutor(ExecutorType.Summon, CardId.Raiden); AddExecutor(ExecutorType.Summon, CardId.Raiden);
AddExecutor(ExecutorType.Activate, CardId.Raiden); AddExecutor(ExecutorType.Activate, CardId.Raiden);
AddExecutor(ExecutorType.Summon , CardId.KeeeperOfDragonicMagic); AddExecutor(ExecutorType.Summon , CardId.KeeperOfDragonicMagic);
AddExecutor(ExecutorType.Activate, CardId.KeeeperOfDragonicMagic, KeeeperOfDragonicMagic); AddExecutor(ExecutorType.Activate, CardId.KeeperOfDragonicMagic, KeeperOfDragonicMagic);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollSquamata); AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollSquamata);
AddExecutor(ExecutorType.MonsterSet, CardId.GlowUpBulb); AddExecutor(ExecutorType.MonsterSet, CardId.GlowUpBulb);
AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollHedgehog); AddExecutor(ExecutorType.MonsterSet, CardId.ShaddollHedgehog);
...@@ -112,28 +114,30 @@ namespace WindBot.Game.AI.Decks ...@@ -112,28 +114,30 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.Lumina); AddExecutor(ExecutorType.Activate, CardId.Lumina);
//Sp Summon //Sp Summon
AddExecutor(ExecutorType.SpSummon, CardId.UltimateConductorTytanno, UltimateConductorTytannosp); AddExecutor(ExecutorType.SpSummon, CardId.UltimateConductorTytanno, UltimateConductorTytannosp);
AddExecutor(ExecutorType.Activate, CardId.UltimateConductorTytanno, UltimateConductorTytanno); AddExecutor(ExecutorType.Activate, CardId.UltimateConductorTytanno, UltimateConductorTytannoeff);
AddExecutor(ExecutorType.Activate, CardId.DoubleEvolutionPill, DoubleEvolutionPill); AddExecutor(ExecutorType.Activate, CardId.DoubleEvolutionPill, DoubleEvolutionPilleff);
AddExecutor(ExecutorType.SpSummon, CardId.MinervaTheExalte); AddExecutor(ExecutorType.SpSummon, CardId.MinervaTheExalte);
AddExecutor(ExecutorType.Activate, CardId.MinervaTheExalte, MinervaTheExaltedEffect); AddExecutor(ExecutorType.Activate, CardId.MinervaTheExalte, MinervaTheExaltedEffect);
AddExecutor(ExecutorType.SpSummon, CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
//activate //activate
AddExecutor(ExecutorType.Activate , CardId.GlowUpBulb,GlowUpBulb); AddExecutor(ExecutorType.SpSummon , CardId.GlowUpBulb,GlowUpBulbeff);
//activate chain //activate chain
AddExecutor(ExecutorType.Activate, CardId.OvertexCoatls); AddExecutor(ExecutorType.Activate, CardId.OvertexCoatls, OvertexCoatlseff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollBeast); AddExecutor(ExecutorType.Activate, CardId.ShaddollBeast);
AddExecutor(ExecutorType.Activate, CardId.ShaddollFalco, ShaddollFalco); AddExecutor(ExecutorType.Activate, CardId.ShaddollFalco, ShaddollFalcoeff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollSquamata, ShaddollSquamata); AddExecutor(ExecutorType.Activate, CardId.ShaddollSquamata, ShaddollSquamataeff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollDragon); AddExecutor(ExecutorType.Activate, CardId.ShaddollDragon, ShaddollDragoneff);
AddExecutor(ExecutorType.Activate, CardId.ShaddollHedgehog); AddExecutor(ExecutorType.Activate, CardId.ShaddollHedgehog, ShaddollHedgehogeff);
AddExecutor(ExecutorType.Activate, CardId.GiantRex); AddExecutor(ExecutorType.Activate, CardId.GiantRex);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollConstruct); AddExecutor(ExecutorType.Activate, CardId.ElShaddollConstruct);
AddExecutor(ExecutorType.Activate, CardId.ElShaddollGrysra); 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.ElShaddollWinda);
AddExecutor(ExecutorType.Activate, CardId.CrystalWingSynchroDragon, CrystalWingSynchroDragoneff);
AddExecutor(ExecutorType.Activate, CardId.TG_WonderMagician); AddExecutor(ExecutorType.Activate, CardId.TG_WonderMagician);
//spellset //spellset
AddExecutor(ExecutorType.SpellSet, CardId.MonsterReborn, spellset); AddExecutor(ExecutorType.SpellSet, CardId.MonsterReborn, spellset);
...@@ -163,7 +167,7 @@ namespace WindBot.Game.AI.Decks ...@@ -163,7 +167,7 @@ namespace WindBot.Game.AI.Decks
CardId.GiantRex, CardId.GiantRex,
CardId.ShaddollDragon, CardId.ShaddollDragon,
CardId.FairyTailSnow, CardId.FairyTailSnow,
CardId.KeeeperOfDragonicMagic, CardId.KeeperOfDragonicMagic,
CardId.ShaddollSquamata, CardId.ShaddollSquamata,
CardId.SouleatingOviraptor, CardId.SouleatingOviraptor,
CardId.Raiden, CardId.Raiden,
...@@ -215,10 +219,66 @@ namespace WindBot.Game.AI.Decks ...@@ -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[] 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.OvertexCoatls,
CardId.ShaddollBeast, CardId.ShaddollBeast,
CardId.ShaddollSquamata, CardId.ShaddollSquamata,
...@@ -227,11 +287,35 @@ namespace WindBot.Game.AI.Decks ...@@ -227,11 +287,35 @@ namespace WindBot.Game.AI.Decks
CardId.GlowUpBulb, CardId.GlowUpBulb,
CardId.PlaguespreaderZombie, CardId.PlaguespreaderZombie,
CardId.FairyTailSnow, 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; return true;
} }
private bool UltimateConductorTytannosp() private bool UltimateConductorTytannosp()
{ {
Pillused = true; Pillused = true;
...@@ -243,22 +327,126 @@ namespace WindBot.Game.AI.Decks ...@@ -243,22 +327,126 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
private bool KeeeperOfDragonicMagic()
private bool KeeperOfDragonicMagic()
{
if (ActivateDescription == -1)
{ {
AI.SelectCard(Useless_List()); AI.SelectCard(Useless_List());
return true;
}
return true; return true;
} }
private bool MonsterRepos() private bool MonsterRepos()
{ {
if (Card.Id == CardId.ElShaddollConstruct && Card.IsAttack()) if (Card.Id == CardId.ElShaddollConstruct && Card.IsAttack())
return false; return false;
return base.DefaultMonsterRepos(); 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() private bool ShaddollCoreeff()
{ {
if (Card.Location == CardLocation.SpellZone) if (Card.Location == CardLocation.SpellZone)
...@@ -273,6 +461,7 @@ namespace WindBot.Game.AI.Decks ...@@ -273,6 +461,7 @@ namespace WindBot.Game.AI.Decks
} }
return true; return true;
} }
private bool FairyTailSnow() private bool FairyTailSnow()
{ {
...@@ -282,130 +471,48 @@ namespace WindBot.Game.AI.Decks ...@@ -282,130 +471,48 @@ namespace WindBot.Game.AI.Decks
} }
return false; return false;
} }
private bool SouleatingOviraptor()
private bool SouleatingOviraptoreff()
{
if (!OvertexCoatlseff_used)
{ {
AI.SelectCard(CardId.OvertexCoatls); AI.SelectCard(CardId.OvertexCoatls);
AI.SelectYesNo(false); AI.SelectYesNo(false);
return true;
} }
private bool GlowUpBulb() else
{ {
AI.SelectPosition(CardPosition.FaceUpDefence); AI.SelectCard(CardId.UltimateConductorTytanno);
AI.SelectYesNo(true);
}
return 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; private bool GlowUpBulbeff()
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Light))
{ {
mat = card; if(Bot.HasInMonstersZone(CardId.Lumina)||
break; Bot.HasInMonstersZone(CardId.FairyTailSnow)||
} Bot.HasInMonstersZone(CardId.KeeperOfDragonicMagic)||
} Bot.HasInMonstersZone(CardId.SouleatingOviraptor)
foreach (ClientCard card in materials1) )
{ AI.SelectPosition(CardPosition.FaceUpDefence);
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);
return true; return true;
} }
private bool ShaddollFusioneff()
foreach (ClientCard card in materials0)
{
if (card.HasAttribute(CardAttribute.Earth))
{ {
mat = card;
break;
}
}
foreach (ClientCard card in materials1)
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
CardId.ShaddollSquamata,
CardId.ShaddollHedgehog,
CardId.ShaddollDragon,
CardId.ShaddollFalco,
}); if (Enemy.GetMonstersExtraZoneCount() != 0)
}
if (mat != null)
{ {
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[] AI.SelectCard(new[]
{ {
CardId.ShaddollBeast, CardId.ElShaddollConstruct,
CardId.ShaddollSquamata, CardId.ElShaddollShekhinaga,
CardId.ShaddollHedgehog, CardId.ElShaddollGrysra,
CardId.ShaddollDragon, CardId.ElShaddollWinda
CardId.ShaddollFalco,
}); });
} AI.SelectNextCard(new[]
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[]
{ {
CardId.ShaddollBeast, CardId.ShaddollBeast,
CardId.ShaddollSquamata, CardId.ShaddollSquamata,
...@@ -414,17 +521,9 @@ namespace WindBot.Game.AI.Decks ...@@ -414,17 +521,9 @@ namespace WindBot.Game.AI.Decks
CardId.ShaddollFalco, CardId.ShaddollFalco,
}); });
}
if (mat != null)
{
mats.Add(mat);
AI.SelectMaterials(mats);
AI.SelectCard(CardId.ElShaddollWinda);
AI.SelectPosition(CardPosition.FaceUpAttack); AI.SelectPosition(CardPosition.FaceUpAttack);
return true; return true;
} }
}
else else
{ {
if (!Bot.IsFieldEmpty()) if (!Bot.IsFieldEmpty())
...@@ -436,44 +535,6 @@ namespace WindBot.Game.AI.Decks ...@@ -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() private bool ShaddollCore()
{ {
return Bot.HasInGraveyard(CardId.ShaddollFusion); return Bot.HasInGraveyard(CardId.ShaddollFusion);
...@@ -503,6 +564,7 @@ namespace WindBot.Game.AI.Decks ...@@ -503,6 +564,7 @@ namespace WindBot.Game.AI.Decks
} }
private bool RebornEffect() private bool RebornEffect()
{ {
IList<int> targets = new[] { IList<int> targets = new[] {
CardId.UltimateConductorTytanno, CardId.UltimateConductorTytanno,
CardId.ElShaddollConstruct, CardId.ElShaddollConstruct,
...@@ -519,12 +581,10 @@ namespace WindBot.Game.AI.Decks ...@@ -519,12 +581,10 @@ namespace WindBot.Game.AI.Decks
} }
private bool PotofAvarice() private bool PotofAvarice()
{ {
return true; return true;
} }
private bool infiniteTransience()
{
return Duel.LastChainPlayer == 1;
}
private bool MaxxC() private bool MaxxC()
{ {
return Duel.Player == 1; return Duel.Player == 1;
...@@ -551,23 +611,41 @@ namespace WindBot.Game.AI.Decks ...@@ -551,23 +611,41 @@ namespace WindBot.Game.AI.Decks
return true; return true;
} }
private bool SinisterShadowGames() private bool SinisterShadowGames()
{
AI.SelectCard(new[]
{
CardId.ShaddollBeast,
});
return true;
}
private bool ElShaddollShekhinagaeff()
{ {
if (Card.Location != CardLocation.MonsterZone) if (Card.Location != CardLocation.MonsterZone)
return true; return true;
else else
{
if(Duel.LastChainPlayer==1)
{ {
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
CardId.ShaddollBeast, CardId.ElShaddollConstruct,
CardId.ShaddollCore, CardId.ElShaddollShekhinaga,
CardId.ElShaddollGrysra,
CardId.ElShaddollWinda,
CardId.ShaddollSquamata,
} }
); );
} }
}
return true; return true;
} }
private bool ShaddollFalco() private bool ShaddollFalcoeff()
{ {
if (Card.Location != CardLocation.MonsterZone) if (Card.Location != CardLocation.MonsterZone)
return true; return true;
...@@ -586,35 +664,84 @@ namespace WindBot.Game.AI.Decks ...@@ -586,35 +664,84 @@ namespace WindBot.Game.AI.Decks
} }
return true; 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[] AI.SelectCard(new[]
{ {
CardId.ShaddollBeast, CardId.ShaddollBeast,
});
}
else
{
ClientCard target = AI.Utils.GetBestEnemyMonster();
AI.SelectCard(target);
} }
);
return true; return true;
} }
private bool FoolishBurialEffect() 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[] AI.SelectCard(new[]
{ {
CardId.OvertexCoatls, CardId.OvertexCoatls,
CardId.ShaddollSquamata, CardId.ShaddollSquamata,
CardId.ShaddollBeast,
CardId.ShaddollCore,
CardId.ShaddollHedgehog,
CardId.ShaddollFalco,
CardId.ShaddollDragon,
CardId.FairyTailSnow, CardId.FairyTailSnow,
}); });
}
return true; return true;
} }
private bool GoblindberghSummon() private bool GoblindberghSummon()
{ {
foreach (ClientCard card in Bot.Hand.GetMonsters()) foreach (ClientCard card in Bot.Hand.GetMonsters())
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using WindBot; using WindBot;
...@@ -12,14 +12,15 @@ namespace WindBot.Game.AI ...@@ -12,14 +12,15 @@ namespace WindBot.Game.AI
protected class _CardId protected class _CardId
{ {
public const int JizukirutheStarDestroyingKaiju = 63941210; 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 ThunderKingtheLightningstrikeKaiju = 48770333;
public const int DogorantheMadFlameKaiju = 93332803; 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 SuperAntiKaijuWarMachineMechaDogoran = 84769941;
public const int DupeFrog = 46239604; public const int DupeFrog = 46239604;
public const int MaraudingCaptain = 2460565; public const int MaraudingCaptain = 2460565;
...@@ -44,13 +45,40 @@ namespace WindBot.Game.AI ...@@ -44,13 +45,40 @@ namespace WindBot.Game.AI
AddExecutor(ExecutorType.Activate, _CardId.ChickenGame, DefaultChickenGame); 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> /// <summary>
/// Decide whether to declare attack between attacker and defender. /// Decide whether to declare attack between attacker and defender.
/// Can be overrided to update the RealPower of attacker for cards like Honest. /// Can be overrided to update the RealPower of attacker for cards like Honest.
/// </summary> /// </summary>
/// <param name="attacker">Card that attack.</param> /// <param name="attacker">Card that attack.</param>
/// <param name="defender">Card that defend.</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) public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
{ {
if (attacker.RealPower <= 0) if (attacker.RealPower <= 0)
...@@ -68,9 +96,9 @@ namespace WindBot.Game.AI ...@@ -68,9 +96,9 @@ namespace WindBot.Game.AI
defender.RealPower = 5000; defender.RealPower = 5000;
if (defender.Id == _CardId.VampireFräulein && !defender.IsDisabled()) 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; defender.RealPower += 3000;
} }
...@@ -99,6 +127,21 @@ namespace WindBot.Game.AI ...@@ -99,6 +127,21 @@ namespace WindBot.Game.AI
return true; 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> /// <summary>
/// Destroy face-down cards first, in our turn. /// Destroy face-down cards first, in our turn.
/// </summary> /// </summary>
...@@ -469,6 +512,29 @@ namespace WindBot.Game.AI ...@@ -469,6 +512,29 @@ namespace WindBot.Game.AI
return false; 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> /// <summary>
/// Clever enough. /// Clever enough.
/// </summary> /// </summary>
...@@ -557,7 +623,7 @@ namespace WindBot.Game.AI ...@@ -557,7 +623,7 @@ namespace WindBot.Game.AI
} }
/// <summary> /// <summary>
/// Clever enough. /// Clever enough
/// </summary> /// </summary>
protected bool DefaultInterruptedKaijuSlumber() protected bool DefaultInterruptedKaijuSlumber()
{ {
...@@ -567,24 +633,34 @@ namespace WindBot.Game.AI ...@@ -567,24 +633,34 @@ namespace WindBot.Game.AI
{ {
_CardId.GamecieltheSeaTurtleKaiju, _CardId.GamecieltheSeaTurtleKaiju,
_CardId.KumongoustheStickyStringKaiju, _CardId.KumongoustheStickyStringKaiju,
_CardId.GadarlatheMysteryDustKaiju,
_CardId.RadiantheMultidimensionalKaiju, _CardId.RadiantheMultidimensionalKaiju,
_CardId.GadarlatheMysteryDustKaiju _CardId.DogorantheMadFlameKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
_CardId.JizukirutheStarDestroyingKaiju,
}); });
return true; return true;
} }
AI.SelectCard(new[] AI.SelectCard(new[]
{ {
_CardId.JizukirutheStarDestroyingKaiju, _CardId.JizukirutheStarDestroyingKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
_CardId.DogorantheMadFlameKaiju,
_CardId.RadiantheMultidimensionalKaiju, _CardId.RadiantheMultidimensionalKaiju,
_CardId.GadarlatheMysteryDustKaiju, _CardId.GadarlatheMysteryDustKaiju,
_CardId.KumongoustheStickyStringKaiju _CardId.KumongoustheStickyStringKaiju,
_CardId.GamecieltheSeaTurtleKaiju,
}); });
AI.SelectNextCard(new[] AI.SelectNextCard(new[]
{ {
_CardId.SuperAntiKaijuWarMachineMechaDogoran,
_CardId.GamecieltheSeaTurtleKaiju, _CardId.GamecieltheSeaTurtleKaiju,
_CardId.KumongoustheStickyStringKaiju, _CardId.KumongoustheStickyStringKaiju,
_CardId.GadarlatheMysteryDustKaiju, _CardId.GadarlatheMysteryDustKaiju,
_CardId.RadiantheMultidimensionalKaiju _CardId.RadiantheMultidimensionalKaiju,
_CardId.DogorantheMadFlameKaiju,
_CardId.ThunderKingtheLightningstrikeKaiju,
}); });
return DefaultDarkHole(); return DefaultDarkHole();
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
MetaionTheTimelord = 74530899, MetaionTheTimelord = 74530899,
KamionTheTimelord = 91712985, KamionTheTimelord = 91712985,
LazionTheTimelord = 92435533, LazionTheTimelord = 92435533,
EaterOfMillions = 63845230 EaterOfMillions = 63845230,
} ElShaddollConstruct = 20366274,
}
} }
...@@ -52,47 +52,26 @@ namespace WindBot.Game.AI ...@@ -52,47 +52,26 @@ namespace WindBot.Game.AI
/// <returns>A new BattlePhaseAction containing the action to do.</returns> /// <returns>A new BattlePhaseAction containing the action to do.</returns>
public virtual BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders) public virtual BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders)
{ {
if (attackers.Count == 0) // For overriding
return AI.ToMainPhase2(); return null;
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 (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]; // For overriding
if (attacker.CanDirectAttack) return null;
return AI.Attack(attacker, null);
}
} }
if (!Battle.CanMainPhaseTwo) public virtual BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
return AI.Attack(attackers[0], (defenders.Count == 0) ? null : defenders[0]); {
// Overrided in DefalultExecutor
return AI.ToMainPhase2(); return null;
} }
public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender) public virtual bool OnPreBattleBetween(ClientCard attacker, ClientCard defender)
...@@ -174,6 +153,12 @@ namespace WindBot.Game.AI ...@@ -174,6 +153,12 @@ namespace WindBot.Game.AI
return -1; return -1;
} }
public virtual bool OnSelectBattleReplay()
{
// Overrided in DefalultExecutor
return false;
}
public void SetMain(MainPhase main) public void SetMain(MainPhase main)
{ {
Main = main; Main = main;
......
...@@ -36,6 +36,7 @@ namespace WindBot.Game ...@@ -36,6 +36,7 @@ namespace WindBot.Game
public bool CanDirectAttack { get; set; } public bool CanDirectAttack { get; set; }
public bool ShouldDirectAttack { get; set; } public bool ShouldDirectAttack { get; set; }
public bool Attacked { get; set; } public bool Attacked { get; set; }
public bool IsLastAttacker { get; set; }
public int[] ActionIndex { get; set; } public int[] ActionIndex { get; set; }
public IDictionary<int, int> ActionActivateIndex { get; private set; } public IDictionary<int, int> ActionActivateIndex { get; private set; }
......
...@@ -71,6 +71,19 @@ namespace WindBot.Game ...@@ -71,6 +71,19 @@ namespace WindBot.Game
return count; return count;
} }
public int GetFieldCount()
{
return GetSpellCount() + GetMonsterCount();
}
public int GetFieldHandCount()
{
return GetSpellCount() + GetMonsterCount() + GetHandCount();
}
public bool IsFieldEmpty() public bool IsFieldEmpty()
{ {
return GetMonsters().Count == 0 && GetSpells().Count == 0; return GetMonsters().Count == 0 && GetSpells().Count == 0;
......
...@@ -143,13 +143,57 @@ namespace WindBot.Game ...@@ -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); List<ClientCard> attackers = new List<ClientCard>(battle.AttackableCards);
attackers.Sort(AIFunctions.CompareCardAttack); attackers.Sort(AIFunctions.CompareCardAttack);
attackers.Reverse();
List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters()); List<ClientCard> defenders = new List<ClientCard>(Duel.Fields[1].GetMonsters());
defenders.Sort(AIFunctions.CompareDefensePower); 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> /// <summary>
...@@ -220,9 +264,11 @@ namespace WindBot.Game ...@@ -220,9 +264,11 @@ namespace WindBot.Game
// Always select the first available cards and choose the minimum. // Always select the first available cards and choose the minimum.
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
if (cards.Count >= min)
{
for (int i = 0; i < min; ++i) for (int i = 0; i < min; ++i)
selected.Add(cards[i]); selected.Add(cards[i]);
}
return selected; return selected;
} }
...@@ -601,6 +647,15 @@ namespace WindBot.Game ...@@ -601,6 +647,15 @@ namespace WindBot.Game
return Executor.OnSelectYesNo(desc); 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> /// <summary>
/// Called when the AI has to declare a card. /// Called when the AI has to declare a card.
/// </summary> /// </summary>
......
...@@ -108,6 +108,7 @@ namespace WindBot.Game ...@@ -108,6 +108,7 @@ namespace WindBot.Game
_messages.Add(GameMessage.BecomeTarget, OnBecomeTarget); _messages.Add(GameMessage.BecomeTarget, OnBecomeTarget);
_messages.Add(GameMessage.SelectBattleCmd, OnSelectBattleCmd); _messages.Add(GameMessage.SelectBattleCmd, OnSelectBattleCmd);
_messages.Add(GameMessage.SelectCard, OnSelectCard); _messages.Add(GameMessage.SelectCard, OnSelectCard);
_messages.Add(GameMessage.SelectUnselectCard, OnSelectUnselectCard);
_messages.Add(GameMessage.SelectChain, OnSelectChain); _messages.Add(GameMessage.SelectChain, OnSelectChain);
_messages.Add(GameMessage.SelectCounter, OnSelectCounter); _messages.Add(GameMessage.SelectCounter, OnSelectCounter);
_messages.Add(GameMessage.SelectDisfield, OnSelectDisfield); _messages.Add(GameMessage.SelectDisfield, OnSelectDisfield);
...@@ -750,11 +751,84 @@ namespace WindBot.Game ...@@ -750,11 +751,84 @@ namespace WindBot.Game
Connection.Send(reply); 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) private void OnSelectCard(BinaryReader packet)
{ {
InternalOnSelectCard(packet, _ai.OnSelectCard); InternalOnSelectCard(packet, _ai.OnSelectCard);
} }
private void OnSelectUnselectCard(BinaryReader packet)
{
InternalOnSelectUnselectCard(packet, _ai.OnSelectCard);
}
private void OnSelectChain(BinaryReader packet) private void OnSelectChain(BinaryReader packet)
{ {
packet.ReadByte(); // player packet.ReadByte(); // player
...@@ -1106,7 +1180,12 @@ namespace WindBot.Game ...@@ -1106,7 +1180,12 @@ namespace WindBot.Game
private void OnSelectYesNo(BinaryReader packet) private void OnSelectYesNo(BinaryReader packet)
{ {
packet.ReadByte(); // player 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); Connection.Send(CtosMessage.Response, reply);
} }
......
using System; using System;
namespace WindBot 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