NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
dBossLifeInf_c Class Referenceabstract

#include <game/bases/d_boss_life.hpp>

Inheritance diagram for dBossLifeInf_c:
[legend]

Description

Interface for managing a boss's hit points, damage values, and damage state.

Overview

This class defines the common interface used to manage boss HP and to apply damage from different attack types. Derived classes are responsible for deciding how much damage each attack type deals and how the boss's damage state changes as its HP decreases.

Current Hit Points

The current HP is stored in mLife.

Applying Damage

Damage should normally be applied through one of the update methods rather than modifying mLife directly.

Each update method obtains the damage amount from its corresponding getDamage method. This means that derived classes can change the damage dealt by an attack simply by overriding the appropriate getDamage method.

All update methods eventually call updateCommon, which subtracts the supplied damage from mLife and returns the resulting HP. If the boss survives the attack, it then calls damageRev.

Adjusting Damage

damageRev can be overridden by a derived class to perform post-damage adjustments or state changes without having to reimplement every update method.

Checking Damage State

The isNonDamage, isOneDamage, and isTwoDamage methods provide phase/state information based on the boss's current HP. Their exact meaning is implementation-defined, so code using this interface should treat them as the derived class's definition of the corresponding damage states.

isDmgSection can additionally be used by implementations that divide HP into discrete sections. The base implementation returns false.

Implementing a Derived Class

A concrete implementation must provide the damage-state methods and the damage values for each supported attack type.

Definition at line 5 of file d_boss_life.hpp.

Public Member Functions

 dBossLifeInf_c (int life)
 Constructs a new boss life manager.
virtual ~dBossLifeInf_c ()
 Destroys the boss life manager.
virtual bool isNonDamage () const =0
 Checks whether the boss has not yet been damaged.
virtual bool isOneDamage () const =0
 Checks whether the boss has been damaged once.
virtual bool isTwoDamage () const =0
 Checks whether the boss has been damaged twice.
virtual bool isDmgSection () const
 Checks whether the current HP is at a damage section boundary.
virtual int getDamage_Fire () const =0
 Gets the damage dealt by fireball attacks.
virtual int getDamage_Fumi () const =0
 Gets the damage dealt by stomp (Fumi) attacks.
virtual int getDamage_HipAtk () const =0
 Gets the damage dealt by ground pound (Hip) attacks.
virtual int getDamage_Star () const =0
 Gets the damage dealt by Star invincibility attacks.
virtual int getDamage_PenguinSlide () const =0
 Gets the damage dealt by Penguin slide attacks.
virtual int getDamage_BlockHit () const =0
 Gets the damage dealt by block hit attacks.
virtual int getDamage_Shell () const =0
 Gets the damage dealt by shell attacks.
virtual int getDamage_Quake () const =0
 Gets the damage dealt by multiplayer ground pound (Quake) attacks.
virtual void damageRev (int dmg)
 Post-damage callback invoked when a boss survives an attack.
int updateCommon (int dmg)
 Common update logic for all the update methods.
int updateFire ()
 Applies fireball damage to the boss.
int updateFumi ()
 Applies stomp (Fumi) damage to the boss.
int updateHipAtk ()
 Applies ground pound (Hip) damage to the boss.
int updateStar ()
 Applies Star damage to the boss.
int updatePenguinSlide ()
 Applies Penguin slide damage to the boss.
int updateBlockHit ()
 Applies block hit damage to the boss.
int updateShell ()
 Applies shell damage to the boss.
int updateQuake ()
 Applies multiplayer ground pound (Quake) damage to the boss.

Public Attributes

int mLife
 The current hit point total.

Constructor & Destructor Documentation

◆ dBossLifeInf_c()

dBossLifeInf_c::dBossLifeInf_c ( int life)
inline

Constructs a new boss life manager.

Parameters
lifeInitial hit point total for the boss.

Definition at line 9 of file d_boss_life.hpp.

◆ ~dBossLifeInf_c()

virtual dBossLifeInf_c::~dBossLifeInf_c ( )
inlinevirtual

Destroys the boss life manager.

Definition at line 10 of file d_boss_life.hpp.

Member Function Documentation

◆ isNonDamage()

virtual bool dBossLifeInf_c::isNonDamage ( ) const
pure virtual

Checks whether the boss has not yet been damaged.

Implemented in dBossLife_Common_c.

◆ isOneDamage()

virtual bool dBossLifeInf_c::isOneDamage ( ) const
pure virtual

Checks whether the boss has been damaged once.

Implemented in dBossLife_Common_c.

◆ isTwoDamage()

virtual bool dBossLifeInf_c::isTwoDamage ( ) const
pure virtual

Checks whether the boss has been damaged twice.

Implemented in dBossLife_Common_c.

◆ isDmgSection()

virtual bool dBossLifeInf_c::isDmgSection ( ) const
inlinevirtual

Checks whether the current HP is at a damage section boundary.

Returns
true if the implementation considers the current HP to be at a damage-section boundary; otherwise false .

The default implementation always returns false . Implementations that divide boss HP into sections can override this method to expose those boundaries.

Reimplemented in dBossLife_Common_c.

Definition at line 23 of file d_boss_life.hpp.

◆ getDamage_Fire()

virtual int dBossLifeInf_c::getDamage_Fire ( ) const
pure virtual

Gets the damage dealt by fireball attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_Fumi()

virtual int dBossLifeInf_c::getDamage_Fumi ( ) const
pure virtual

Gets the damage dealt by stomp (Fumi) attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_HipAtk()

virtual int dBossLifeInf_c::getDamage_HipAtk ( ) const
pure virtual

Gets the damage dealt by ground pound (Hip) attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_Star()

virtual int dBossLifeInf_c::getDamage_Star ( ) const
pure virtual

Gets the damage dealt by Star invincibility attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_PenguinSlide()

virtual int dBossLifeInf_c::getDamage_PenguinSlide ( ) const
pure virtual

Gets the damage dealt by Penguin slide attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_BlockHit()

virtual int dBossLifeInf_c::getDamage_BlockHit ( ) const
pure virtual

Gets the damage dealt by block hit attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_Shell()

virtual int dBossLifeInf_c::getDamage_Shell ( ) const
pure virtual

Gets the damage dealt by shell attacks.

Implemented in dBossLife_Common_c.

◆ getDamage_Quake()

virtual int dBossLifeInf_c::getDamage_Quake ( ) const
pure virtual

Gets the damage dealt by multiplayer ground pound (Quake) attacks.

Implemented in dBossLife_Common_c.

◆ damageRev()

virtual void dBossLifeInf_c::damageRev ( int dmg)
inlinevirtual

Post-damage callback invoked when a boss survives an attack.

Parameters
dmgThe amount of damage applied.

Reimplemented in dBossLife_Common_c.

Definition at line 36 of file d_boss_life.hpp.

◆ updateCommon()

int dBossLifeInf_c::updateCommon ( int dmg)
inline

Common update logic for all the update methods.

Parameters
dmgThe amount of damage applied.
Returns
The updated HP total.

Definition at line 41 of file d_boss_life.hpp.

◆ updateFire()

int dBossLifeInf_c::updateFire ( )
inline

Applies fireball damage to the boss.

Returns
The updated HP total.

Definition at line 51 of file d_boss_life.hpp.

◆ updateFumi()

int dBossLifeInf_c::updateFumi ( )
inline

Applies stomp (Fumi) damage to the boss.

Returns
The updated HP total.

Definition at line 55 of file d_boss_life.hpp.

◆ updateHipAtk()

int dBossLifeInf_c::updateHipAtk ( )
inline

Applies ground pound (Hip) damage to the boss.

Returns
The updated HP total.

Definition at line 59 of file d_boss_life.hpp.

◆ updateStar()

int dBossLifeInf_c::updateStar ( )
inline

Applies Star damage to the boss.

Returns
The updated HP total.

Definition at line 63 of file d_boss_life.hpp.

◆ updatePenguinSlide()

int dBossLifeInf_c::updatePenguinSlide ( )
inline

Applies Penguin slide damage to the boss.

Returns
The updated HP total.

Definition at line 67 of file d_boss_life.hpp.

◆ updateBlockHit()

int dBossLifeInf_c::updateBlockHit ( )
inline

Applies block hit damage to the boss.

Returns
The updated HP total.

Definition at line 71 of file d_boss_life.hpp.

◆ updateShell()

int dBossLifeInf_c::updateShell ( )
inline

Applies shell damage to the boss.

Returns
The updated HP total.

Definition at line 75 of file d_boss_life.hpp.

◆ updateQuake()

int dBossLifeInf_c::updateQuake ( )
inline

Applies multiplayer ground pound (Quake) damage to the boss.

Returns
The updated HP total.

Definition at line 79 of file d_boss_life.hpp.

Member Data Documentation

◆ mLife

int dBossLifeInf_c::mLife

The current hit point total.

Definition at line 81 of file d_boss_life.hpp.