Skip to main content

Battle Commands

Battle formulas and server-side battle helpers for players.

Members

applyDamage

Apply damage. Player will lose HP. the attackerPlayer parameter is the other player, the one who attacks. If you don’t set the skill parameter, it will be a physical attack. The attack formula is already defined but you can customize it in the server options. This method handles all aspects of damage calculation including critical hits, elemental vulnerabilities, guard effects, and applies the final damage to HP.
  • Source: packages/server/src/Player/BattleManager.ts
  • Kind: method
  • Defined in: IBattleManager

Signature

Parameters

  • attackerPlayer: RpgPlayer
  • skill?: any

Returns

Object containing damage details and special effects that occurred

Examples

getFormulas

Get damage formulas from the current map Retrieves the damage calculation formulas defined in the current map’s configuration. These formulas are used to calculate different types of damage including physical, magical, critical hits, and guard effects. The formulas provide flexibility in customizing the battle system’s damage calculations.
  • Source: packages/server/src/Player/BattleManager.ts
  • Kind: method

Signature

Parameters

  • name: string

Returns

The formula function or undefined if not found

Examples