persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
BattleCalcs Struct Reference

various calculations used in Battle More...

#include <BattleCalcs.hpp>

Static Public Member Functions

static u32 attack (BattleParticipant &attacker, BattleParticipant &defender, Skill &skill)
 Calculates damage of an attack.
static bool hit (BattleParticipant &attacker, BattleParticipant &defender, Skill &skill)
 Calculates if a skill hit the target.
static u32 healing (BattleParticipant &user, Skill &skill)
 Calculates heal of a skill.
static u32 allOutAttack (Player &attacker, BattleParticipant &defender, u32 participantCount)
 Calculates damage of an All out attack.
static u32 getAtk (BattleStats &attackerStats, Skill &skill)
 Gets correct stat for damage calculations based on skill type.
static ae::q20_12_t getLevelDifference (u32 attackerLevel, u32 defenderLevel)
 Gets a multiplier used for damage calcs based on an arbitrary hardcoded table.
static ae::q20_12_t getAffinityMtp (BattleStats &battleStats, Skill &skill)
 Calculate damage multiplier based on resistance & skill affinity.

Static Private Member Functions

static uint8_t getMagicBoostHeal (uint8_t &magic)
 Calculate healing bonus based on an arbitrary hardcoded table.

Static Private Attributes

static const ae::q20_12_t levelMultipliers [24]
static const uint8_t magicBoostTableHeal [20]

Detailed Description

various calculations used in Battle

These are battle calculations to decide things like damage, healing, hitrate etc. These forumlas are directly from Reload, since those are the only one well documented.

Private functions are helpers.

For a complete breakdown, visit https://steamcommunity.com/sharedfiles/filedetails/?id=3230774091 Credits for this document goes to CTOBN on Steam.

Author
Nolan Kolb (TrueGiles / themoonwalker8692)

Definition at line 29 of file BattleCalcs.hpp.

Member Function Documentation

◆ allOutAttack()

u32 BattleCalcs::allOutAttack ( Player & attacker,
BattleParticipant & defender,
u32 participantCount )
static

Calculates damage of an All out attack.

Needs to be called for each BattleParticipant that gets attacked seperatly.

Parameters
attackerProtagonist, his stats are the main part of the calculation.
defenderBattleParticipant the attack is targetet at.
participantCountamount of BattleParticipant's executing the attack.
Returns
HP difference.

Definition at line 72 of file BattleCalcs.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ attack()

u32 BattleCalcs::attack ( BattleParticipant & attacker,
BattleParticipant & defender,
Skill & skill )
static

Calculates damage of an attack.

Parameters
attackerBattleParticipant using the skill.
defenderBattleParticipant the skill is targetet at.
skillskill used.
Returns
HP difference.

Definition at line 6 of file BattleCalcs.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAffinityMtp()

ae::q20_12_t BattleCalcs::getAffinityMtp ( BattleStats & battleStats,
Skill & skill )
static

Calculate damage multiplier based on resistance & skill affinity.

Parameters
battleStatsStats to check resistance to the skills affinity.
skillSkil to get affinity from.
Returns
Multiplier for damage.

TODO: add repel logic

Definition at line 135 of file BattleCalcs.cpp.

Here is the caller graph for this function:

◆ getAtk()

u32 BattleCalcs::getAtk ( BattleStats & attackerStats,
Skill & skill )
static

Gets correct stat for damage calculations based on skill type.

Parameters
attackerStatsStats of the attacker, to return magic or strength.
skillNeeded to determine the type of the skill.
Returns
Magic or strength stat, depending on skill type

Definition at line 121 of file BattleCalcs.cpp.

Here is the caller graph for this function:

◆ getLevelDifference()

ae::q20_12_t BattleCalcs::getLevelDifference ( u32 attackerLevel,
u32 defenderLevel )
static

Gets a multiplier used for damage calcs based on an arbitrary hardcoded table.

Parameters
attackerLevelLevel of the attacker.
defenderLevelLevel of the attacked defenderLevel BattleParticipant.
Returns
Multiplier for damage.

offset so -13 is 0

Definition at line 126 of file BattleCalcs.cpp.

Here is the caller graph for this function:

◆ getMagicBoostHeal()

uint8_t BattleCalcs::getMagicBoostHeal ( uint8_t & magic)
staticprivate

Calculate healing bonus based on an arbitrary hardcoded table.

Parameters
magicValue to calculate the boost from.
Returns
Boost

Definition at line 157 of file BattleCalcs.cpp.

Here is the caller graph for this function:

◆ healing()

u32 BattleCalcs::healing ( BattleParticipant & user,
Skill & skill )
static

Calculates heal of a skill.

Parameters
userBattleParticipant using the skill.
skillThe skill used.
Returns
HP difference.

Definition at line 54 of file BattleCalcs.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hit()

bool BattleCalcs::hit ( BattleParticipant & attacker,
BattleParticipant & defender,
Skill & skill )
static

Calculates if a skill hit the target.

Parameters
attackerBattleParticipant using the skill.
defenderBattleParticipant the skill is targetet at.
skillThe skill used.
Returns
If it hit the target.

Definition at line 16 of file BattleCalcs.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ levelMultipliers

const ae::q20_12_t BattleCalcs::levelMultipliers
staticprivate
Initial value:
= {
ae::q20_12_t{0.5}, ae::q20_12_t{0.51}, ae::q20_12_t{0.53}, ae::q20_12_t{0.59}, ae::q20_12_t{0.66},
ae::q20_12_t{0.75}, ae::q20_12_t{0.84}, ae::q20_12_t{0.91}, ae::q20_12_t{0.97}, ae::q20_12_t{0.99},
ae::q20_12_t{1.0}, ae::q20_12_t{1.0}, ae::q20_12_t{1.0}, ae::q20_12_t{1.0}, ae::q20_12_t{1.01},
ae::q20_12_t{1.03}, ae::q20_12_t{1.09}, ae::q20_12_t{1.16}, ae::q20_12_t{1.25}, ae::q20_12_t{1.34},
ae::q20_12_t{1.41}, ae::q20_12_t{1.47}, ae::q20_12_t{1.49}, ae::q20_12_t{1.5}}

Definition at line 91 of file BattleCalcs.hpp.

◆ magicBoostTableHeal

const uint8_t BattleCalcs::magicBoostTableHeal
staticprivate
Initial value:
= {
0,
6,
12,
17,
22,
27,
34,
44,
54,
65,
75,
85,
93,
100,
105,
110,
115,
120,
125,
130
}

Definition at line 98 of file BattleCalcs.hpp.


The documentation for this struct was generated from the following files: