Commit fd9b4610 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:IceYGO/windbot

parents 621bce57 7299ea0d
...@@ -65,16 +65,16 @@ namespace WindBot.Game.AI.Decks ...@@ -65,16 +65,16 @@ namespace WindBot.Game.AI.Decks
AddExecutor(ExecutorType.SpSummon, _CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon); AddExecutor(ExecutorType.SpSummon, _CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightSummon);
AddExecutor(ExecutorType.Activate, _CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect); AddExecutor(ExecutorType.Activate, _CardId.EvilswarmExcitonKnight, DefaultEvilswarmExcitonKnightEffect);
AddExecutor(ExecutorType.Summon, _CardId.SandaionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.SandaionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.GabrionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.GabrionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.MichionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.MichionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.ZaphionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.ZaphionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.HailonTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.HailonTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.RaphionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.RaphionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.SadionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.SadionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.MetaionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.MetaionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.KamionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.KamionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.LazionTheTimelord); AddExecutor(ExecutorType.Summon, _CardId.LazionTheTimelord, DefaultTimelordSummon);
AddExecutor(ExecutorType.Summon, _CardId.LeftArmofTheForbiddenOne, JustDontIt); AddExecutor(ExecutorType.Summon, _CardId.LeftArmofTheForbiddenOne, JustDontIt);
AddExecutor(ExecutorType.Summon, _CardId.RightLegofTheForbiddenOne, JustDontIt); AddExecutor(ExecutorType.Summon, _CardId.RightLegofTheForbiddenOne, JustDontIt);
...@@ -89,6 +89,16 @@ namespace WindBot.Game.AI.Decks ...@@ -89,6 +89,16 @@ namespace WindBot.Game.AI.Decks
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> HintMsgForMaxSelect = new List<int>
{
HintMsg.SpSummon, HintMsg.ToGrave, HintMsg.AddToHand, HintMsg.FusionMaterial, HintMsg.Destroy
};
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)
...@@ -115,6 +125,20 @@ namespace WindBot.Game.AI.Decks ...@@ -115,6 +125,20 @@ 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);
}
}
// select random cards // select random cards
while (selected.Count < min) while (selected.Count < min)
{ {
...@@ -123,6 +147,17 @@ namespace WindBot.Game.AI.Decks ...@@ -123,6 +147,17 @@ namespace WindBot.Game.AI.Decks
cards.Remove(card); cards.Remove(card);
} }
if (HintMsgForMaxSelect.Contains(hint))
{
// select max cards
while (selected.Count < max)
{
ClientCard card = cards[Program.Rand.Next(cards.Count)];
selected.Add(card);
cards.Remove(card);
}
}
return selected; return selected;
} }
......
...@@ -741,7 +741,7 @@ namespace WindBot.Game.AI ...@@ -741,7 +741,7 @@ namespace WindBot.Game.AI
(4000 - Card.Defense) * 2 > (4000 - Card.Attack)) (4000 - Card.Defense) * 2 > (4000 - Card.Attack))
return true; return true;
bool enemyBetter = Util.IsAllEnemyBetter(true); bool enemyBetter = Util.IsAllEnemyBetter();
if (Card.IsAttack() && enemyBetter) if (Card.IsAttack() && enemyBetter)
return true; return true;
if (Card.IsDefense() && !enemyBetter && (Card.Attack >= Card.Defense || Card.Attack >= Util.GetBestPower(Enemy))) if (Card.IsDefense() && !enemyBetter && (Card.Attack >= Card.Defense || Card.Attack >= Util.GetBestPower(Enemy)))
...@@ -1145,6 +1145,11 @@ namespace WindBot.Game.AI ...@@ -1145,6 +1145,11 @@ namespace WindBot.Game.AI
return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || DefaultScarlightRedDragonArchfiendEffect(); return (selfBestAttack <= oppoBestAttack && oppoBestAttack <= 3000) || DefaultScarlightRedDragonArchfiendEffect();
} }
protected bool DefaultTimelordSummon()
{
return Bot.GetMonsterCount() == 0;
}
/// <summary> /// <summary>
/// Activate when we have less monsters than enemy, or when enemy have more than 3 monsters. /// Activate when we have less monsters than enemy, or when enemy have more than 3 monsters.
/// </summary> /// </summary>
......
...@@ -198,8 +198,7 @@ namespace WindBot.Game ...@@ -198,8 +198,7 @@ namespace WindBot.Game
for (int i = attackers.Count - 1; i >= 0; --i) for (int i = attackers.Count - 1; i >= 0; --i)
{ {
ClientCard attacker = attackers[i]; ClientCard attacker = attackers[i];
if (attacker.Attack > 0) Attack(attacker, null);
return Attack(attacker, null);
} }
} }
else else
......
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