Commit dffbba77 authored by mercury233's avatar mercury233

add ClientCard.EquipCards

parent 4f1c689e
......@@ -36,6 +36,10 @@ namespace WindBot.Game
public int SelectSeq { get; set; }
public int OpParam1 { get; set; }
public int OpParam2 { get; set; }
public List<ClientCard> EquipCards { get; set; }
public ClientCard EquipTarget;
public bool CanDirectAttack { get; set; }
public bool ShouldDirectAttack { get; set; }
public bool Attacked { get; set; }
......@@ -56,6 +60,7 @@ namespace WindBot.Game
Sequence = sequence;
Position = position;
Overlays = new List<int>();
EquipCards = new List<ClientCard>();
ActionIndex = new int[16];
ActionActivateIndex = new Dictionary<int, int>();
Location = loc;
......
......@@ -130,7 +130,8 @@ namespace WindBot.Game
_messages.Add(GameMessage.AnnounceRace, OnAnnounceRace);
_messages.Add(GameMessage.AnnounceCardFilter, OnAnnounceCard);
_messages.Add(GameMessage.RockPaperScissors, OnRockPaperScissors);
_messages.Add(GameMessage.Equip, OnEquip);
_messages.Add(GameMessage.Unequip, OnUnEquip);
_messages.Add(GameMessage.Summoning, OnSummoning);
_messages.Add(GameMessage.Summoned, OnSummoned);
_messages.Add(GameMessage.SpSummoning, OnSpSummoning);
......@@ -1412,6 +1413,43 @@ namespace WindBot.Game
Connection.Send(CtosMessage.Response, result);
}
private void OnEquip(BinaryReader packet)
{
int equipCardControler = GetLocalPlayer(packet.ReadByte());
int equipCardLocation = packet.ReadByte();
int equipCardSequence = packet.ReadSByte();
packet.ReadByte();
int targetCardControler = GetLocalPlayer(packet.ReadByte());
int targetCardLocation = packet.ReadByte();
int targetCardSequence = packet.ReadSByte();
packet.ReadByte();
ClientCard equipCard = _duel.GetCard(equipCardControler, (CardLocation)equipCardLocation, equipCardSequence);
ClientCard targetCard = _duel.GetCard(targetCardControler, (CardLocation)targetCardLocation, targetCardSequence);
if (equipCard == null || targetCard == null) return;
if (equipCard.EquipTarget != null)
{
equipCard.EquipTarget.EquipCards.Remove(equipCard);
}
equipCard.EquipTarget = targetCard;
targetCard.EquipCards.Add(equipCard);
}
private void OnUnEquip(BinaryReader packet)
{
int equipCardControler = GetLocalPlayer(packet.ReadByte());
int equipCardLocation = packet.ReadByte();
int equipCardSequence = packet.ReadSByte();
packet.ReadByte();
ClientCard equipCard = _duel.GetCard(equipCardControler, (CardLocation)equipCardLocation, equipCardSequence);
if (equipCard == null) return;
if (equipCard.EquipTarget != null)
{
equipCard.EquipTarget.EquipCards.Remove(equipCard);
equipCard.EquipTarget = null;
}
}
private void OnSummoning(BinaryReader packet)
{
_duel.LastSummonedCards.Clear();
......
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