Commit 258990b9 authored by wind2009's avatar wind2009 Committed by mercury233

Add AI.GetAttacker() and AI.GetDefender() (#3)

parent 81235d39
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using WindBot.Game.AI; using WindBot.Game.AI;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
...@@ -90,6 +90,8 @@ namespace WindBot.Game ...@@ -90,6 +90,8 @@ namespace WindBot.Game
m_option = -1; m_option = -1;
m_yesno = -1; m_yesno = -1;
m_position = CardPosition.FaceUpAttack; m_position = CardPosition.FaceUpAttack;
m_attacker = null;
m_defender = null;
Duel.LastSummonPlayer = -1; Duel.LastSummonPlayer = -1;
if (Duel.Player == 0 && Duel.Phase == DuelPhase.Draw) if (Duel.Player == 0 && Duel.Phase == DuelPhase.Draw)
{ {
...@@ -167,9 +169,9 @@ namespace WindBot.Game ...@@ -167,9 +169,9 @@ namespace WindBot.Game
{ {
const int HINTMSG_FMATERIAL = 511; const int HINTMSG_FMATERIAL = 511;
const int HINTMSG_SMATERIAL = 512; const int HINTMSG_SMATERIAL = 512;
const int HINTMSG_XMATERIAL = 513; const int HINTMSG_XMATERIAL = 513;
const int HINTMSG_LMATERIAL = 533; const int HINTMSG_LMATERIAL = 533;
const int HINTMSG_SPSUMMON = 509; const int HINTMSG_SPSUMMON = 509;
// Check for the executor. // Check for the executor.
IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, hint, cancelable); IList<ClientCard> result = Executor.OnSelectCard(cards, min, max, hint, cancelable);
...@@ -626,9 +628,27 @@ namespace WindBot.Game ...@@ -626,9 +628,27 @@ namespace WindBot.Game
private int m_number; private int m_number;
private int m_announce; private int m_announce;
private int m_yesno; private int m_yesno;
private ClientCard m_attacker;
private ClientCard m_defender;
private IList<CardAttribute> m_attributes = new List<CardAttribute>(); private IList<CardAttribute> m_attributes = new List<CardAttribute>();
private IList<CardRace> m_races = new List<CardRace>(); private IList<CardRace> m_races = new List<CardRace>();
public void SendBattleMsg(ClientCard attackcard, ClientCard defendcard)
{
m_attacker = attackcard;
m_defender = defendcard;
}
public ClientCard GetAttacker()
{
return m_attacker;
}
public ClientCard GetDefender()
{
return m_defender;
}
public void SelectCard(ClientCard card) public void SelectCard(ClientCard card)
{ {
m_selector = new CardSelector(card); m_selector = new CardSelector(card);
...@@ -894,4 +914,4 @@ namespace WindBot.Game ...@@ -894,4 +914,4 @@ namespace WindBot.Game
return false; return false;
} }
} }
} }
\ No newline at end of file
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
...@@ -494,12 +494,13 @@ namespace WindBot.Game ...@@ -494,12 +494,13 @@ namespace WindBot.Game
int la = packet.ReadByte(); int la = packet.ReadByte();
int sa = packet.ReadByte(); int sa = packet.ReadByte();
packet.ReadByte(); // packet.ReadByte(); //
packet.ReadByte(); // cd int cd = GetLocalPlayer(packet.ReadByte()); // cd
int ld = packet.ReadByte(); int ld = packet.ReadByte();
packet.ReadByte(); // sd int sd = packet.ReadByte(); // sd
packet.ReadByte(); // packet.ReadByte(); //
ClientCard attackcard = _duel.GetCard(ca, (CardLocation)la, sa); ClientCard attackcard = _duel.GetCard(ca, (CardLocation)la, sa);
ClientCard defendcard = _duel.GetCard(cd, (CardLocation)ld, sd);
_ai.SendBattleMsg(attackcard, defendcard);
if (ld == 0 && (attackcard != null) && (ca != 0)) if (ld == 0 && (attackcard != null) && (ca != 0))
{ {
_ai.OnDirectAttack(attackcard); _ai.OnDirectAttack(attackcard);
......
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