Commit 811e3d61 authored by mercury233's avatar mercury233

add new master rule check

parent a9450a78
...@@ -153,6 +153,18 @@ namespace WindBot.Game.AI ...@@ -153,6 +153,18 @@ namespace WindBot.Game.AI
return card; return card;
} }
public ClientCard GetPZone(int player, int id)
{
if (Duel.IsNewRule)
{
return Duel.Fields[player].SpellZone[id*4];
}
else
{
return Duel.Fields[player].SpellZone[6+id];
}
}
public int GetStringId(int id, int option) public int GetStringId(int id, int option)
{ {
return id * 16 + option; return id * 16 + option;
......
...@@ -221,8 +221,8 @@ namespace WindBot.Game.AI.Decks ...@@ -221,8 +221,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location == CardLocation.Grave) if (Card.Location == CardLocation.Grave)
{ {
ClientCard l = Duel.Fields[0].SpellZone[6]; ClientCard l = AI.Utils.GetPZone(0, 0);
ClientCard r = Duel.Fields[0].SpellZone[7]; ClientCard r = AI.Utils.GetPZone(0, 1);
if (l == null && r == null) if (l == null && r == null)
AI.SelectCard((int)CardId.机壳工具丑恶); AI.SelectCard((int)CardId.机壳工具丑恶);
} }
...@@ -233,8 +233,8 @@ namespace WindBot.Game.AI.Decks ...@@ -233,8 +233,8 @@ namespace WindBot.Game.AI.Decks
{ {
if (Card.Location != CardLocation.Hand) if (Card.Location != CardLocation.Hand)
return false; return false;
ClientCard l = Duel.Fields[0].SpellZone[6]; ClientCard l = AI.Utils.GetPZone(0, 0);
ClientCard r = Duel.Fields[0].SpellZone[7]; ClientCard r = AI.Utils.GetPZone(0, 1);
if (l == null && r == null) if (l == null && r == null)
return true; return true;
if (l == null && r.RScale != Card.LScale) if (l == null && r.RScale != Card.LScale)
...@@ -259,8 +259,8 @@ namespace WindBot.Game.AI.Decks ...@@ -259,8 +259,8 @@ namespace WindBot.Game.AI.Decks
if (card.HasType(CardType.Pendulum) && card.IsFaceup()) if (card.HasType(CardType.Pendulum) && card.IsFaceup())
count++; count++;
} }
ClientCard l = Duel.Fields[0].SpellZone[6]; ClientCard l = AI.Utils.GetPZone(0, 0);
ClientCard r = Duel.Fields[0].SpellZone[7]; ClientCard r = AI.Utils.GetPZone(0, 1);
if (l == null && r == null) if (l == null && r == null)
{ {
if (已发动削命) if (已发动削命)
...@@ -406,8 +406,8 @@ namespace WindBot.Game.AI.Decks ...@@ -406,8 +406,8 @@ namespace WindBot.Game.AI.Decks
private bool 应进行灵摆召唤() private bool 应进行灵摆召唤()
{ {
ClientCard l = Duel.Fields[0].SpellZone[6]; ClientCard l = AI.Utils.GetPZone(0, 0);
ClientCard r = Duel.Fields[0].SpellZone[7]; ClientCard r = AI.Utils.GetPZone(0, 1);
if (l != null && r != null && l.LScale != r.RScale) if (l != null && r != null && l.LScale != r.RScale)
{ {
int count = 0; int count = 0;
......
...@@ -6,6 +6,7 @@ namespace WindBot.Game ...@@ -6,6 +6,7 @@ namespace WindBot.Game
public class Duel public class Duel
{ {
public bool IsFirst { get; set; } public bool IsFirst { get; set; }
public bool IsNewRule { get; set; }
public int[] LifePoints { get; private set; } public int[] LifePoints { get; private set; }
public ClientField[] Fields { get; private set; } public ClientField[] Fields { get; private set; }
......
...@@ -120,6 +120,11 @@ namespace WindBot.Game ...@@ -120,6 +120,11 @@ namespace WindBot.Game
private void OnJoinGame(BinaryReader packet) private void OnJoinGame(BinaryReader packet)
{ {
/*int lflist = (int)*/ packet.ReadUInt32();
/*int rule = */ packet.ReadByte();
/*int mode = */ packet.ReadByte();
int duel_rule = packet.ReadByte();
_ai.Duel.IsNewRule = (duel_rule == 4);
BinaryWriter deck = GamePacketFactory.Create(CtosMessage.UpdateDeck); BinaryWriter deck = GamePacketFactory.Create(CtosMessage.UpdateDeck);
deck.Write(Deck.Cards.Count + Deck.ExtraCards.Count); deck.Write(Deck.Cards.Count + Deck.ExtraCards.Count);
deck.Write(Deck.SideCards.Count); deck.Write(Deck.SideCards.Count);
......
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