Skip to content

Commit

Permalink
Fix cards tracking for Spirit of the Dead
Browse files Browse the repository at this point in the history
  • Loading branch information
willmiao authored and azeier committed Sep 7, 2019
1 parent 9cd2b40 commit 6dd2740
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public Player(IGame game, bool isLocalPlayer)
public int SpellsPlayedCount { get; private set; }
public bool IsPlayingWhizbang { get; set; }
public int PogoHopperPlayedCount {get; private set;}
public string LastDiedMinionCardId { get; set; }

public bool HasCoin => Hand.Any(e => e.CardId == HearthDb.CardIds.NonCollectible.Neutral.TheCoin);
public int HandCount => Hand.Count();
Expand Down Expand Up @@ -390,6 +391,8 @@ public void QuestPlayedFromHand(Entity entity, int turn)
public void PlayToGraveyard(Entity entity, string cardId, int turn)
{
entity.Info.Turn = turn;
if(entity.IsMinion)
LastDiedMinionCardId = cardId;
Log(entity);
}

Expand Down
8 changes: 8 additions & 0 deletions Hearthstone Deck Tracker/LogReader/Handlers/PowerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public void Handle(string logLine, IHsGameState gameState, IGame game)
var blockType = match.Success ? match.Groups["type"].Value : null;
var cardId = match.Success ? match.Groups["Id"].Value : null;
var target = GetTargetCardId(match);
var correspondPlayer = match.Success ? int.Parse(match.Groups["player"].Value) : -1;
gameState.BlockStart(blockType, cardId, target);

if(match.Success && (blockType == "TRIGGER" || blockType == "POWER"))
Expand Down Expand Up @@ -328,6 +329,13 @@ public void Handle(string logLine, IHsGameState gameState, IGame game)
case Collectible.Warrior.Wrenchcalibur:
AddKnownCardId(gameState, NonCollectible.Neutral.SeaforiumBomber_BombToken);
break;
case Collectible.Priest.SpiritOfTheDead:
if(correspondPlayer == game.Player.Id)
AddKnownCardId(gameState, game.Player.LastDiedMinionCardId);
else if(correspondPlayer == game.Opponent.Id)
AddKnownCardId(gameState, game.Opponent.LastDiedMinionCardId);
break;

}
}
else //POWER
Expand Down
2 changes: 1 addition & 1 deletion Hearthstone Deck Tracker/LogReader/LogConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class LogConstants
public static class PowerTaskList
{
public static readonly Regex BlockStartRegex =
new Regex(@".*BLOCK_START.*BlockType=(?<type>(\w+)).*id=(?<id>\d*).*(cardId=(?<Id>(\w*))).*EffectCardId=(?<effectCardId>(.*))\sEffectIndex=.*Target=(?<target>(.+)).*SubOption=(?<subOption>(.+))");
new Regex(@".*BLOCK_START.*BlockType=(?<type>(\w+)).*id=(?<id>\d*).*(cardId=(?<Id>(\w*))).*player=(?<player>\d*).*EffectCardId=(?<effectCardId>(.*))\sEffectIndex=.*Target=(?<target>(.+)).*SubOption=(?<subOption>(.+))");

public static readonly Regex CardIdRegex = new Regex(@"cardId=(?<cardId>(\w+))");
public static readonly Regex CreationRegex = new Regex(@"FULL_ENTITY - Updating.*id=(?<id>(\d+)).*zone=(?<zone>(\w+)).*CardID=(?<cardId>(\w*))");
Expand Down

0 comments on commit 6dd2740

Please sign in to comment.