Skip to content

Commit

Permalink
added entity properties (HearthSim#927)
Browse files Browse the repository at this point in the history
  • Loading branch information
epix37 committed May 2, 2015
1 parent 5feb290 commit c058cd9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 24 deletions.
1 change: 0 additions & 1 deletion Hearthstone Deck Tracker/Hearthstone Deck Tracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@
<DependentUpon>CardEntity.xaml</DependentUpon>
</Compile>
<Compile Include="Replay\Enums\KeyPointType.cs" />
<Compile Include="Replay\ReplayHelper.cs" />
<Compile Include="Replay\ReplayKeyPoint.cs" />
<Compile Include="Replay\ReplayMaker.cs" />
<Compile Include="Replay\ReplayReader.cs" />
Expand Down
47 changes: 47 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone/Entities/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Windows;
using System.Windows.Media;
using Hearthstone_Deck_Tracker.Enums;
using Hearthstone_Deck_Tracker.Enums.Hearthstone;
using Newtonsoft.Json;

#endregion
Expand Down Expand Up @@ -33,6 +34,52 @@ public Entity(int id)
public string CardId { get; set; }
public bool IsPlayer { get; set; }

[JsonIgnore]
public bool IsOpponent
{
get { return !IsPlayer && HasTag(GAME_TAG.PLAYER_ID); }
}

[JsonIgnore]
public bool IsMinion
{
get { return HasTag(GAME_TAG.CARDTYPE) && GetTag(GAME_TAG.CARDTYPE) == (int)TAG_CARDTYPE.MINION; }
}

[JsonIgnore]
public bool IsWeapon
{
get { return HasTag(GAME_TAG.CARDTYPE) && GetTag(GAME_TAG.CARDTYPE) == (int)TAG_CARDTYPE.WEAPON; }
}

[JsonIgnore]
public bool IsInHand
{
get { return IsInZone(TAG_ZONE.HAND); }
}

[JsonIgnore]
public bool IsInPlay
{
get { return IsInZone(TAG_ZONE.PLAY); }
}

[JsonIgnore]
public bool IsInGraveyard
{
get { return IsInZone(TAG_ZONE.GRAVEYARD); }
}

public bool IsInZone(TAG_ZONE zone)
{
return HasTag(GAME_TAG.ZONE) && GetTag(GAME_TAG.ZONE) == (int)zone;
}

public bool IsControlledBy(int controllerId)
{
return HasTag(GAME_TAG.CONTROLLER) && GetTag(GAME_TAG.CONTROLLER) == controllerId;
}

[JsonIgnore]
public Card Card
{
Expand Down
23 changes: 0 additions & 23 deletions Hearthstone Deck Tracker/Replay/ReplayHelper.cs

This file was deleted.

0 comments on commit c058cd9

Please sign in to comment.