Pvp
constPvp:object
Defined in: server/api.d.ts:5785
Player-vs-player rules and arbitration. Who may hurt whom is server-owned: the rules, pair overrides and each player’s flag and team decide it, and the native hit pipeline (impact relay, pricing, victim apply, vitals fan-out) enforces it.
Type Declaration
Section titled “Type Declaration”configure()
Section titled “configure()”configure(
patch):PvpRules
Changes the server’s PvP rules live, for every client. Throws on an unknown key or a value of the wrong kind; numbers are clamped into range. Fires pvpRulesChanged when anything changed.
Parameters
Section titled “Parameters”Partial<PvpRules>
The rules to change; the rest keep their values.
Returns
Section titled “Returns”The rules now in force.
getRules()
Section titled “getRules()”getRules():
PvpRules
The server’s PvP rules now in force.
Returns
Section titled “Returns”getVitals()
Section titled “getVitals()”getVitals(
playerId): {ageMs:number;hp:number;level:number;max:number; } |null
That player’s last natively-reported vitals. Null before their first report. The policy object also carries victimHp/victimMax per hit.
Parameters
Section titled “Parameters”playerId
Section titled “playerId”number
Returns
Section titled “Returns”{ ageMs: number; hp: number; level: number; max: number; } | null
relation()
Section titled “relation()”relation(
a,b):object
Whether these two may hurt each other right now, how they aim at each other and what a defeat does, as every client resolves it. reason names what decided it.
Parameters
Section titled “Parameters”number | Player
number | Player
Returns
Section titled “Returns”object
aim:
"lock"|"skillshot"
defeat
Section titled “defeat”defeat:
"death"|"kneel"
hostile
Section titled “hostile”hostile:
boolean
reason
Section titled “reason”reason:
string
setPair()
Section titled “setPair()”setPair(
a,b,options?):boolean
Overrides the rules for one pair of players, both ways, until cleared or either leaves: a duel is setPair(a, b, { hostile: true, defeat: “kneel” }). A pair wins over rules.who and teams, but not over enabled: false.
Parameters
Section titled “Parameters”number | Player
number | Player
options?
Section titled “options?”{ aim?: "lock" | "skillshot"; defeat?: "death" | "kneel"; hostile?: boolean; } | null
The fields to override for these two; null or {} clears their override.
Returns
Section titled “Returns”boolean
False when the two are the same player, either is not connected, or 32 pairs are already set.
setPolicy()
Section titled “setPolicy()”setPolicy(
fn?):boolean
Registers (or clears, with no/null argument) the per-hit policy hook, which runs after the rules: zones, gamemode balance and scoring live here.
Parameters
Section titled “Parameters”PvpPolicy | null
Called for each hit the rules let through, with {casterId, victimId, spellId, spell, damage, duration, minHp, dotSeconds, defeat, bodyPart}; damage already carries damageScale and the players’ setDamageGiven/TakenMultiplier. A modded spell has spellId 0 and its mod’s record path as spell. Return false to veto, a number to replace the damage, {allow?, damage?, duration?, minHp?} for full control, or nothing to accept.
Returns
Section titled “Returns”boolean
setSpellDamage()
Section titled “setSpellDamage()”setSpellDamage(
spell,damage?):boolean
Per-spell damage the server enforces in place of the built-in table, which is generated from the game’s own spell data, or of a modded spell’s own price. The server log names each modded spell the first time it lands.
Parameters
Section titled “Parameters”string
Record path or basename, e.g. ‘DA_ExpulsoSpellRecord’, or a mod’s own such as ‘DA_Spell_CrucioVehemSpellRecord’.
damage?
Section titled “damage?”number | null
Damage per hit before damageScale; for a curse that burns (Crucio), the whole burn. UNCLAMPED (1e6 = lethal), even above moddedSpellCap. null/omitted removes the entry.
Returns
Section titled “Returns”boolean