Commit 2ad318ae authored by 苍蓝's avatar 苍蓝

update

parent 780b6d6c
Pipeline #20009 passed with stage
in 24 seconds
...@@ -115,6 +115,10 @@ namespace WindBot.Game.AI ...@@ -115,6 +115,10 @@ namespace WindBot.Game.AI
{ {
return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterInvincible() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget())); return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterInvincible() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget()));
} }
public static ClientCard GetImmuneTrapMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards.FirstOrDefault(card => card?.Data != null && card.IsMonsterImmuneTrap() && card.IsFaceup() && (!canBeTarget || !card.IsShouldNotBeTarget()));
}
public static ClientCard GetDangerousMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false) public static ClientCard GetDangerousMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{ {
......
...@@ -18,9 +18,10 @@ namespace WindBot.Game.AI.Decks ...@@ -18,9 +18,10 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, ImFeelingLucky); AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, ImFeelingUnlucky); AddExecutor(ExecutorType.SpSummon, ImFeelingUnlucky);
AddExecutor(ExecutorType.Activate, ImFeelingUnlucky); AddExecutor(ExecutorType.Activate, ImFeelingUnlucky);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLazy);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Activate, _CardId.苍救升, 苍救升Effect);
AddExecutor(ExecutorType.Activate, _CardId.苍救降, 苍救降Effect);
AddExecutor(ExecutorType.Activate, _CardId.传说战士, 传说战士Effect);
AddExecutor(ExecutorType.Activate, _CardId.海龙骑士, 海龙骑士Effect); AddExecutor(ExecutorType.Activate, _CardId.海龙骑士, 海龙骑士Effect);
AddExecutor(ExecutorType.Activate, _CardId.大风暴, 大风暴Effect); AddExecutor(ExecutorType.Activate, _CardId.大风暴, 大风暴Effect);
AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect); AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect);
...@@ -31,6 +32,9 @@ namespace WindBot.Game.AI.Decks ...@@ -31,6 +32,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, _CardId.暗黑释放, 圣防Effect); AddExecutor(ExecutorType.Activate, _CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.手枪龙, 手枪龙Effect); AddExecutor(ExecutorType.Activate, _CardId.手枪龙, 手枪龙Effect);
AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Eff); AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Eff);
//AddExecutor(ExecutorType.Activate, _CardId.升阵, 装备act);
//AddExecutor(ExecutorType.Activate, _CardId.苍救之证, 装备act);
AddExecutor(ExecutorType.Activate, 装备Effect);
AddExecutor(ExecutorType.Activate, _CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon); AddExecutor(ExecutorType.Activate, _CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
AddExecutor(ExecutorType.Activate, _CardId.CosmicCyclone, DefaultCosmicCyclone); AddExecutor(ExecutorType.Activate, _CardId.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, _CardId.GalaxyCyclone, DefaultGalaxyCyclone); AddExecutor(ExecutorType.Activate, _CardId.GalaxyCyclone, DefaultGalaxyCyclone);
...@@ -60,7 +64,9 @@ namespace WindBot.Game.AI.Decks ...@@ -60,7 +64,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, _CardId.AllureofDarkness, DefaultAllureofDarkness); AddExecutor(ExecutorType.Activate, _CardId.AllureofDarkness, DefaultAllureofDarkness);
AddExecutor(ExecutorType.Activate, _CardId.DimensionalBarrier, DefaultDimensionalBarrier); AddExecutor(ExecutorType.Activate, _CardId.DimensionalBarrier, DefaultDimensionalBarrier);
AddExecutor(ExecutorType.Activate, _CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber); AddExecutor(ExecutorType.Activate, _CardId.InterruptedKaijuSlumber, DefaultInterruptedKaijuSlumber);
AddExecutor(ExecutorType.Summon, _CardId.苍救降);
AddExecutor(ExecutorType.Summon, _CardId.苍救升);
AddExecutor(ExecutorType.SummonOrSet, ImFeelingLazy);
AddExecutor(ExecutorType.SpSummon, _CardId.JizukirutheStarDestroyingKaiju, DefaultKaijuSpsummon); AddExecutor(ExecutorType.SpSummon, _CardId.JizukirutheStarDestroyingKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GadarlatheMysteryDustKaiju, DefaultKaijuSpsummon); AddExecutor(ExecutorType.SpSummon, _CardId.GadarlatheMysteryDustKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon); AddExecutor(ExecutorType.SpSummon, _CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
...@@ -91,6 +97,7 @@ namespace WindBot.Game.AI.Decks ...@@ -91,6 +97,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, _CardId.ExodiaTheForbiddenOne, JustDontIt); AddExecutor(ExecutorType.Summon, _CardId.ExodiaTheForbiddenOne, JustDontIt);
AddExecutor(ExecutorType.Activate, _CardId.死苏, 死苏Effect); AddExecutor(ExecutorType.Activate, _CardId.死苏, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.死苏2, 死苏Effect); AddExecutor(ExecutorType.Activate, _CardId.死苏2, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.斗牛士, 斗牛士Effect);
AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Effect); AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Effect);
AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神1Effect); AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神1Effect);
AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神Effect); AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神Effect);
...@@ -98,6 +105,7 @@ namespace WindBot.Game.AI.Decks ...@@ -98,6 +105,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.MonsterSet, _CardId.千年盾, DefaultMonsterSummon); AddExecutor(ExecutorType.MonsterSet, _CardId.千年盾, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, _CardId.死供, 死供Effect); AddExecutor(ExecutorType.Activate, _CardId.死供, 死供Effect);
AddExecutor(ExecutorType.Activate, _CardId.耳语妖精, 耳语妖精Effect); AddExecutor(ExecutorType.Activate, _CardId.耳语妖精, 耳语妖精Effect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, 圣防Repos); AddExecutor(ExecutorType.Repos, 圣防Repos);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet); AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
...@@ -113,7 +121,10 @@ namespace WindBot.Game.AI.Decks ...@@ -113,7 +121,10 @@ namespace WindBot.Game.AI.Decks
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
}; };
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int> private List<int> HintMsgForSelf = new List<int>
{ {
HintMsg.Equip HintMsg.Equip
...@@ -126,7 +137,7 @@ namespace WindBot.Game.AI.Decks ...@@ -126,7 +137,7 @@ namespace WindBot.Game.AI.Decks
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
}; };
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
...@@ -168,6 +179,19 @@ namespace WindBot.Game.AI.Decks ...@@ -168,6 +179,19 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card); cards.Remove(card);
} }
} }
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint)) if (HintMsgForSelf.Contains(hint))
{ {
...@@ -239,12 +263,13 @@ namespace WindBot.Game.AI.Decks ...@@ -239,12 +263,13 @@ namespace WindBot.Game.AI.Decks
private bool ImFeelingLucky() private bool ImFeelingLucky()
{ {
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself();
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself() && !Card.HasType(CardType.Equip);
} }
private bool ImFeelingUnlucky() private bool ImFeelingUnlucky()
{ {
return DefaultDontChainMyself(); return DefaultDontChainMyself() && !Card.HasType(CardType.Equip);
} }
private bool ImFeelingLazy() private bool ImFeelingLazy()
......
...@@ -75,34 +75,61 @@ namespace WindBot.Game.AI.Decks ...@@ -75,34 +75,61 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.幻刃封锁, 幻刃封锁Effect); AddExecutor(ExecutorType.Activate, CardId.幻刃封锁, 幻刃封锁Effect);
AddExecutor(ExecutorType.Activate, CardId.幻刃急攻, 幻刃急攻Effect); AddExecutor(ExecutorType.Activate, CardId.幻刃急攻, 幻刃急攻Effect);
AddExecutor(ExecutorType.Activate, CardId.透幻乡险峻); AddExecutor(ExecutorType.Activate, CardId.透幻乡险峻);
AddExecutor(ExecutorType.Activate, _CardId.破灭之龙魔导士, 破灭之龙魔导士Effect);
AddExecutor(ExecutorType.Activate, _CardId.星战骑佩流安, 星战骑佩流安Effect);
AddExecutor(ExecutorType.Activate, _CardId.加百列热茶, 加百列热茶Effect);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, 圣防Repos); AddExecutor(ExecutorType.Repos, 圣防Repos);
AddExecutor(ExecutorType.SpellSet, TrapCardSet); AddExecutor(ExecutorType.SpellSet, TrapCardSet);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
} }
private List<int> HintMsgForEnemy = new List<int> private List<int> HintMsgForEnemy = new List<int>
{ {
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck, HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
}; };
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
}; };
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{ {
if (Duel.Phase == DuelPhase.BattleStart) if (Duel.Phase == DuelPhase.BattleStart)
return null; return null;
if (AI.HaveSelectedCards()) if (AI.HaveSelectedCards())
return null; return null;
IList<ClientCard> selected = new List<ClientCard>(); IList<ClientCard> selected = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>(_cards); IList<ClientCard> cards = new List<ClientCard>(_cards);
if (max > cards.Count) if (max > cards.Count)
max = cards.Count; max = cards.Count;
if (HintMsgForEnemy.Contains(hint)) if (HintMsgForEnemy.Contains(hint))
{ {
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList(); IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList();
// select enemy's card first // select enemy's card first
while (enemyCards.Count > 0 && selected.Count < max) while (enemyCards.Count > 0 && selected.Count < max)
{ {
...@@ -112,6 +139,70 @@ namespace WindBot.Game.AI.Decks ...@@ -112,6 +139,70 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card); cards.Remove(card);
} }
} }
if (HintMsgForDeck.Contains(hint))
{
IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint)) if (HintMsgForMaxSelect.Contains(hint))
{ {
// select max cards // select max cards
...@@ -122,9 +213,30 @@ namespace WindBot.Game.AI.Decks ...@@ -122,9 +213,30 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card); cards.Remove(card);
} }
} }
return selected; return selected;
} }
public override bool OnSelectHand()
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
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.FaceUpAttack;
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override bool OnSelectHand()
{ {
// go first // go first
return true; return true;
......
...@@ -35,12 +35,14 @@ namespace WindBot.Game.AI.Decks ...@@ -35,12 +35,14 @@ namespace WindBot.Game.AI.Decks
public const int 对死者的供奉 = 120151023; public const int 对死者的供奉 = 120151023;
public const int 落穴 = 120150019; public const int 落穴 = 120150019;
public const int 暗黑释放 = 120105013; public const int 暗黑释放 = 120105013;
public const int 七魔导枪 = 120228050;
} }
public MokeyMokeyExecutor(GameAI ai, Duel duel) public MokeyMokeyExecutor(GameAI ai, Duel duel)
: base(ai, duel) : base(ai, duel)
{ {
AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect); AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect);
AddExecutor(ExecutorType.Activate, _CardId.强欲之壶);
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos); AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, CardId.侏儒兔,侏儒兔Effect); AddExecutor(ExecutorType.Activate, CardId.侏儒兔,侏儒兔Effect);
...@@ -58,8 +60,9 @@ namespace WindBot.Game.AI.Decks ...@@ -58,8 +60,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.神秘庄家); AddExecutor(ExecutorType.Summon, CardId.神秘庄家);
AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon); AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect); AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect);
AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放, 圣防Effect); AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放);
AddExecutor(ExecutorType.SpellSet, CardId.落穴); AddExecutor(ExecutorType.SpellSet, CardId.落穴);
AddExecutor(ExecutorType.Activate, CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect); AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect);
AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect); AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect);
AddExecutor(ExecutorType.Activate, CardId.落穴, 落穴Effect); AddExecutor(ExecutorType.Activate, CardId.落穴, 落穴Effect);
...@@ -78,7 +81,7 @@ namespace WindBot.Game.AI.Decks ...@@ -78,7 +81,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, _CardId.结界像); AddExecutor(ExecutorType.Summon, _CardId.结界像);
AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon); AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, CardId.七魔导枪, 七魔导枪Effect);
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect); //AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
AddExecutor(ExecutorType.Activate, CardId.耳语妖精, 耳语妖精Effect); AddExecutor(ExecutorType.Activate, CardId.耳语妖精, 耳语妖精Effect);
...@@ -86,23 +89,42 @@ namespace WindBot.Game.AI.Decks ...@@ -86,23 +89,42 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.连击龙); AddExecutor(ExecutorType.Activate, CardId.连击龙);
AddExecutor(ExecutorType.Activate, CardId.七星道魔术师); AddExecutor(ExecutorType.Activate, CardId.七星道魔术师);
AddExecutor(ExecutorType.Activate, CardId.斗牛士, 斗牛士Effect); AddExecutor(ExecutorType.Activate, CardId.斗牛士, 斗牛士Effect);
AddExecutor(ExecutorType.Activate, _CardId.破灭之龙魔导士, 破灭之龙魔导士Effect);
AddExecutor(ExecutorType.Activate, _CardId.星战骑佩流安, 星战骑佩流安Effect);
AddExecutor(ExecutorType.Activate, _CardId.加百列热茶, 加百列热茶Effect);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos); AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos); AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos);
} }
private List<int> HintMsgForEnemy = new List<int> private List<int> HintMsgForEnemy = new List<int>
{ {
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck, HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
}; };
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
}; };
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
...@@ -131,6 +153,69 @@ namespace WindBot.Game.AI.Decks ...@@ -131,6 +153,69 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (HintMsgForDeck.Contains(hint))
{
IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint)) if (HintMsgForMaxSelect.Contains(hint))
{ {
// select max cards // select max cards
...@@ -144,6 +229,25 @@ namespace WindBot.Game.AI.Decks ...@@ -144,6 +229,25 @@ namespace WindBot.Game.AI.Decks
return selected; return selected;
} }
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
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.FaceUpAttack;
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
// go first // go first
...@@ -169,7 +273,12 @@ namespace WindBot.Game.AI.Decks ...@@ -169,7 +273,12 @@ namespace WindBot.Game.AI.Decks
return false; return false;
return true; return true;
} }
private bool 七魔导枪Effect()
{
if (Bot.HasInMonstersZone(CardId.七星道魔术师))
AI.SelectCard(CardId.七星道魔术师);
return true;
}
private bool 火星心少女Effect() private bool 火星心少女Effect()
{ {
foreach (ClientCard m in Bot.Hand) foreach (ClientCard m in Bot.Hand)
...@@ -240,7 +349,7 @@ namespace WindBot.Game.AI.Decks ...@@ -240,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) && if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) &&
Bot.MonsterZone.GetMatchingCardsCount(card => card.Level > 4) < 2 && Bot.MonsterZone.GetMatchingCardsCount(card => card.Level > 4) < 2 &&
(Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) <= 2) (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) >= 2)
{ {
return true; return true;
} }
......
...@@ -48,6 +48,7 @@ namespace WindBot.Game.AI.Decks ...@@ -48,6 +48,7 @@ namespace WindBot.Game.AI.Decks
{ {
AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect); AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect);
AddExecutor(ExecutorType.Activate, _CardId.疾风弹, 疾风弹Effect); AddExecutor(ExecutorType.Activate, _CardId.疾风弹, 疾风弹Effect);
AddExecutor(ExecutorType.Activate, _CardId.强欲之壶);
AddExecutor(ExecutorType.SpSummon); AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, CardId.七星道法师, 七星道法师Effect); AddExecutor(ExecutorType.Activate, CardId.七星道法师, 七星道法师Effect);
AddExecutor(ExecutorType.Activate, CardId.侏儒兔, 侏儒兔Effect); AddExecutor(ExecutorType.Activate, CardId.侏儒兔, 侏儒兔Effect);
...@@ -64,8 +65,9 @@ namespace WindBot.Game.AI.Decks ...@@ -64,8 +65,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.神秘庄家); AddExecutor(ExecutorType.Summon, CardId.神秘庄家);
AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon); AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect); AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect);
AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放, 圣防Effect); AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放);
AddExecutor(ExecutorType.SpellSet, CardId.落穴); AddExecutor(ExecutorType.SpellSet, CardId.落穴);
AddExecutor(ExecutorType.Activate, CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect); AddExecutor(ExecutorType.Activate, _CardId.魔法筒, 魔法筒Effect);
AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect); AddExecutor(ExecutorType.Activate, _CardId.炸甲, 炸甲Effect);
AddExecutor(ExecutorType.Activate, CardId.落穴, 落穴Effect); AddExecutor(ExecutorType.Activate, CardId.落穴, 落穴Effect);
...@@ -91,6 +93,9 @@ namespace WindBot.Game.AI.Decks ...@@ -91,6 +93,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.连击龙); AddExecutor(ExecutorType.Activate, CardId.连击龙);
AddExecutor(ExecutorType.Activate, CardId.七星道魔术师); AddExecutor(ExecutorType.Activate, CardId.七星道魔术师);
AddExecutor(ExecutorType.Activate, CardId.斗牛士, 斗牛士Effect); AddExecutor(ExecutorType.Activate, CardId.斗牛士, 斗牛士Effect);
AddExecutor(ExecutorType.Activate, _CardId.破灭之龙魔导士, 破灭之龙魔导士Effect);
AddExecutor(ExecutorType.Activate, _CardId.星战骑佩流安, 星战骑佩流安Effect);
AddExecutor(ExecutorType.Activate, _CardId.加百列热茶, 加百列热茶Effect);
AddExecutor(ExecutorType.Activate, _CardId.死苏, 死苏Effect); AddExecutor(ExecutorType.Activate, _CardId.死苏, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.死苏2, 死苏Effect); AddExecutor(ExecutorType.Activate, _CardId.死苏2, 死苏Effect);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
...@@ -98,15 +103,33 @@ namespace WindBot.Game.AI.Decks ...@@ -98,15 +103,33 @@ namespace WindBot.Game.AI.Decks
} }
private List<int> HintMsgForEnemy = new List<int> private List<int> HintMsgForEnemy = new List<int>
{ {
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck, HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
}; };
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
}; };
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
...@@ -135,6 +158,69 @@ namespace WindBot.Game.AI.Decks ...@@ -135,6 +158,69 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (HintMsgForDeck.Contains(hint))
{
IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint)) if (HintMsgForMaxSelect.Contains(hint))
{ {
// select max cards // select max cards
...@@ -145,8 +231,28 @@ namespace WindBot.Game.AI.Decks ...@@ -145,8 +231,28 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card); cards.Remove(card);
} }
} }
return selected; return selected;
} }
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
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.FaceUpAttack;
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
// go first // go first
...@@ -243,7 +349,7 @@ namespace WindBot.Game.AI.Decks ...@@ -243,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{ {
if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) && if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) &&
Bot.MonsterZone.GetMatchingCardsCount(card => card.Level > 4) < 2 && Bot.MonsterZone.GetMatchingCardsCount(card => card.Level > 4) < 2 &&
(Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) <= 2) (Bot.MonsterZone.GetMatchingCardsCount(card => card.Level < 5) + Bot.Hand.GetMatchingCardsCount(card => card.Level < 5)) >= 2)
{ {
return true; return true;
} }
......
...@@ -123,16 +123,33 @@ namespace WindBot.Game.AI.Decks ...@@ -123,16 +123,33 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, CardId.钢机神, 圣防Repos); AddExecutor(ExecutorType.Repos, CardId.钢机神, 圣防Repos);
} }
private List<int> HintMsgForEnemy = new List<int> private List<int> HintMsgForEnemy = new List<int>
{ {
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck, HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
}; };
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
}; };
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
...@@ -161,17 +178,99 @@ namespace WindBot.Game.AI.Decks ...@@ -161,17 +178,99 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (HintMsgForMaxSelect.Contains(hint)) if (HintMsgForDeck.Contains(hint))
{ {
//select max cards IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint))
{
// select max cards
while (selected.Count < max) while (selected.Count < max)
{ {
ClientCard card = cards[Program.Rand.Next(cards.Count)]; ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card); selected.Add(card);
cards.Remove(card); cards.Remove(card);
} }
} }
return selected;
return selected;
}
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
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.FaceUpAttack;
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
} }
public override bool OnSelectHand() public override bool OnSelectHand()
......
...@@ -104,6 +104,9 @@ namespace WindBot.Game.AI.Decks ...@@ -104,6 +104,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.MonsterSet, CardId.机器栗子); AddExecutor(ExecutorType.MonsterSet, CardId.机器栗子);
AddExecutor(ExecutorType.MonsterSet, CardId.成金恐龙王); AddExecutor(ExecutorType.MonsterSet, CardId.成金恐龙王);
AddExecutor(ExecutorType.Activate, CardId.古之规则); AddExecutor(ExecutorType.Activate, CardId.古之规则);
AddExecutor(ExecutorType.Activate, _CardId.破灭之龙魔导士, 破灭之龙魔导士Effect);
AddExecutor(ExecutorType.Activate, _CardId.星战骑佩流安, 星战骑佩流安Effect);
AddExecutor(ExecutorType.Activate, _CardId.加百列热茶, 加百列热茶Effect);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself); AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos); AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos); AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos);
...@@ -111,20 +114,35 @@ namespace WindBot.Game.AI.Decks ...@@ -111,20 +114,35 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpellSet); AddExecutor(ExecutorType.SpellSet);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect); //AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
} }
private List<int> HintMsgForEnemy = new List<int> private List<int> HintMsgForEnemy = new List<int>
{ {
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck, HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Disable
}; };
private List<int> HintMsgForDeck = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForExtra = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.Remove, HintMsg.AddToHand, HintMsg.FusionMaterial
};
private List<int> HintMsgForSelf = new List<int>
{
HintMsg.Equip
};
private List<int> HintMsgForMaterial = new List<int>
{
HintMsg.FusionMaterial, HintMsg.SynchroMaterial, HintMsg.XyzMaterial, HintMsg.LinkMaterial, HintMsg.Release
};
private List<int> HintMsgForMaxSelect = new List<int> private List<int> HintMsgForMaxSelect = new List<int>
{ {
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.ToDeck, HintMsg.Destroy HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy, HintMsg.Equip ,HintMsg.Confirm
}; };
public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable) public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
...@@ -153,6 +171,69 @@ namespace WindBot.Game.AI.Decks ...@@ -153,6 +171,69 @@ namespace WindBot.Game.AI.Decks
} }
} }
if (HintMsgForDeck.Contains(hint))
{
IList<ClientCard> deckCards = cards.Where(card => card.Location == CardLocation.Deck).ToList();
// select deck's card first
while (deckCards.Count > 0 && selected.Count < max)
{
ClientCard card = deckCards[Program.Rand.Next(deckCards.Count)];
selected.Add(card);
deckCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForExtra.Contains(hint))
{
IList<ClientCard> ExtraCards = cards.Where(card => card.Location == CardLocation.Extra).ToList();
// select extra's card first
while (ExtraCards.Count > 0 && selected.Count < max)
{
ClientCard card = ExtraCards[Program.Rand.Next(ExtraCards.Count)];
selected.Add(card);
ExtraCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForSelf.Contains(hint))
{
IList<ClientCard> botCards = cards.Where(card => card.Controller == 0).ToList();
// select bot's card first
while (botCards.Count > 0 && selected.Count < max)
{
ClientCard card = botCards[Program.Rand.Next(botCards.Count)];
selected.Add(card);
botCards.Remove(card);
cards.Remove(card);
}
}
if (HintMsgForMaterial.Contains(hint))
{
IList<ClientCard> materials = cards.OrderBy(card => card.Attack).ToList();
// select low attack first
while (materials.Count > 0 && selected.Count < min)
{
ClientCard card = materials[0];
selected.Add(card);
materials.Remove(card);
cards.Remove(card);
}
}
// select random cards
while (selected.Count < min)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
if (HintMsgForMaxSelect.Contains(hint)) if (HintMsgForMaxSelect.Contains(hint))
{ {
// select max cards // select max cards
...@@ -166,6 +247,25 @@ namespace WindBot.Game.AI.Decks ...@@ -166,6 +247,25 @@ namespace WindBot.Game.AI.Decks
return selected; return selected;
} }
public override int OnSelectOption(IList<int> options)
{
return Program.Rand.Next(options.Count);
}
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.FaceUpAttack;
if (cardData.Attack <= 1000)
return CardPosition.FaceUpDefence;
}
return 0;
}
public override bool OnSelectHand() public override bool OnSelectHand()
{ {
// go first // go first
......
This diff is collapsed.
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