Commit e7b3bf05 authored by mercury233's avatar mercury233

add ClientCard.IsCanRevive

parent b56e66dc
......@@ -253,7 +253,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterReborn()
{
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard);
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(CardContainer.CompareCardAttack);
ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
......@@ -269,7 +269,7 @@ namespace WindBot.Game.AI.Decks
break;
}
}
cards = new List<ClientCard>(Enemy.Graveyard);
cards = new List<ClientCard>(Enemy.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(CardContainer.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i)
{
......
......@@ -114,7 +114,7 @@ namespace WindBot.Game.AI.Decks
private bool MonsterReborn()
{
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard);
List<ClientCard> cards = new List<ClientCard>(Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(CardContainer.CompareCardAttack);
ClientCard selectedCard = null;
for (int i = cards.Count - 1; i >= 0; --i)
......@@ -128,7 +128,7 @@ namespace WindBot.Game.AI.Decks
break;
}
}
cards = new List<ClientCard>(Enemy.Graveyard);
cards = new List<ClientCard>(Enemy.Graveyard.GetMatchingCards(card => card.IsCanRevive()));
cards.Sort(CardContainer.CompareCardAttack);
for (int i = cards.Count - 1; i >= 0; --i)
{
......
......@@ -346,7 +346,7 @@ namespace WindBot.Game.AI
{
if (!Util.IsAllEnemyBetter(true))
return false;
ClientCard selected = Bot.Graveyard.OrderByDescending(card => card.Attack).FirstOrDefault();
ClientCard selected = Bot.Graveyard.GetMatchingCards(card => card.IsCanRevive()).OrderByDescending(card => card.Attack).FirstOrDefault();
AI.SelectCard(selected);
return true;
}
......
......@@ -34,6 +34,7 @@ namespace WindBot.Game
public int Owner { get; private set; }
public int Controller { get; private set; }
public int Disabled { get; private set; }
public int ProcCompleted { get; private set; }
public int SelectSeq { get; set; }
public int OpParam1 { get; set; }
public int OpParam2 { get; set; }
......@@ -145,7 +146,10 @@ namespace WindBot.Game
Owner = duel.GetLocalPlayer(packet.ReadInt32());
if ((flag & (int)Query.Status) != 0) {
int status = packet.ReadInt32();
Disabled = status & 0x0001;
const int STATUS_DISABLED = 0x0001;
const int STATUS_PROC_COMPLETE = 0x0008;
Disabled = status & STATUS_DISABLED;
ProcCompleted = status & STATUS_PROC_COMPLETE;
}
if ((flag & (int)Query.LScale) != 0)
LScale = packet.ReadInt32();
......@@ -312,6 +316,11 @@ namespace WindBot.Game
return Disabled != 0;
}
public bool IsCanRevive()
{
return ProcCompleted != 0 || !(IsExtraCard() || HasType(CardType.Ritual) || HasType(CardType.SpSummon));
}
public bool IsCode(int id)
{
return Id == id || Alias != 0 && Alias == id;
......
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