|
| 1 | +using HearthDb.Enums; |
| 2 | +using Hearthstone_Deck_Tracker.LogReader.Interfaces; |
| 3 | +using Hearthstone_Deck_Tracker.Utility; |
| 4 | +using Entity = Hearthstone_Deck_Tracker.Hearthstone.Entities.Entity; |
| 5 | + |
| 6 | +namespace Hearthstone_Deck_Tracker.Hearthstone.CounterSystem.Counters; |
| 7 | + |
| 8 | +public class PaladinCardsPlayedCounter : NumericCounter |
| 9 | +{ |
| 10 | + protected override string? CardIdToShowInUI => HearthDb.CardIds.Collectible.Paladin.Lightray; |
| 11 | + |
| 12 | + public override string[] RelatedCards => new string[] |
| 13 | + { |
| 14 | + HearthDb.CardIds.Collectible.Paladin.Lightray |
| 15 | + }; |
| 16 | + |
| 17 | + public PaladinCardsPlayedCounter(bool controlledByPlayer, GameV2 game) : base(controlledByPlayer, game) |
| 18 | + { |
| 19 | + } |
| 20 | + |
| 21 | + public override bool ShouldShow() |
| 22 | + { |
| 23 | + if(!Game.IsTraditionalHearthstoneMatch) return false; |
| 24 | + if(IsPlayerCounter) |
| 25 | + return InPlayerDeckOrKnown(RelatedCards); |
| 26 | + return Counter > 0 && OpponentMayHaveRelevantCards(); |
| 27 | + } |
| 28 | + |
| 29 | + public override string[] GetCardsToDisplay() |
| 30 | + { |
| 31 | + return IsPlayerCounter ? |
| 32 | + GetCardsInDeckOrKnown(RelatedCards).ToArray() : |
| 33 | + FilterCardsByClassAndFormat(RelatedCards, Game.Opponent.OriginalClass); |
| 34 | + } |
| 35 | + |
| 36 | + public override string ValueToShow() => Counter.ToString(); |
| 37 | + |
| 38 | + public override void HandleTagChange(GameTag tag, IHsGameState gameState, Entity entity, int value, int prevValue) |
| 39 | + { |
| 40 | + if(!Game.IsTraditionalHearthstoneMatch) |
| 41 | + return; |
| 42 | + |
| 43 | + var controller = entity.GetTag(GameTag.CONTROLLER); |
| 44 | + if(!((controller == Game.Player.Id && IsPlayerCounter) || (controller == Game.Opponent.Id && !IsPlayerCounter))) |
| 45 | + return; |
| 46 | + |
| 47 | + if(DiscountIfCantPlay(tag, value, entity)) |
| 48 | + return; |
| 49 | + |
| 50 | + if(tag != GameTag.ZONE) |
| 51 | + return; |
| 52 | + |
| 53 | + if(value != (int)Zone.PLAY && value != (int)Zone.SECRET) |
| 54 | + return; |
| 55 | + |
| 56 | + if(gameState.CurrentBlock?.Type != "PLAY") |
| 57 | + return; |
| 58 | + |
| 59 | + if(entity.GetTag(GameTag.CLASS) != (int)CardClass.PALADIN) |
| 60 | + return; |
| 61 | + |
| 62 | + LastEntityToCount = entity; |
| 63 | + Counter++; |
| 64 | + } |
| 65 | +} |
0 commit comments