helapordo 1.4.20
Loading...
Searching...
No Matches
game_fight.h File Reference
#include "../core/game_log.h"
#include "../core/game_rng.h"
#include "../notifications/game_notifications.h"
Include dependency graph for game_fight.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void setCounter (Turncounter *c, int turns)
 Takes a Turncounter pointer and an integer.
int getBoost (int lvl, int luck)
 Takes two integers for level to calc against and luck, and returns the boost relative to the level with luck variations, as an integer.
int getBossBoost (int lvl, bossClass bclass)
 Takes one integer and a bossClass and returns the boost relative to the level delta with base boss stats, as an integer.
int getEnemyBoost (int lvl, enemyClass eclass)
 Takes one integer and an enemyClass and returns the boost relative to the level delta with base enemy stats, as an integer.
void statReset (Fighter *player, int force)
 Takes a Fighter pointer and an integer used to force execution.
void statResetBoss (Boss *b, int force)
 Takes a Boss pointer and an integer used to force execution.
void statResetEnemy (Enemy *e, int force)
 Takes an Enemy pointer and an integer used to force execution.
void printStatusText (fighterStatus status, char *subject, int color, RingaBuf *rb_notifications)
 Takes a RingaBuf pointer to queue notifications to, a fighterStatus value and a string of who's the entity to print the respective status message.
void applyStatus (Fighter *f, RingaBuf *rb_notifications)
 Takes a RingaBuf pointer to queue notifications to, a Fighter pointer value and applies the effect pertaining to its status value.
void applyEStatus (Enemy *e, RingaBuf *rb_notifications)
 Takes a RingaBuf pointer to queue notifications to, a Enemy pointer value and applies the effect pertaining to its status value.
void applyBStatus (Boss *b, RingaBuf *rb_notifications)
 Takes a RingaBuf pointer to queue notifications to, a Boss pointer value and applies the effect pertaining to its status value.
int defer_fight_enemy (Fighter *player, Enemy *e, foeTurnOption_OP foe_op, Koliseo *kls, RingaBuf *rb_notifications)
 Takes a Fighter and a Enemy pointers and calls fight().
int defer_skill_enemy (Fighter *player, Enemy *e, skillType picked_skill, foeTurnOption_OP foe_op, Koliseo *kls, RingaBuf *rb_notifications)
 Takes a Fighter and a Enemy pointers and calls do_Skill().
int fight (Fighter *player, Enemy *e, Koliseo *kls, RingaBuf *rb_notifications)
 Takes a Fighter and a Enemy pointers and compares their stats to determine who gets damaged and returns the fightStatus value.
int enemy_attack (Enemy *e, Fighter *target, Koliseo *kls, RingaBuf *rb_notifications)
 Takes an Enemy and a Fighter pointer and compares their stats to determine who gets damaged and returns the fightStatus value.
int defer_fight_boss (Fighter *player, Boss *b, Path *p, foeTurnOption_OP foe_op, Koliseo *kls, RingaBuf *rb_notifications)
 Takes a Fighter and a Boss pointers and calls boss_fight().
int defer_skill_boss (Fighter *player, Boss *b, skillType picked_skill, Path *p, foeTurnOption_OP foe_op, Koliseo *kls, RingaBuf *rb_notifications)
 Takes a Fighter and a Boss pointers and calls do_Skill_boss().
int boss_fight (Fighter *player, Boss *b, Path *p, Koliseo *kls, RingaBuf *rb_notifications)
 Takes a Fighter, a Boss and a Path pointers and compares fighters stats to determine who gets damaged and returns the fightStatus value.
int boss_attack (Boss *b, Fighter *target, Path *p, Koliseo *kls, RingaBuf *rb_notifications)
foeTurnOption enemyTurnPick (Enemy *e, Fighter *f)
 Returns a randomised pick as foeTurnOption.
foeTurnOption bossTurnPick (Boss *b, Fighter *f)
 Returns a randomised pick as foeTurnOption.
fightResult do_Skill (Fighter *player, Enemy *e, skillType picked_skill, Koliseo *kls)
fightResult do_Skill_boss (Fighter *player, Boss *b, skillType picked_skill, Path *path, Koliseo *kls)

Function Documentation

◆ applyBStatus()

void applyBStatus ( Boss * b,
RingaBuf * rb_notifications )

Takes a RingaBuf pointer to queue notifications to, a Boss pointer value and applies the effect pertaining to its status value.

See also
Boss
fighterStatus
printStatusText()
stringFromBossClass()
Parameters
bThe Boss pointer at hand.
rb_notificationsThe RingaBuf used for notifications.

◆ applyEStatus()

void applyEStatus ( Enemy * e,
RingaBuf * rb_notifications )

Takes a RingaBuf pointer to queue notifications to, a Enemy pointer value and applies the effect pertaining to its status value.

See also
Enemy
fighterStatus
printStatusText()
stringFromEClass()
Parameters
eThe Enemy pointer at hand.
rb_notificationsThe RingaBuf used for notifications.
See also
enqueue_notification()

◆ applyStatus()

void applyStatus ( Fighter * f,
RingaBuf * rb_notifications )

Takes a RingaBuf pointer to queue notifications to, a Fighter pointer value and applies the effect pertaining to its status value.

See also
Fighter
fighterStatus
printStatusText()
Parameters
fThe Fighter pointer at hand.
rb_notificationsThe RingaBuf pointer used for notifications.

◆ boss_attack()

int boss_attack ( Boss * b,
Fighter * target,
Path * p,
Koliseo * kls,
RingaBuf * rb_notifications )

◆ boss_fight()

int boss_fight ( Fighter * player,
Boss * b,
Path * p,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes a Fighter, a Boss and a Path pointers and compares fighters stats to determine who gets damaged and returns the fightStatus value.

Queues notifications to the passed RingaBuf pointer.

See also
Fighter
Boss
statReset()
statResetBoss()
stringFromBossClass()
Parameters
playerThe Fighter pointer at hand.
bThe Enemy pointer at hand.
pThe Path pointer for the game.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf used for notifications.
See also
enqueue_notification()

◆ bossTurnPick()

foeTurnOption bossTurnPick ( Boss * b,
Fighter * f )

Returns a randomised pick as foeTurnOption.

Parameters
bPointer to the boss to pick for.
fPointer to the target fighter.
Returns
The chosen foeturnOption value representing turn action.

◆ defer_fight_boss()

int defer_fight_boss ( Fighter * player,
Boss * b,
Path * p,
foeTurnOption_OP foe_op,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes a Fighter and a Boss pointers and calls boss_fight().

See also
Fighter
Boss
boss_fight()
Parameters
playerThe Fighter pointer at hand.
bThe Boss pointer at hand.
pThe Path pointer for the game.
foe_opThe foeTurnOption_OP for the foe.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf used for notifications.

◆ defer_fight_enemy()

int defer_fight_enemy ( Fighter * player,
Enemy * e,
foeTurnOption_OP foe_op,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes a Fighter and a Enemy pointers and calls fight().

See also
Fighter
Enemy
fight()
Parameters
playerThe Fighter pointer at hand.
eThe Enemy pointer at hand.
foe_opThe foeTurnOption_OP for the foe.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf used for notifications.

◆ defer_skill_boss()

int defer_skill_boss ( Fighter * player,
Boss * b,
skillType picked_skill,
Path * p,
foeTurnOption_OP foe_op,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes a Fighter and a Boss pointers and calls do_Skill_boss().

See also
Fighter
Boss
do_Skill_boss()
Parameters
playerThe Fighter pointer at hand.
bThe Boss pointer at hand.
pThe Path pointer for the game.
picked_skillThe skill picked by Fighter.
foe_opThe foeTurnOption_OP for the foe.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf used for notifications.

◆ defer_skill_enemy()

int defer_skill_enemy ( Fighter * player,
Enemy * e,
skillType picked_skill,
foeTurnOption_OP foe_op,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes a Fighter and a Enemy pointers and calls do_Skill().

See also
Fighter
Enemy
do_Skill()
Parameters
playerThe Fighter pointer at hand.
eThe Enemy pointer at hand.
picked_skillThe picked skill by Fighter.
foe_opThe foeTurnOption_OP for the foe.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf use for notifications.

◆ do_Skill()

fightResult do_Skill ( Fighter * player,
Enemy * e,
skillType picked_skill,
Koliseo * kls )

◆ do_Skill_boss()

fightResult do_Skill_boss ( Fighter * player,
Boss * b,
skillType picked_skill,
Path * path,
Koliseo * kls )

◆ enemy_attack()

int enemy_attack ( Enemy * e,
Fighter * target,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes an Enemy and a Fighter pointer and compares their stats to determine who gets damaged and returns the fightStatus value.

Queues notifications to the passed RingaBuf pointer. NOTE: that the return values are always from the POV of the Fighter: FIGHTRES_DMG_DEALT means the Enemy was damaged!

See also
defer_fight_enemy()
Fighter
Enemy
statReset()
statResetEnemy()
stringFromEClass()
Parameters
targetThe Fighter pointer at hand.
eThe Enemy pointer at hand.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf used for notifications.
See also
enqueue_notification()

◆ enemyTurnPick()

foeTurnOption enemyTurnPick ( Enemy * e,
Fighter * f )

Returns a randomised pick as foeTurnOption.

Parameters
ePointer to the enemy to pick for.
fPointer to the target fighter.
Returns
The chosen foeturnOption value representing turn action.

◆ fight()

int fight ( Fighter * player,
Enemy * e,
Koliseo * kls,
RingaBuf * rb_notifications )

Takes a Fighter and a Enemy pointers and compares their stats to determine who gets damaged and returns the fightStatus value.

Queues notifications to the passed RingaBuf pointer.

See also
Fighter
Enemy
statReset()
statResetEnemy()
stringFromEClass()
Parameters
playerThe Fighter pointer at hand.
eThe Enemy pointer at hand.
klsThe Koliseo used for allocations.
rb_notificationsThe RingaBuf used for notifications.
See also
enqueue_notification()

◆ getBoost()

int getBoost ( int lvl,
int luck )

Takes two integers for level to calc against and luck, and returns the boost relative to the level with luck variations, as an integer.

At level 1, returns 0.

Parameters
lvlThe level to check the boost against.
luckThe luck value to influence calcs.
Returns
int The boost for any given stat, at the level passed as argument.

◆ getBossBoost()

int getBossBoost ( int lvl,
bossClass bclass )

Takes one integer and a bossClass and returns the boost relative to the level delta with base boss stats, as an integer.

The EnemyBossStats pointer for the boss's bossClass is loaded. If the boost is negative, returns 0.

See also
Boss
bossClass
BossBaseStats
Parameters
lvlThe level to check the boost against.
bclassThe bossClass used to determine base level.
Returns
int The boost for any given stat, at the level passed as argument.

◆ getEnemyBoost()

int getEnemyBoost ( int lvl,
enemyClass eclass )

Takes one integer and an enemyClass and returns the boost relative to the level delta with base enemy stats, as an integer.

The EnemyBaseStats pointer for the enemy's enemyClass is loaded. If the boost is negative, returns 0.

See also
Enemy
enemyClass
EnemyBaseStats
Parameters
lvlThe level to check the boost against.
eclassThe enemyClass used to determine base level.
Returns
int The boost for any given stat, at the level passed as argument.

◆ printStatusText()

void printStatusText ( fighterStatus status,
char * subject,
int color,
RingaBuf * rb_notifications )

Takes a RingaBuf pointer to queue notifications to, a fighterStatus value and a string of who's the entity to print the respective status message.

See also
fighterStatus
Parameters
statusThe fighterStatus at hand.
subjectA string with name of entity owning the fighterStatus.
colorThe color to use for the notification.
rb_notificationsThe RingaBuf used for notifications.

◆ setCounter()

void setCounter ( Turncounter * c,
int turns )

Takes a Turncounter pointer and an integer.

If the count value at the pointer is 0 (counter is inactive), the turns valueis assigned.

See also
Turncounter
Parameters
cThe Turncounter whose count value will be set.
turnsThe value to be assigned.

◆ statReset()

void statReset ( Fighter * player,
int force )

Takes a Fighter pointer and an integer used to force execution.

If the force parameter is true, all checks are ignored. If enemy's hp value is at least 50% of total, and none of atk, def or vel is 0 or less, nothing happens with an early return. Otherwise, getBoost() is called to calc the level stat boost for each stat. The BaseStats pointer for the fighter's fighterClass is loaded and each one of atk, def and vel is checked accounting for level boost. If none of them is below the respective treshold of 35, 18 and 30 % of total, nothing happens. Otherwise, all of them are reset to full amount accounting for permboosts and level boost.

See also
Fighter
fighterClass
getBoost()
Parameters
playerThe Fighter pointer to check the stats for.
forceThe integer to bypass all checks if true.

◆ statResetBoss()

void statResetBoss ( Boss * b,
int force )

Takes a Boss pointer and an integer used to force execution.

If the force parameter is true, all checks are ignored. If boss's hp value is at least 40% of total, and none of atk, def or vel is 0 or less, nothing happens with an early return. Otherwise, getBossBoost() is called to calc the level stat boost for each stat. The BossBaseStats pointer for the boss's bossClass is loaded and each one of atk, def and vel is checked accounting for level boost. If none of them is below the respective treshold of 30, 30 and 20 % of total, nothing happens. Otherwise, all of them are reset to full amount accounting for beast boost and level boost.

See also
Boss
bossClass
getBossBoost()
BSTFACTOR
BossBaseStats
Parameters
bThe Boss pointer to check the stats for.
forceThe integer to bypass all checks if true.

◆ statResetEnemy()

void statResetEnemy ( Enemy * e,
int force )

Takes an Enemy pointer and an integer used to force execution.

If the force parameter is true, all checks are ignored. If enemy's hp value is at least 40% of total, and none of atk, def or vel is 0 or less, nothing happens with an early return. Otherwise, getEnemyBoost() is called to calc the level stat boost for each stat. The EnemyBaseStats pointer for the enemy's enemyClass is loaded and each one of atk, def and vel is checked accounting for level boost. If none of them is below the respective treshold of 30, 30 and 20 % of total, nothing happens. Otherwise, all of them are reset to full amount accounting for beast boost and level boost.

See also
Enemy
enemyClass
getEnemyBoost()
BSTFACTOR
EnemyBaseStats
Parameters
eThe Enemy pointer to check the stats for.
forceThe integer to bypass all checks if true.