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
{
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)
{
......
......@@ -18,9 +18,10 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, ImFeelingLucky);
AddExecutor(ExecutorType.SpSummon, 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);
......@@ -31,6 +32,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, _CardId.暗黑释放, 圣防Effect);
AddExecutor(ExecutorType.Activate, _CardId.手枪龙, 手枪龙Effect);
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.CosmicCyclone, DefaultCosmicCyclone);
AddExecutor(ExecutorType.Activate, _CardId.GalaxyCyclone, DefaultGalaxyCyclone);
......@@ -60,7 +64,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, _CardId.AllureofDarkness, DefaultAllureofDarkness);
AddExecutor(ExecutorType.Activate, _CardId.DimensionalBarrier, DefaultDimensionalBarrier);
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.GadarlatheMysteryDustKaiju, DefaultKaijuSpsummon);
AddExecutor(ExecutorType.SpSummon, _CardId.GamecieltheSeaTurtleKaiju, DefaultKaijuSpsummon);
......@@ -91,6 +97,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, _CardId.ExodiaTheForbiddenOne, JustDontIt);
AddExecutor(ExecutorType.Activate, _CardId.死苏, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.死苏2, 死苏Effect);
AddExecutor(ExecutorType.Activate, _CardId.斗牛士, 斗牛士Effect);
AddExecutor(ExecutorType.Activate, _CardId.最强战旗, 最强战旗Effect);
AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神1Effect);
AddExecutor(ExecutorType.Activate, _CardId.钢机神, 钢机神Effect);
......@@ -98,6 +105,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.MonsterSet, _CardId.千年盾, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, _CardId.死供, 死供Effect);
AddExecutor(ExecutorType.Activate, _CardId.耳语妖精, 耳语妖精Effect);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, 圣防Repos);
AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);
......@@ -113,7 +121,10 @@ namespace WindBot.Game.AI.Decks
{
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
......@@ -126,7 +137,7 @@ namespace WindBot.Game.AI.Decks
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)
......@@ -168,6 +179,19 @@ namespace WindBot.Game.AI.Decks
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))
{
......@@ -239,12 +263,13 @@ namespace WindBot.Game.AI.Decks
private bool ImFeelingLucky()
{
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself();
return Program.Rand.Next(10) >= 5 && DefaultDontChainMyself() && !Card.HasType(CardType.Equip);
}
private bool ImFeelingUnlucky()
{
return DefaultDontChainMyself();
return DefaultDontChainMyself() && !Card.HasType(CardType.Equip);
}
private bool ImFeelingLazy()
......
......@@ -75,34 +75,61 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Activate, CardId.幻刃封锁, 幻刃封锁Effect);
AddExecutor(ExecutorType.Activate, CardId.幻刃急攻, 幻刃急攻Effect);
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.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Repos, 圣防Repos);
AddExecutor(ExecutorType.SpellSet, TrapCardSet);
AddExecutor(ExecutorType.SpellSet);
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
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>
{
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)
{
if (Duel.Phase == DuelPhase.BattleStart)
return null;
if (AI.HaveSelectedCards())
return null;
IList<ClientCard> selected = new List<ClientCard>();
IList<ClientCard> cards = new List<ClientCard>(_cards);
if (max > cards.Count)
max = cards.Count;
if (HintMsgForEnemy.Contains(hint))
{
IList<ClientCard> enemyCards = cards.Where(card => card.Controller == 1).ToList();
// select enemy's card first
while (enemyCards.Count > 0 && selected.Count < max)
{
......@@ -112,6 +139,70 @@ namespace WindBot.Game.AI.Decks
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))
{
// select max cards
......@@ -122,8 +213,29 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card);
}
}
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()
{
// go first
......
......@@ -35,12 +35,14 @@ namespace WindBot.Game.AI.Decks
public const int 对死者的供奉 = 120151023;
public const int 落穴 = 120150019;
public const int 暗黑释放 = 120105013;
public const int 七魔导枪 = 120228050;
}
public MokeyMokeyExecutor(GameAI ai, Duel duel)
: base(ai, duel)
{
AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect);
AddExecutor(ExecutorType.Activate, _CardId.强欲之壶);
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);
AddExecutor(ExecutorType.Activate, CardId.侏儒兔,侏儒兔Effect);
......@@ -58,8 +60,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.神秘庄家);
AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect);
AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放, 圣防Effect);
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);
......@@ -78,7 +81,7 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, _CardId.结界像);
AddExecutor(ExecutorType.SummonOrSet, DefaultMonsterSummon);
AddExecutor(ExecutorType.Activate, CardId.七魔导枪, 七魔导枪Effect);
AddExecutor(ExecutorType.SpellSet);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
AddExecutor(ExecutorType.Activate, CardId.耳语妖精, 耳语妖精Effect);
......@@ -86,23 +89,42 @@ namespace WindBot.Game.AI.Decks
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, DefaultDontChainMyself);
AddExecutor(ExecutorType.Repos, CardId.青眼白龙, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos);
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
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>
{
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)
......@@ -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))
{
// select max cards
......@@ -144,6 +229,25 @@ namespace WindBot.Game.AI.Decks
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()
{
// go first
......@@ -169,7 +273,12 @@ namespace WindBot.Game.AI.Decks
return false;
return true;
}
private bool 七魔导枪Effect()
{
if (Bot.HasInMonstersZone(CardId.七星道魔术师))
AI.SelectCard(CardId.七星道魔术师);
return true;
}
private bool 火星心少女Effect()
{
foreach (ClientCard m in Bot.Hand)
......@@ -240,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) &&
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;
}
......
......@@ -48,6 +48,7 @@ namespace WindBot.Game.AI.Decks
{
AddExecutor(ExecutorType.Activate, _CardId.黑洞, 黑洞Effect);
AddExecutor(ExecutorType.Activate, _CardId.疾风弹, 疾风弹Effect);
AddExecutor(ExecutorType.Activate, _CardId.强欲之壶);
AddExecutor(ExecutorType.SpSummon);
AddExecutor(ExecutorType.Activate, CardId.七星道法师, 七星道法师Effect);
AddExecutor(ExecutorType.Activate, CardId.侏儒兔, 侏儒兔Effect);
......@@ -64,8 +65,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Summon, CardId.神秘庄家);
AddExecutor(ExecutorType.Summon, CardId.侏儒兔, 侏儒兔Summon);
AddExecutor(ExecutorType.Activate, CardId.神秘庄家, draweffect);
AddExecutor(ExecutorType.SpellSet, CardId.暗黑释放, 圣防Effect);
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);
......@@ -91,6 +93,9 @@ namespace WindBot.Game.AI.Decks
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.死苏2, 死苏Effect);
AddExecutor(ExecutorType.Activate, DefaultDontChainMyself);
......@@ -98,15 +103,33 @@ namespace WindBot.Game.AI.Decks
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
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>
{
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)
......@@ -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))
{
// select max cards
......@@ -145,8 +231,28 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card);
}
}
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()
{
// go first
......@@ -243,7 +349,7 @@ namespace WindBot.Game.AI.Decks
{
if (Bot.HasInGraveyard(new[] { CardId.连击龙, CardId.青眼白龙 }) &&
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;
}
......
......@@ -123,16 +123,33 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.Repos, CardId.钢机神, 圣防Repos);
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
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>
{
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)
......@@ -161,9 +178,72 @@ 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))
{
//select max cards
// select max cards
while (selected.Count < max)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
......@@ -171,9 +251,28 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card);
}
}
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()
{
// go first
......
......@@ -104,6 +104,9 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.MonsterSet, CardId.机器栗子);
AddExecutor(ExecutorType.MonsterSet, 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.Repos, CardId.青眼白龙, 圣防Repos);
AddExecutor(ExecutorType.Repos, CardId.破坏之剑士, 圣防Repos);
......@@ -111,20 +114,35 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpellSet);
//AddExecutor(ExecutorType.Activate, CardId.sionmax, sionmaxEffect);
}
private List<int> HintMsgForEnemy = new List<int>
{
HintMsg.Release, HintMsg.Destroy, HintMsg.Remove, HintMsg.ToGrave, HintMsg.ReturnToHand, HintMsg.ToDeck,
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>
{
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)
......@@ -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))
{
// select max cards
......@@ -166,6 +247,25 @@ namespace WindBot.Game.AI.Decks
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()
{
// go first
......
......@@ -12,7 +12,19 @@ namespace WindBot.Game.AI
{
protected class _CardId
{
public const int 暗黑释放 = 120105013;
public const int 海龙骑士 = 120199032;
public const int 耳语妖精 = 120120018;
public const int 斗牛士 = 120170035;
public const int 结界像 = 120226013;
public const int 终焰魔神 = 120231008;
public const int 最强战旗 = 120181001;
public const int 钢机神 = 120155015;
public const int 破灭之龙魔导士 = 120231049;
public const int 星战骑佩流安 = 120109014;
public const int 加百列热茶 = 120151039;
public const int 武枪 = 120231052;
public const int 连击龙 = 120110001;
public const int 死苏 = 120194004;
public const int 死苏2 = 120195004;
public const int 死供 = 120151023;
......@@ -24,10 +36,10 @@ namespace WindBot.Game.AI
public const int 激流葬 = 1202223105;
public const int 炸甲 = 120194005;
public const int 落穴 = 120150019;
public const int 暗黑释放 = 120105013;
public const int 疾风弹 = 120203028;
public const int HMD = 120130041;
public const int 海龙骑士 = 120199032;
public const int 耳语妖精 = 120120018;
public const int 人造人 = 120155000;
public const int 狼人 = 120214004;
public const int 幻影之龙 = 120223102;
......@@ -36,14 +48,24 @@ namespace WindBot.Game.AI
public const int 青眼白龙 = 120120000;
public const int 黑魔术师 = 120130000;
public const int 破坏之剑士 = 120170000;
public const int 连击龙 = 120110001;
public const int 千年盾 = 120194001;
public const int 血腥魔兽人 = 120194002;
public const int 圣精灵 = 120194003;
public const int 结界像 = 120226013;
public const int 终焰魔神 = 120231008;
public const int 最强战旗 = 120181001;
public const int 钢机神 = 120155015;
public const int 苍救升 = 120235025;
public const int 苍救降 = 120235024;
public const int 苍救之闪光 = 120235038;
public const int 苍救之泡影 = 120235039;
public const int 苍救之一闪 = 120235040;
public const int 苍救之幻影 = 120235041;
public const int 天翔流那 = 120203011;
public const int 天翔流丽雅 = 120199036;
public const int 天翔流丽谢 = 120205036;
public const int 传说战士 = 120235029;
public const int 升阵 = 120228059;
public const int 苍救之证 = 120235054;
public const int JizukirutheStarDestroyingKaiju = 63941210;
public const int ThunderKingtheLightningstrikeKaiju = 48770333;
public const int DogorantheMadFlameKaiju = 93332803;
......@@ -354,6 +376,57 @@ namespace WindBot.Game.AI
return true;
}
protected bool 传说战士Effect()
{
IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard card in Bot.GetGraveyardSpells())
{
if (card.HasType(CardType.Equip))
targets.Add(card);
}
AI.SelectCard(targets);
return true;
}
protected bool 苍救升Effect()
{
IList<ClientCard> targets = new List<ClientCard>();
foreach (ClientCard card in Bot.GetMonstersInExtraZone())
{
if (card.Level == 9)
targets.Add(card);
}
AI.SelectCard(targets);
return true;
}
protected bool 苍救降Effect()
{
ClientCard e = Util.GetBestEnemyMonster(true, true);
IList<int> targets = new[] { _CardId.苍救之泡影, _CardId.苍救之一闪, _CardId.苍救之闪光, _CardId.苍救之幻影, _CardId.天翔流那, _CardId.天翔流丽谢, _CardId.天翔流丽雅 };
AI.SelectCard(targets);
//AI.SelectCard(_CardId.苍救之泡影 , _CardId.苍救之一闪 , _CardId.苍救之闪光 ,_CardId.苍救之幻影 , _CardId.天翔流那 , _CardId.天翔流丽谢 , _CardId.天翔流丽雅);
// AI.SelectNextCard(e);
return true;
}
protected bool 星战骑佩流安Effect()
{
AI.SelectCard(Bot.GetMonsters().GetHighestAttackMonster());
AI.SelectNextCard(Enemy.GetMonsters().GetLowestLevelMonster());
return true;
}
protected bool 加百列热茶Effect()
{
foreach (ClientCard m in Bot.Hand)
AI.SelectCard(m);
AI.SelectNextCard(Bot.GetMonsters().GetHighestAttackMonster());
return true;
}
protected bool 破灭之龙魔导士Effect()
{
foreach (ClientCard m in Bot.GetGraveyardMonsters())
AI.SelectCard(m);
AI.SelectNextCard(Bot.GetMonsters().GetHighestAttackMonster());
return true;
}
protected bool 斗牛士Effect()
{
{
......@@ -363,7 +436,6 @@ namespace WindBot.Game.AI
AI.SelectNextCard(Enemy.MonsterZone.GetHighestAttackMonster());
return true;
}
}
protected bool 海龙骑士Effect()
{
......@@ -471,13 +543,81 @@ namespace WindBot.Game.AI
protected bool 圣防Repos()
{
if (Enemy.Graveyard.GetMatchingCardsCount(card => (card.Race & (int)CardRace.SpellCaster) > 0) >= 4 && Enemy.GetSpellCountWithoutField() >= 1
&& !Bot.HasInMonstersZone(new[]{_CardId.人造人, _CardId.狼人, _CardId.幻影之龙}) && Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(_CardId.暗黑释放)) < 3)
&& !Bot.HasInMonstersZone(new[]{_CardId.人造人, _CardId.狼人, _CardId.武枪, _CardId.幻影之龙}) && Enemy.Graveyard.GetMatchingCardsCount(card => card.IsCode(_CardId.暗黑释放)) < 3)
{
if (Bot.MonsterZone.GetMatchingCardsCount(card => card.IsAttack() && card.Level > 5) >= 2 && !Bot.HasDefendingMonster())
return true;
}
return false;
}
protected bool 装备Effect()
{
//if (Executors.Any(exec => exec.Type == Type && exec.CardId == Card.Id))
// return false;
if (!Card.HasType(CardType.Equip))
return false;
List<ClientCard> cards = new List<ClientCard>(Bot.MonsterZone.GetMonsters());
cards.Sort(CardContainer.CompareCardLevel);
ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if (card.Level < 5)
break;
if (card.IsMonster())
{
selectedCard = card;
break;
}
}
if (selectedCard != null)
{
AI.SelectCard(selectedCard);
return true;
}
return false;
/* ClientCard mon = Bot.MonsterZone.GetFirstMatchingCard(card => card.Level >= 6);
{
if (mon.Level >= 8)
AI.SelectCard(mon);
else if (mon.Level >= 6)
AI.SelectCard(mon);
else return false;
}
return Card.HasType(CardType.Equip);*/
}
protected bool 装备act()
{
List<ClientCard> cards = new List<ClientCard>(Bot.MonsterZone.GetMonsters());
cards.Sort(CardContainer.CompareCardLevel);
ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
{
ClientCard card = cards[i];
if (card.Level < 5)
break;
if (card.IsMonster())
{
selectedCard = card;
break;
}
}
if (selectedCard != null)
{
AI.SelectCard(selectedCard);
return true;
}
return false;
/* ClientCard mon = Bot.MonsterZone.GetFirstMatchingCard(card => card.Level >= 6);
{
if (mon.Level >= 8)
AI.SelectCard(mon);
else if (mon.Level >= 6)
AI.SelectCard(mon);
else return false;
}
return Card.HasType(CardType.Equip);*/
}
protected bool 死苏Effect()
{
......@@ -512,7 +652,7 @@ namespace WindBot.Game.AI
}
protected bool 死供Effect()
{
if (Util.IsOneEnemyBetterThanValue(1900, false))
if (Util.IsOneEnemyBetterThanValue(1900, false) && !Enemy.HasInMonstersZone(_CardId.终焰魔神))
{
foreach (ClientCard m in Bot.Hand)
AI.SelectCard(m);
......@@ -542,7 +682,7 @@ namespace WindBot.Game.AI
}
protected bool 圣防Effect()
{
if (Util.GetTotalAttackingMonsterAttack(1) > 1900 && !Enemy.BattlingMonster.IsMonsterImmuneTrap()) return true;
if (Util.GetTotalAttackingMonsterAttack(1) >= 1900 && (Enemy.GetMonsters().GetImmuneTrapMonster() == null)) return true;
if (Util.GetTotalAttackingMonsterAttack(1) - Util.GetTotalAttackingMonsterAttack(0) > Bot.LifePoints && !Bot.HasDefendingMonster()) return true;
return false;
}
......@@ -550,19 +690,19 @@ namespace WindBot.Game.AI
{
foreach (ClientCard n in Duel.LastSummonedCards)
{
if (n.Attack >= 1900) return true;
if (Util.GetTotalAttackingMonsterAttack(1) - Util.GetTotalAttackingMonsterAttack(0) > Bot.LifePoints && !Bot.HasDefendingMonster()) return true;
if (n.Attack >= 1900 && !n.IsCode(_CardId.武枪)) return true;
if (Util.GetTotalAttackingMonsterAttack(1) - Util.GetTotalAttackingMonsterAttack(0) > Bot.LifePoints && !Bot.HasDefendingMonster() && !n.IsCode(_CardId.武枪)) return true;
}
return false;
}
protected bool 激流葬Effect()
{
return !Util.HasChainedTrap(0) && Util.IsAllEnemyBetter(true);
return !Util.HasChainedTrap(0) && Util.IsAllEnemyBetter(true) && (Enemy.GetMonsters().GetImmuneTrapMonster() == null);
}
protected bool 炸甲Effect()
{
if (Enemy.BattlingMonster.Attack > 2000 && !Enemy.BattlingMonster.IsMonsterImmuneTrap()) return true;
if (Enemy.BattlingMonster.Attack > 2000 && (Enemy.GetMonsters().GetImmuneTrapMonster() == null)) return true;
if (Bot.LifePoints <= Enemy.BattlingMonster.Attack) return true;
if (!Util.IsOneEnemyBetterThanValue(1500, true) && Bot.GetSpellCountWithoutField() == 3) return true;
return false;
......
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