EncounterBalance.h header

#include <ew/app/EncounterBalance.h>

Namespace ew::app

EncounterAssessment struct

struct ew::app::EncounterAssessment

A full assessment of a planned encounter against a party.

Members

EncounterBudget ew::app::EncounterAssessment::budget

The party's XP thresholds (Easy/Medium/Hard/Deadly), summed across all characters.

int ew::app::EncounterAssessment::rawXp = 0

The raw XP of the encounter: the sum over foes of xp * count, before the multiplier.

int ew::app::EncounterAssessment::foeCount = 0

The total number of individual creatures (drives the multiplier).

int ew::app::EncounterAssessment::multiplierPercent = 100

The count-based encounter multiplier as a percent (100 = x1, 150 = x1.5, ... 400 = x4).

int ew::app::EncounterAssessment::adjustedXp = 0

The multiplier-adjusted XP (rawXp * multiplierPercent / 100), compared against the budget.

EncounterDifficulty ew::app::EncounterAssessment::difficulty =

The resulting difficulty band for the party.

int ew::app::EncounterAssessment::suggestedTreasureGp = 0

A guideline gold-piece treasure award for clearing the encounter, scaled by the party's tier and the difficulty. A rough planning aid, not a strict rule (5e treasure is tabular by hoard).

EncounterBudget struct

struct ew::app::EncounterBudget

The party's total XP budget at each difficulty – the sum across the party of each character's per-level XP threshold. An encounter's adjusted XP is compared against these to rate it.

Members

int ew::app::EncounterBudget::easy = 0

The Easy XP threshold, summed across the party.

int ew::app::EncounterBudget::medium = 0

The Medium XP threshold, summed across the party.

int ew::app::EncounterBudget::hard = 0

The Hard XP threshold, summed across the party.

int ew::app::EncounterBudget::deadly = 0

The Deadly XP threshold, summed across the party.

EncounterFoe struct

struct ew::app::EncounterFoe

One group of identical foes in a planned encounter: a name, the per-creature XP value (e.g. a Challenge Rating 1/2 monster is worth 100 XP), and how many of them appear.

Members

QString ew::app::EncounterFoe::name

The creature's name (for the readout; not used in the maths).

int ew::app::EncounterFoe::xp = 0

The XP awarded for one of these creatures.

int ew::app::EncounterFoe::count = 1

How many of this creature are in the encounter (at least 1 to count).

Enumerations

enum class EncounterDifficulty { Trivial, Easy, Medium, Hard, Deadly }

The difficulty of an encounter for the party, from the D&D 5e tiers plus a Trivial band below Easy (an encounter whose adjusted XP does not even reach the Easy threshold).

Functions

EncounterAssessment ew::app::assessEncounter(int partySize, int partyLevel, const std::vector< EncounterFoe > &foes)

Assesses foes against a party of partySize characters (clamped to at least 0) each at partyLevel (clamped 1..20), returning the party budget, the raw and multiplier-adjusted encounter XP, the difficulty band, and a guideline treasure award. Uses the D&D 5e DMG encounter-building maths; deterministic and unit-testable.

int ew::app::characterXpThreshold(int characterLevel, EncounterDifficulty difficulty)

The D&D 5e per-character XP threshold at characterLevel (clamped to 1..20) for difficulty. (Trivial has no threshold and returns 0.) These are the Dungeon Master's Guide "XP Thresholds by Character Level" values – e.g. a level-5 character contributes 250/500/750/1100 to the party's Easy/Medium/Hard/Deadly budget.

QString ew::app::encounterDifficultyLabel(EncounterDifficulty difficulty)

A short human-readable label for difficulty ("Trivial", "Easy", ...). English and stable, for display and any serialization; callers localize at the UI layer if needed.

int ew::app::encounterMultiplierPercent(int foeCount)

The D&D 5e encounter multiplier for foeCount creatures, as a percent: 1 -> 100 (x1), 2 -> 150, 3..6 -> 200, 7..10 -> 250, 11..14 -> 300, 15+ -> 400. A count of 0 returns 100. More foes make a given pool of XP more dangerous, which the multiplier captures.