CombatSimulator

public class CombatSimulator

Combat Simulator - Manages test dummies and simulates attacks for skill testing.

Uses a singleton dummy pattern - one dummy at a time, killed and replaced between weapon types.

ATTACK SIMULATION:

  • simulateMeleeAttack() - Uses player.attack(target), resets iframes before each hit
  • simulateRangedAttack() - Spawns arrow toward target, needs tick delay for travel
  • simulateTridentAttack() - Spawns trident toward target, needs tick delay for travel
  • simulateIncomingDamage() - For armor skills, calls player.damage(amount, attacker)

CONFIG REQUIREMENTS:

  • training_dummy.yml - For offensive skill tests (damageMultiplier can be 0)
  • training_dummy_combat.yml - For armor skill tests (needs damageMultiplier >0)

See also

- The main test orchestrator

Constructors

Link copied to clipboard
public void CombatSimulator(Player player)

Properties

Link copied to clipboard
public final Player player
Link copied to clipboard
public static double testDamageOverride
When >= 0, bypasses the defense formula in PlayerDamagedByEliteMobEvent and uses this fixed damage value instead.

Functions

Link copied to clipboard
public void applyPassiveWeaponEffects(SkillType skillType, int skillLevel)
Applies passive weapon effects that normally trigger on PlayerItemHeldEvent.
Link copied to clipboard
public static double calculateExpectedDefensiveDamage(int armorSkillLevel, int mobLevel, Player player)
Calculates the expected defensive damage (elite → player) from the formula constants.
Link copied to clipboard
public void cleanupTestEntities()
Cleans up any projectile entities and area-effect-clouds spawned near the test area.
Link copied to clipboard
public void equipArmorSet(int level)
Equips the player with a full armor set at the specified elite level.
Link copied to clipboard
public void equipWeapon(SkillType skillType)
Equips the player with a weapon appropriate for the skill type.
Link copied to clipboard
public CustomBossEntity getDummy(String skillId)
Gets a dummy by skill ID.
Link copied to clipboard
public int getDummyCount()
Gets the number of active dummies.
Link copied to clipboard
public LivingEntity getDummyEntity(String skillId)
Gets the living entity for a dummy.
Link copied to clipboard
public Player getPlayer()
Link copied to clipboard
public static double getTestDamageOverride()
When >= 0, bypasses the defense formula in PlayerDamagedByEliteMobEvent and uses this fixed damage value instead.
Link copied to clipboard
public boolean hasActiveBreakdownTracking()
Checks if the player has an active damage breakdown tracking session.
Link copied to clipboard
public boolean hasDummy(String skillId)
Checks if a dummy exists and is alive.
Link copied to clipboard
public void healDummy(String skillId)
Heals a specific dummy.
Link copied to clipboard
public static boolean isBlockingOverride()
Link copied to clipboard
public static boolean isTestingActive()
Link copied to clipboard
public void markDummyAsFailed(String skillId, String skillName, SkillType skillType, String reason)
Updates a dummy's name to show the test failed.
Link copied to clipboard
public void markDummyAsPassed(String skillId, String skillName, SkillType skillType, double procRate)
Updates a dummy's name to show the test passed.
Link copied to clipboard
public void markDummyAsTesting(String skillId, String skillName, SkillType skillType)
Updates a dummy's name to show it's currently being tested.
Link copied to clipboard
public void placeWaterAtDummy(String skillId)
Places a water block at the dummy's feet for testing water-dependent skills (Depth Charge).
Link copied to clipboard
public void removeAllDummies()
Removes all dummies.
Link copied to clipboard
public void removeDummy(String skillId)
Removes a specific dummy by skill ID.
Link copied to clipboard
Clears projectile tracking state.
Link copied to clipboard
public boolean respawnIfDead(String skillId, SkillBonus skill)
Respawns a dummy if it died.
Link copied to clipboard
public void restorePlayerArmor()
Restores the player's saved armor.
Link copied to clipboard
public void restoreWaterBlock()
Restores the original block material at the water placement location.
Link copied to clipboard
public void runQuickDamageTest(int dummyLevel)
Runs a quick damage test and outputs the results.
Link copied to clipboard
public void savePlayerArmor()
Saves the player's current armor for later restoration.
Link copied to clipboard
public void sendBreakdownToPlayer(DamageBreakdown breakdown)
Outputs a detailed damage breakdown to the player.
Link copied to clipboard
public static void setBlockingOverride(boolean blockingOverride)
Link copied to clipboard
public void setDummyHealthPercent(String skillId, double percent)
Sets a dummy's health to a percentage of its max health.
Link copied to clipboard
public static void setTestDamageOverride(double testDamageOverride)
When >= 0, bypasses the defense formula in PlayerDamagedByEliteMobEvent and uses this fixed damage value instead.
Link copied to clipboard
public static void setTestingActive(boolean active)
Link copied to clipboard
public double simulateBlockingIncomingDamage(String skillId, double amount)
Simulates the player taking damage while blocking.
Link copied to clipboard
public double simulateCriticalAttack(String skillId)
Performs a direct event-based attack with critical strike flag set to true.
Link copied to clipboard
public double simulateDirectAttack(String skillId)
Performs a direct event-based attack against a specific dummy.
Link copied to clipboard
public double simulateFatalIncomingDamage(String skillId)
Simulates the player taking fatal damage without absorption buffer.
Link copied to clipboard
public double simulateHighDamageWithOverride(String skillId, double amount)
Simulates incoming high damage with override for skills with high damage thresholds.
Link copied to clipboard
public double simulateIncomingDamage(String skillId, double amount)
Simulates the player taking damage from a specific dummy (for armor skill testing).
public double simulateIncomingDamage(String skillId, double amount, double healthPercent)
Simulates incoming damage with the player at a specified health percentage.
Link copied to clipboard
public double simulateIncomingDamageWithOverride(String skillId, double amount)
Simulates incoming damage with the test damage override enabled.
Link copied to clipboard
public boolean simulateKill(String skillId)
Kills a dummy with a real player swing, so the whole death chain actually runs.
Link copied to clipboard
public double simulateMeleeAttack(String skillId)
Performs a melee attack against a specific dummy.
Link copied to clipboard
Performs a melee attack with full damage breakdown tracking.
Link copied to clipboard
public String simulateMultipleAttacksWithBreakdown(String skillId, int hitCount)
Performs multiple melee attacks and returns an averaged breakdown summary.
Link copied to clipboard
public double simulateRangedAttack(String skillId)
Performs a ranged attack (bow/crossbow) against a specific dummy.
Link copied to clipboard
public double simulateTridentAttack(String skillId)
Performs a trident throw attack against a specific dummy.
Link copied to clipboard
public boolean spawnDamageTestDummy(String skillId)
Spawns the dedicated damage test dummy for baseline damage validation.
Link copied to clipboard
public boolean spawnSingleDummy(SkillBonus skill)
Spawns a single dummy for the current skill test.
Link copied to clipboard
Stops breakdown tracking and returns the result.