Skip to content

Commit

Permalink
Update for YGOPro v1338 + Major code cleanup
Browse files Browse the repository at this point in the history
Use OCGWrapper and YGOSharp.Network to remove a lot of duplicate code.
  • Loading branch information
IceYGO committed Dec 31, 2015
1 parent 90b783d commit 8efd8d0
Show file tree
Hide file tree
Showing 33 changed files with 162 additions and 875 deletions.
4 changes: 2 additions & 2 deletions Game/AI/CardContainer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using WindBot.Game.Enums;
using OCGWrapper.Enums;
using System.Collections.Generic;

namespace WindBot.Game.AI
{
Expand Down
4 changes: 2 additions & 2 deletions Game/AI/CardSelector.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using WindBot.Game.Enums;
using OCGWrapper.Enums;
using System.Collections.Generic;

namespace WindBot.Game.AI
{
Expand Down
8 changes: 4 additions & 4 deletions Game/AI/Decks/HorusExecutor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using WindBot.Game.Enums;
using OCGWrapper.Enums;
using System.Collections.Generic;

namespace WindBot.Game.AI.Decks
{
Expand Down Expand Up @@ -86,9 +86,9 @@ private bool FoolishBurial()

private bool BellowOfTheSilverDragon()
{
if (Duel.Player == 0 && (Duel.Phase == Phase.Draw || Duel.Phase == Phase.Standby))
if (Duel.Player == 0 && (Duel.Phase == DuelPhase.Draw || Duel.Phase == DuelPhase.Standby))
return false;
if (Duel.Player == 1 && Duel.Phase == Phase.End)
if (Duel.Player == 1 && Duel.Phase == DuelPhase.End)
return false;

List<ClientCard> cards = new List<ClientCard>(Duel.Fields[0].Graveyard);
Expand Down
4 changes: 2 additions & 2 deletions Game/AI/DefaultExecutor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using OCGWrapper.Enums;
using System;
using System.Collections.Generic;
using WindBot.Game.Enums;

namespace WindBot.Game.AI
{
Expand Down
4 changes: 2 additions & 2 deletions Game/AI/Executor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using OCGWrapper.Enums;
using System;
using System.Collections.Generic;
using WindBot.Game.Enums;

namespace WindBot.Game.AI
{
Expand Down
16 changes: 8 additions & 8 deletions Game/ClientCard.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System.Collections.Generic;
using WindBot.Game.Data;
using WindBot.Game.Enums;
using WindBot.Game.Network;
using OCGWrapper;
using OCGWrapper.Enums;
using System.Collections.Generic;
using YGOSharp.Network;

namespace WindBot.Game
{
public class ClientCard
{
public int Id { get; private set; }
public CardData Data { get; private set; }
public NamedCard Data { get; private set; }
public string Name { get; private set; }

public int Position { get; set; }
Expand Down Expand Up @@ -49,12 +49,12 @@ public void SetId(int id)
{
if (Id == id) return;
Id = id;
Data = CardsManager.GetCard(Id);
Data = NamedCard.Get(Id);
if (Data != null)
Name = Data.Name;
}

public void Update(GameServerPacket packet, Duel duel)
public void Update(GamePacketReader packet, Duel duel)
{
int flag = packet.ReadInt32();
if ((flag & (int)Query.Code) != 0)
Expand Down Expand Up @@ -170,7 +170,7 @@ public bool IsAttack()

public bool IsDefense()
{
return HasPosition(CardPosition.Defense);
return HasPosition(CardPosition.Defence);
}

public int GetDefensePower()
Expand Down
4 changes: 2 additions & 2 deletions Game/ClientField.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using WindBot.Game.Enums;
using OCGWrapper.Enums;
using System.Collections.Generic;

namespace WindBot.Game
{
Expand Down
33 changes: 0 additions & 33 deletions Game/Data/CardData.cs

This file was deleted.

84 changes: 0 additions & 84 deletions Game/Data/CardsManager.cs

This file was deleted.

21 changes: 11 additions & 10 deletions Game/Data/Deck.cs → Game/Deck.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
using System;
using OCGWrapper;
using System;
using System.Collections.Generic;
using System.IO;

namespace WindBot.Game.Data
namespace WindBot.Game
{
public class Deck
{
public IList<CardData> Cards { get; private set; }
public IList<CardData> ExtraCards { get; private set; }
public IList<CardData> SideCards { get; private set; }
public IList<NamedCard> Cards { get; private set; }
public IList<NamedCard> ExtraCards { get; private set; }
public IList<NamedCard> SideCards { get; private set; }

public Deck()
{
Cards = new List<CardData>();
ExtraCards = new List<CardData>();
SideCards = new List<CardData>();
Cards = new List<NamedCard>();
ExtraCards = new List<NamedCard>();
SideCards = new List<NamedCard>();
}

private void AddNewCard(int cardId, bool sideDeck)
{
CardData newCard = CardsManager.GetCard(cardId);
NamedCard newCard = NamedCard.Get(cardId);
if (newCard == null)
return;

Expand All @@ -29,7 +30,7 @@ private void AddNewCard(int cardId, bool sideDeck)
SideCards.Add(newCard);
}

private void AddCard(CardData card)
private void AddCard(NamedCard card)
{
if (card.IsExtraCard())
ExtraCards.Add(card);
Expand Down
6 changes: 3 additions & 3 deletions Game/Duel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using WindBot.Game.Enums;
using OCGWrapper.Enums;
using System.Collections.Generic;

namespace WindBot.Game
{
Expand All @@ -12,7 +12,7 @@ public class Duel

public int Turn { get; set; }
public int Player { get; set; }
public Phase Phase { get; set; }
public DuelPhase Phase { get; set; }
public MainPhase MainPhase { get; set; }
public BattlePhase BattlePhase { get; set; }

Expand Down
13 changes: 0 additions & 13 deletions Game/Enums/CardAttribute.cs

This file was deleted.

15 changes: 0 additions & 15 deletions Game/Enums/CardLocation.cs

This file was deleted.

14 changes: 0 additions & 14 deletions Game/Enums/CardPosition.cs

This file was deleted.

28 changes: 0 additions & 28 deletions Game/Enums/CardRace.cs

This file was deleted.

28 changes: 0 additions & 28 deletions Game/Enums/CardType.cs

This file was deleted.

Loading

0 comments on commit 8efd8d0

Please sign in to comment.