Combat is at the heart of Hytale gameplay. Whether you are building a PvE dungeon, a PvP arena, or a custom boss fight, you need to verify that damage calculations, health thresholds, death triggers, and stat modifiers all work correctly. HRTK provides two assertion classes for this:Documentation Index
Fetch the complete documentation index at: https://docs.hrtk.frotty27.com/llms.txt
Use this file to discover all available pages before exploring further.
StatsAssert for stat values, modifiers, and health; and CombatAssert for combat-specific checks like damage thresholds and knockback.
Testing combat matters for one critical reason: balance verification. A single wrong damage multiplier or a broken stat modifier can ruin the player experience. Automated tests let you verify that your Kweebecs survive the intended number of hits, that armor actually reduces damage, and that death triggers fire at the right time - every time you build your mod.
Combat and stat assertions require entities that have the relevant components (EntityStatMap, DeathComponent, etc.). Entities spawned via
spawnEntity with a valid NPC role name will have these components. Empty fallback entities may lack them. Use spawnNPC for combat tests to ensure the entity has the required components.Complete Example Suite
StatsAssert Methods
| Method | Description |
|---|---|
assertStatEquals(store, ref, statType, expected, tolerance) | Stat value equals expected (within tolerance) |
assertStatEquals(store, ref, statType, expected) | Stat value equals expected (tolerance 0.01) |
assertStatBetween(store, ref, statType, min, max) | Stat value is within range (inclusive) |
assertStatAtMax(store, ref, statType) | Stat is at its maximum |
assertStatAtMin(store, ref, statType) | Stat is at its minimum |
assertHealthEquals(store, ref, expected) | Entity health equals expected (tolerance 0.01) |
assertHealthAtMax(store, ref) | Entity health is at maximum |
assertAlive(store, ref) | Health > 0 and no DeathComponent |
assertDead(store, ref) | Entity has DeathComponent |
assertHasModifier(store, ref, statType, modifierId) | Stat has a named modifier |
assertNoModifier(store, ref, statType, modifierId) | Stat lacks a named modifier |
CombatAssert Methods
| Method | Description |
|---|---|
assertDead(store, ref) | Delegates to StatsAssert.assertDead |
assertAlive(store, ref) | Delegates to StatsAssert.assertAlive |
assertHealthEquals(store, ref, expected) | Delegates to StatsAssert.assertHealthEquals |
assertHealthBelow(store, ref, threshold) | Assert health is strictly below threshold |
assertHasKnockback(store, ref) | Assert entity has KnockbackComponent |
How It Works
BothStatsAssert and CombatAssert use reflection to access Hytale’s stat system:
- Find the
EntityStatMapcomponent on the entity - Look up the stat entry for the given
StatType - Call
get(),getMax(),getMin()on the stat entry - For health shortcuts, resolve the
HEALTHstat type from theStatTypesclass
The health-related methods (
assertHealthEquals, assertAlive, assertDead) automatically locate the HEALTH stat type by scanning known class paths. This works with standard Hytale server builds.Isolation Recommendation
Combat and stat tests almost always mutate entity state. UseIsolationStrategy.DEDICATED_WORLD:
Next Steps
- Inventory & Loot - item and drop assertions
- Effects - status effect assertions
- World Testing - entity spawning and positioning