Commit d1b4aec3 authored by mercury233's avatar mercury233

fix

parent 22c9bd3b
...@@ -164,11 +164,14 @@ namespace WindBot.Game.AI.Decks ...@@ -164,11 +164,14 @@ namespace WindBot.Game.AI.Decks
private bool 攻击力上升效果() private bool 攻击力上升效果()
{ {
if (Enemy.GetMonsters().GetHighestAttackMonster().IsFacedown() || Enemy.GetMonsters().GetHighestDefenseMonster().IsFacedown() || Enemy.GetMonsterCount() == 0) ClientCard bestMy = Bot.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyATK = Enemy.GetMonsters().GetHighestAttackMonster();
ClientCard bestEnemyDEF = Enemy.GetMonsters().GetHighestDefenseMonster();
if (bestMy == null || (bestEnemyATK == null && bestEnemyDEF == null))
return false; return false;
if (Bot.GetMonsters().GetHighestAttackMonster().Attack < Enemy.GetMonsters().GetHighestAttackMonster().Attack) if (bestEnemyATK != null && bestMy.Attack < bestEnemyATK.Attack)
return true; return true;
if (Bot.GetMonsters().GetHighestAttackMonster().Attack < Enemy.GetMonsters().GetHighestDefenseMonster().Defense) if (bestEnemyDEF != null && bestMy.Attack < bestEnemyDEF.Defense)
return true; return true;
return false; return false;
} }
......
...@@ -118,9 +118,11 @@ namespace WindBot.Game.AI.Decks ...@@ -118,9 +118,11 @@ namespace WindBot.Game.AI.Decks
{ {
if (!Card.IsAttack()) if (!Card.IsAttack())
return false; return false;
foreach (ClientCard card in Enemy.MonsterZone) foreach (ClientCard card in Enemy.GetMonsters())
if (card != null && card.IsDefense() && card.Defense > 1500 && card.Attack < 1500 || card.Attack > 1500 && card.Defense < 1500) {
if (card.IsDefense() && card.Defense > 1500 && card.Attack < 1500 || card.Attack > 1500 && card.Defense < 1500)
return true; return true;
}
return false; return false;
} }
......
...@@ -73,7 +73,7 @@ namespace WindBot.Game ...@@ -73,7 +73,7 @@ namespace WindBot.Game
_packets.Add(StocMessage.Replay, OnReplay); _packets.Add(StocMessage.Replay, OnReplay);
_packets.Add(StocMessage.DuelEnd, OnDuelEnd); _packets.Add(StocMessage.DuelEnd, OnDuelEnd);
_packets.Add(StocMessage.Chat, OnChat); _packets.Add(StocMessage.Chat, OnChat);
_packets.Add(StocMessage.ChangeSide, OnJoinGame); _packets.Add(StocMessage.ChangeSide, OnChangeSide);
_packets.Add(StocMessage.ErrorMsg, OnErrorMsg); _packets.Add(StocMessage.ErrorMsg, OnErrorMsg);
_messages.Add(GameMessage.Retry, OnRetry); _messages.Add(GameMessage.Retry, OnRetry);
...@@ -138,6 +138,21 @@ namespace WindBot.Game ...@@ -138,6 +138,21 @@ namespace WindBot.Game
_ai.OnJoinGame(); _ai.OnJoinGame();
} }
private void OnChangeSide(BinaryReader packet)
{
BinaryWriter deck = GamePacketFactory.Create(CtosMessage.UpdateDeck);
deck.Write(Deck.Cards.Count + Deck.ExtraCards.Count);
deck.Write(Deck.SideCards.Count);
foreach (NamedCard card in Deck.Cards)
deck.Write(card.Id);
foreach (NamedCard card in Deck.ExtraCards)
deck.Write(card.Id);
foreach (NamedCard card in Deck.SideCards)
deck.Write(card.Id);
Connection.Send(deck);
_ai.OnJoinGame();
}
private void OnTypeChange(BinaryReader packet) private void OnTypeChange(BinaryReader packet)
{ {
int type = packet.ReadByte(); int type = packet.ReadByte();
......
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