Skip to content

Commit

Permalink
feat: add support for patch 31.0.0
Browse files Browse the repository at this point in the history
* fix: card ids

* feat: implement Demon Hunter cards

* feat: implement Librams counter

* chore: drop unnecessary known card ids

* feat: implement Talgath

* feat: implement some active effects

* feat: add Askara active effect

* feat: add Ingenious Artificer active effect

* feat: add Draenei Warrior active effects

* feat: add known card mark to Astral vigiant

* refactor: related cards system to use entities

* feat: add Archimonde related cards

* feat: add Foreboding Flame active effect

* feat: add Infernal Stratagem active effect

* feat: add Space Pirate active effect

* feat: implement asteroid damage counter (Bolide Behemoth)

* fix: velen related cards showing itself

* fix: leak showing moldara spores on opponent hands

* feat: prevent created cards from demon portal deck to show

* feat: add kiljaeden counter

* feat: add static related cards for GDB

* fix: wrong cardId

---------

Co-authored-by: Benedict Etzel <benedict@hearthsim.net>
Co-authored-by: mateuscechetto <mateuscechetto@gmail.com>
  • Loading branch information
3 people authored Oct 29, 2024
1 parent d1419d7 commit a631a81
Show file tree
Hide file tree
Showing 52 changed files with 635 additions and 82 deletions.
4 changes: 2 additions & 2 deletions Hearthstone Deck Tracker/GameEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ public void HandlePlayerPlayToGraveyard(Entity entity, string cardId, int turn,
_game.ActiveEffects.TryRemoveEffect(entity, true);
}

_game.Player.PlayToGraveyard(entity, cardId, turn);
_game.Player.PlayToGraveyard(entity, turn);
var card = Database.GetCardFromId(entity.Info.LatestCardId);
if(card != null)
GameEvents.OnPlayerPlayToGraveyard.Execute(card);
Expand All @@ -1891,7 +1891,7 @@ public async void HandleOpponentPlayToGraveyard(Entity entity, string? cardId, i
}

if(cardId != null)
_game.Opponent.PlayToGraveyard(entity, cardId, turn);
_game.Opponent.PlayToGraveyard(entity, turn);
var card = Database.GetCardFromId(entity.Info.LatestCardId);
if(card != null)
GameEvents.OnOpponentPlayToGraveyard.Execute(card);
Expand Down
2 changes: 2 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ public bool HasRace(Race race)

public bool IsNaga() => HasRace(HearthDb.Enums.Race.NAGA);

public bool isDraenei() => HasRace(HearthDb.Enums.Race.DRAENEI);

public bool IsEmptyRace() => RaceEnum == HearthDb.Enums.Race.INVALID && SecondaryRaceEnum == HearthDb.Enums.Race.INVALID;

[XmlIgnore]
Expand Down
4 changes: 2 additions & 2 deletions Hearthstone Deck Tracker/Hearthstone/CardIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public class Hunter : EnumerateMultiId<Hunter>
public static readonly MultiIdCard RatTrap = new MultiIdCard(Collectible.Hunter.RatTrap, Collectible.Hunter.RatTrapCore);
public static readonly MultiIdCard SnakeTrap = new MultiIdCard(Collectible.Hunter.SnakeTrap, Collectible.Hunter.SnakeTrapCorePlaceholder, Collectible.Hunter.SnakeTrapVanilla);
public static readonly MultiIdCard Snipe = new MultiIdCard(Collectible.Hunter.SnipeExpert1, Collectible.Hunter.SnipeVanilla, Collectible.Hunter.SnipeWONDERS);
public static readonly MultiIdCard VenomstrikeTrap = new MultiIdCard(Collectible.Hunter.VenomstrikeTrapICECROWN, Collectible.Hunter.VenomstrikeTrapInvalid);
public static readonly MultiIdCard VenomstrikeTrap = new MultiIdCard(Collectible.Hunter.VenomstrikeTrap, Collectible.Hunter.VenomstrikeTrapCorePlaceholder);
public static readonly MultiIdCard WanderingMonster = new MultiIdCard(Collectible.Hunter.WanderingMonster, Collectible.Hunter.WanderingMonsterCorePlaceholder);
public static readonly MultiIdCard Zombeeees = new MultiIdCard(Collectible.Hunter.Zombeeees);
}
Expand All @@ -194,7 +194,7 @@ public class Mage : EnumerateMultiId<Mage>
public static readonly MultiIdCard Effigy = new MultiIdCard(Collectible.Mage.Effigy);
public static readonly MultiIdCard ExplosiveRunes = new MultiIdCard(Collectible.Mage.ExplosiveRunes, Collectible.Mage.ExplosiveRunesCore);
public static readonly MultiIdCard FlameWard = new MultiIdCard(Collectible.Mage.FlameWard);
public static readonly MultiIdCard FrozenClone = new MultiIdCard(Collectible.Mage.FrozenCloneICECROWN, Collectible.Mage.FrozenCloneInvalid);
public static readonly MultiIdCard FrozenClone = new MultiIdCard(Collectible.Mage.FrozenClone, Collectible.Mage.FrozenCloneCorePlaceholder);
public static readonly MultiIdCard IceBarrier = new MultiIdCard(Collectible.Mage.IceBarrier, Collectible.Mage.IceBarrierCore, Collectible.Mage.IceBarrierVanilla);
public static readonly MultiIdCard IceBlock = new MultiIdCard(Collectible.Mage.IceBlock, Collectible.Mage.IceBlockVanilla);
public static readonly MultiIdCard ManaBind = new MultiIdCard(Collectible.Mage.ManaBind);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using HearthDb.Enums;
using Hearthstone_Deck_Tracker.LogReader.Interfaces;
using Hearthstone_Deck_Tracker.Utility;
using Entity = Hearthstone_Deck_Tracker.Hearthstone.Entities.Entity;

namespace Hearthstone_Deck_Tracker.Hearthstone.CounterSystem.Counters;

public class AsteroidExtraDamageCounter : NumericCounter
{
public override string LocalizedName => LocUtil.Get("Counter_AsteroidDamage", useCardLanguage: true);
protected override string? CardIdToShowInUI => HearthDb.CardIds.NonCollectible.Neutral.Asteroid;
public override string[] RelatedCards => new string[] {};

public AsteroidExtraDamageCounter(bool controlledByPlayer, GameV2 game) : base(controlledByPlayer, game)
{
}

public override bool ShouldShow() => !Game.IsBattlegroundsMatch && Counter > 0;

public override string[] GetCardsToDisplay()
{
return new []
{
HearthDb.CardIds.NonCollectible.Neutral.Asteroid
};
}

public override bool IsDisplayValueLong => true;

public override string ValueToShow() {
return string.Format(LocUtil.Get("Counter_AsteroidDamage_Damage", useCardLanguage: true), 2 + Counter);
}

public override void HandleTagChange(GameTag tag, IHsGameState gameState, Entity entity, int value, int prevValue)
{
if(entity.IsControlledBy(Game.Player.Id) == IsPlayerCounter)
{
if((int)tag == 3559)
{
Counter = value;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using HearthDb.Enums;
using Hearthstone_Deck_Tracker.LogReader.Interfaces;
using Entity = Hearthstone_Deck_Tracker.Hearthstone.Entities.Entity;

namespace Hearthstone_Deck_Tracker.Hearthstone.CounterSystem.Counters;

public class KiljaedenCounter : StatsCounter
{
protected override string? CardIdToShowInUI => HearthDb.CardIds.Collectible.Neutral.Kiljaeden;
public override string[] RelatedCards => new string[] {};

public KiljaedenCounter(bool controlledByPlayer, GameV2 game) : base(controlledByPlayer, game)
{
}

public override bool ShouldShow() => Game.IsTraditionalHearthstoneMatch && (AttackCounter > 0 || HealthCounter > 0);

public override string[] GetCardsToDisplay()
{
return new []
{
HearthDb.CardIds.Collectible.Neutral.Kiljaeden
};
}

public override string ValueToShow() => $"+{Math.Max(0, AttackCounter)} / +{Math.Max(0, HealthCounter)}";
public override void HandleTagChange(GameTag tag, IHsGameState gameState, Entity entity, int value, int prevValue)
{
if(!Game.IsTraditionalHearthstoneMatch)
return;

if(entity.Card.Id != HearthDb.CardIds.NonCollectible.Neutral.Kiljaeden_KiljaedensPortalEnchantment)
return;

if(entity.IsControlledBy(Game.Player.Id) != IsPlayerCounter)
return;

AttackCounter = entity.GetTag(GameTag.TAG_SCRIPT_DATA_NUM_2);
HealthCounter = entity.GetTag(GameTag.TAG_SCRIPT_DATA_NUM_2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ public class LibramCostReductionCounter : NumericCounter

public override string[] RelatedCards => new string[]
{
HearthDb.CardIds.Collectible.Paladin.AldorAttendant,
HearthDb.CardIds.Collectible.Paladin.AldorTruthseeker
HearthDb.CardIds.Collectible.Paladin.LibramOfWisdom,
HearthDb.CardIds.Collectible.Paladin.LibramOfClarity,
HearthDb.CardIds.Collectible.Paladin.LibramOfDivinity,
HearthDb.CardIds.Collectible.Paladin.LibramOfJustice,
HearthDb.CardIds.Collectible.Paladin.LibramOfFaith,
HearthDb.CardIds.Collectible.Paladin.LibramOfJudgment,
HearthDb.CardIds.Collectible.Paladin.LibramOfHope,
};

public LibramCostReductionCounter(bool controlledByPlayer, GameV2 game) : base(controlledByPlayer, game)
Expand All @@ -41,7 +46,8 @@ public override string[] GetCardsToDisplay()
private static readonly Dictionary<string, int> EnchantLibramDict = new Dictionary<string, int>
{
{HearthDb.CardIds.NonCollectible.Neutral.AldorAttendant_AldorAttendantEnchantment, 1},
{HearthDb.CardIds.NonCollectible.Neutral.AldorTruthseeker_AldorTruthseekerEnchantment, 2}
{HearthDb.CardIds.NonCollectible.Neutral.AldorTruthseeker_AldorTruthseekerEnchantment, 2},
{HearthDb.CardIds.NonCollectible.Paladin.InterstellarStarslicer_InterstellarLibramEnchantmentEnchantment, 1},
};

public override void HandleTagChange(GameTag tag, IHsGameState gameState, Entity entity, int value, int prevValue)
Expand Down
30 changes: 15 additions & 15 deletions Hearthstone Deck Tracker/Hearthstone/DungeonRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private static class TrlDefaultDecks
Collectible.Warrior.Armorsmith,
Collectible.Warrior.DrywhiskerArmorer,
Collectible.Warrior.FieryWarAxeLegacy,
Collectible.Warrior.MountainfireArmorICECROWN,
Collectible.Warrior.MountainfireArmor,
Collectible.Warrior.EmberscaleDrake,
Collectible.Neutral.Waterboy,
Collectible.Neutral.HiredGun,
Expand All @@ -427,7 +427,7 @@ private static class TrlDefaultDecks
Collectible.Neutral.EbonDragonsmith,
Collectible.Neutral.TwilightGuardian,
Collectible.Warrior.EmberscaleDrake,
Collectible.Neutral.BoneDrakeICECROWN,
Collectible.Neutral.BoneDrake,
},
new List<string>
{
Expand All @@ -440,7 +440,7 @@ private static class TrlDefaultDecks
Collectible.Warrior.CruelTaskmaster,
Collectible.Warrior.BloodhoofBrave,
Collectible.Neutral.AmaniBerserker,
Collectible.Neutral.DeathspeakerICECROWN,
Collectible.Neutral.Deathspeaker,
Collectible.Neutral.RagingWorgen,
},
};
Expand All @@ -457,7 +457,7 @@ private static class TrlDefaultDecks
Collectible.Shaman.JinyuWaterspeaker,
Collectible.Shaman.FireguardDestroyer,
Collectible.Neutral.MurlocRaiderLegacy,
Collectible.Neutral.DeadscaleKnightICECROWN,
Collectible.Neutral.DeadscaleKnight,
Collectible.Neutral.HugeToad,
Collectible.Neutral.TarCreeper,
},
Expand All @@ -473,7 +473,7 @@ private static class TrlDefaultDecks
Collectible.Neutral.FireFly,
Collectible.Neutral.BilefinTidehunter,
Collectible.Neutral.BelligerentGnome,
Collectible.Neutral.SaroniteChainGangICECROWN,
Collectible.Neutral.SaroniteChainGang,
},
new List<string>
{
Expand Down Expand Up @@ -515,10 +515,10 @@ private static class TrlDefaultDecks
Collectible.Paladin.SealOfLight,
Collectible.Paladin.BenevolentDjinn,
Collectible.Paladin.TruesilverChampionLegacy,
Collectible.Paladin.ChillbladeChampionICECROWN,
Collectible.Paladin.ChillbladeChampion,
Collectible.Neutral.Crystallizer,
Collectible.Neutral.MadBomber,
Collectible.Neutral.HappyGhoulICECROWN,
Collectible.Neutral.HappyGhoul,
Collectible.Neutral.MadderBomber
},
new List<string>
Expand Down Expand Up @@ -621,7 +621,7 @@ private static class TrlDefaultDecks
Collectible.Druid.EnchantedRaven,
Collectible.Druid.PowerOfTheWild,
Collectible.Druid.SavageStriker,
Collectible.Druid.GnashICECROWN,
Collectible.Druid.Gnash,
Collectible.Druid.Bite,
Collectible.Druid.SavageCombatant,
Collectible.Neutral.Waterboy,
Expand Down Expand Up @@ -685,7 +685,7 @@ private static class TrlDefaultDecks
Collectible.Mage.ShimmeringTempest,
Collectible.Mage.ExplosiveRunes,
Collectible.Mage.SpellslingerTGT,
Collectible.Mage.GhastlyConjurerICECROWN,
Collectible.Mage.GhastlyConjurer,
Collectible.Mage.BlastWave,
Collectible.Neutral.TournamentAttendee,
Collectible.Neutral.Brainstormer,
Expand All @@ -699,7 +699,7 @@ private static class TrlDefaultDecks
Collectible.Mage.Cinderstorm,
Collectible.Mage.DalaranAspirantTGT,
Collectible.Mage.FireballLegacy,
Collectible.Neutral.AcherusVeteranICECROWN,
Collectible.Neutral.AcherusVeteran,
Collectible.Neutral.FlameJuggler,
Collectible.Neutral.BlackwaldPixie,
Collectible.Neutral.DragonhawkRider,
Expand All @@ -713,7 +713,7 @@ private static class TrlDefaultDecks
Collectible.Mage.FrostboltLegacy,
Collectible.Mage.Snowchugger,
Collectible.Neutral.VolatileElemental,
Collectible.Neutral.HyldnirFrostriderICECROWN,
Collectible.Neutral.HyldnirFrostrider,
Collectible.Mage.ConeOfCold,
Collectible.Neutral.IceCreamPeddler,
Collectible.Mage.WaterElementalLegacy,
Expand All @@ -727,22 +727,22 @@ private static class TrlDefaultDecks
{
NonCollectible.Priest.BwonsamdisSanctum,
Collectible.Priest.CrystallineOracle,
Collectible.Priest.SpiritLashICECROWN,
Collectible.Priest.SpiritLash,
Collectible.Priest.MuseumCuratorLOE,
Collectible.Priest.DeadRinger,
Collectible.Priest.ShiftingShade,
Collectible.Priest.TortollanShellraiser,
Collectible.Neutral.MistressOfMixtures,
Collectible.Neutral.HarvestGolem,
Collectible.Neutral.ShallowGravediggerICECROWN,
Collectible.Neutral.TombLurkerICECROWN
Collectible.Neutral.ShallowGravedigger,
Collectible.Neutral.TombLurker
},
new List<string>
{
NonCollectible.Priest.BwonsamdisTome,
Collectible.Priest.PsionicProbe,
Collectible.Priest.PowerWordShieldLegacy,
Collectible.Priest.SpiritLashICECROWN,
Collectible.Priest.SpiritLash,
Collectible.Priest.SandDrudge,
Collectible.Priest.GildedGargoyle,
Collectible.Priest.Mindgames,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Enums;

namespace Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Effects.Mage;

public class IngeniousArtificerEnchantment : EntityBasedEffect
{
public override string CardId => HearthDb.CardIds.NonCollectible.Mage.IngeniousArtificer_IngeniousArtficerFutureBuffEnchantment;
protected override string CardIdToShowInUI => HearthDb.CardIds.Collectible.Mage.IngeniousArtificer;

public IngeniousArtificerEnchantment(int entityId, bool isControlledByPlayer) : base(entityId, isControlledByPlayer)
{
}

public override EffectDuration EffectDuration => EffectDuration.Conditional;
public override EffectTag EffectTag => EffectTag.ManaCrystalModification;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Enums;

namespace Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Effects.Neutral;

public class AceWayfinderEnchantment: EntityBasedEffect
{
public override string CardId => HearthDb.CardIds.NonCollectible.Neutral.AceWayfinder_AceWayfinderFutureBuffEnchantment;
protected override string CardIdToShowInUI => HearthDb.CardIds.Collectible.Neutral.AceWayfinder;

public AceWayfinderEnchantment(int entityId, bool isControlledByPlayer) : base(entityId, isControlledByPlayer)
{
}

public override EffectDuration EffectDuration => EffectDuration.Conditional;
public override EffectTag EffectTag => EffectTag.MinionModification;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Enums;

namespace Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Effects.Neutral;

public class AstrobiologistEnchantment: EntityBasedEffect
{
public override string CardId => HearthDb.CardIds.NonCollectible.Neutral.Astrobiologist_AstrobiologistEnchantment;
protected override string CardIdToShowInUI => HearthDb.CardIds.Collectible.Neutral.Astrobiologist;

public AstrobiologistEnchantment(int entityId, bool isControlledByPlayer) : base(entityId, isControlledByPlayer)
{
}

public override EffectDuration EffectDuration => EffectDuration.Conditional;
public override EffectTag EffectTag => EffectTag.MinionModification;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Enums;

namespace Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Effects.Neutral;

public class SpacePirateEnchantment : EntityBasedEffect
{
public override string CardId => HearthDb.CardIds.NonCollectible.Neutral.SpacePirate_SpacePiracyEnchantment;
protected override string CardIdToShowInUI => HearthDb.CardIds.Collectible.Neutral.SpacePirate;

public SpacePirateEnchantment(int entityId, bool isControlledByPlayer) : base(entityId, isControlledByPlayer)
{
}

public override EffectTarget EffectTarget => EffectTarget.Self;
public override EffectDuration EffectDuration => EffectDuration.Conditional;
public override EffectTag EffectTag => EffectTag.CostModification;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Enums;

namespace Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Effects.Neutral;

public class StarlightWandererEnchantment: EntityBasedEffect
{
public override string CardId => HearthDb.CardIds.NonCollectible.Neutral.StarlightWanderer_StarlightWandererFutureBuffEnchantment;
protected override string CardIdToShowInUI => HearthDb.CardIds.Collectible.Neutral.StarlightWanderer;

public StarlightWandererEnchantment(int entityId, bool isControlledByPlayer) : base(entityId, isControlledByPlayer)
{
}

public override EffectDuration EffectDuration => EffectDuration.Conditional;
public override EffectTag EffectTag => EffectTag.MinionModification;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Enums;

namespace Hearthstone_Deck_Tracker.Hearthstone.EffectSystem.Effects.Neutral;

public class StrandedSpacemanEnchantment: EntityBasedEffect
{
public override string CardId => HearthDb.CardIds.NonCollectible.Neutral.StrandedSpaceman_StrandedSpacemanFutureBuffEnchantment;
protected override string CardIdToShowInUI => HearthDb.CardIds.Collectible.Neutral.StrandedSpaceman;

public StrandedSpacemanEnchantment(int entityId, bool isControlledByPlayer) : base(entityId, isControlledByPlayer)
{
}

public override EffectDuration EffectDuration => EffectDuration.Conditional;
public override EffectTag EffectTag => EffectTag.MinionModification;

}
Loading

0 comments on commit a631a81

Please sign in to comment.