Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
rolls.c File Reference

FIGHTSTG's random rolls: hits, criticals, statuses and the other effects, running away and the statuses' own tests. More...

Include dependency graph for rolls.c:

Go to the source code of this file.

Functions

s32 FIGHTSTG_rollCritical (u8 side, s32 id)
 Whether a physical hit is critical: a chance of 4 in 128 with the technique's critical boost or the accessory's, more against the target's family and while the target is paralyzed, asleep or confused.
 
s32 FIGHTSTG_rollMagicCritical (u8 side, s32 id)
 Whether a magic hit is critical: a chance from the technique's element power against the target's resistance, more against the target's family and while the target is paralyzed, asleep or confused.
 
s32 FIGHTSTG_rollHit (u8 side, s32 id)
 Whether a physical hit lands: the technique's accuracy with the speed and level differences and the accuracy and evasion accessories (the critical accessory costs the player some); the enemy hits at least 1 in 4, the player in BATTLE_KIND_FINAL_LAST 2 in 3.
 
s32 FIGHTSTG_rollMagicHit (u8 side, s32 id)
 Whether a magic hit lands: the technique's accuracy with the wisdom and level differences; the player in BATTLE_KIND_FINAL_LAST hits 2 in 3.
 
s32 FIGHTSTG_rollPoison (u8 side, s32 id)
 The poison a hit inflicts, or 0: the technique's or the accessory's chance and an eighth of the user's wisdom, less the target's resistances and wisdom (BATTLE_BLOCK_POISON keeps the player from it)
 
static s32 rollStatus (u8 side, s32 id, s32 block, s32 status, s32 resist, s32 element)
 Whether a hit inflicts status, like rollPoison without its power: BLOCK keeps the player from it, and the target resists it with RESIST and the resistance to ELEMENT.
 
s32 FIGHTSTG_rollParalysis (u8 side, s32 id)
 Whether a hit paralyzes, like rollPoison (BATTLE_BLOCK_PARALYSIS keeps the player from it)
 
s32 FIGHTSTG_rollConfusion (u8 side, s32 id)
 Whether a hit confuses, like rollPoison (BATTLE_BLOCK_CONFUSION keeps the player from it)
 
s32 FIGHTSTG_rollSleep (u8 side, s32 id)
 Whether a hit puts the target to sleep, like rollPoison with the technique's chance (BATTLE_BLOCK_SLEEP keeps the player from it)
 
s32 FIGHTSTG_rollKnockOut (u8 side, s32 id)
 Whether a hit knocks the target out, like rollPoison (BATTLE_BLOCK_KNOCK_OUT keeps the player from it)
 
s32 FIGHTSTG_rollSteal (u8 side, s32 id)
 Whether the player steals the enemy's item: its itemChance in 1024 by the speed ratio (at most twice) and the technique's and the accessory's chance.
 
s32 FIGHTSTG_rollDrain (u8 side, s32 id)
 Whether a hit drains HP: the technique's chance, or the accessory's for a technique without an effect.
 
static s32 rollTechChance (s32 id)
 Rolls a technique's effect chance (TechData.effectChance, in 128ths)
 
s32 FIGHTSTG_rollDedigivolve (s32 actor, s32 id)
 Whether a technique turns the player's fighter back: never when it is one of the partners' own Digimon (DIGIMON_DATA's first PARTNER_COUNT, as initNewGameData reads them), otherwise the technique's chance.
 
s32 FIGHTSTG_rollStatusRaise (s32 actor, s32 id)
 Whether a status raise works: the technique's chance and an eighth of what the enemy's wisdom has over the partner's.
 
s32 FIGHTSTG_rollNoSwitch (s32 actor, s32 id)
 Whether TECH_EFFECT_NO_SWITCH works: the technique's chance.
 
s32 FIGHTSTG_rollNoDigivolve (s32 actor, s32 id)
 Whether TECH_EFFECT_NO_DIGIVOLVE works: the technique's chance.
 
s32 FIGHTSTG_rollCounter (s32 side, s32 damage)
 FIGHTSTG_battleFuncs.rollCounter: a random test, likelier the bigger damage is next to the player's fighter's max HP; side is not used.
 
s32 FIGHTSTG_testRunAway (u8 side)
 FIGHTSTG_battleFuncs.testRunAway: a random test for side running away, from both sides' stats; the player can't while BATTLE_BLOCK_RUN_AWAY is set, and in the European version neither can the enemy while its fighter is asleep.
 
s32 FIGHTSTG_testWakeUp (u8 side, s32 value)
 FIGHTSTG_battleFuncs.testWakeUp: whether a hit of value wakes side's fighter up, likelier the bigger value is next to the fighter's defense, less likely the stronger its sleep and the later its end (EVENT_STATUS_END.
 
s32 FIGHTSTG_testConfusion (u8 side)
 FIGHTSTG_battleFuncs.testConfusion: a random test of side's confusion against its resists 9 and 3.
 
s32 FIGHTSTG_testParalysis (u8 side)
 FIGHTSTG_battleFuncs.testParalysis: whether side's paralysis costs it the turn, a random test of its strength against resists 8 and 4 (at least a chance of 32 in 128)
 

Detailed Description

FIGHTSTG's random rolls: hits, criticals, statuses and the other effects, running away and the statuses' own tests.

Definition in file rolls.c.

Function Documentation

◆ FIGHTSTG_rollCritical()

s32 FIGHTSTG_rollCritical ( u8  side,
s32  id 
)

Whether a physical hit is critical: a chance of 4 in 128 with the technique's critical boost or the accessory's, more against the target's family and while the target is paralyzed, asleep or confused.

< under it, the technique has none

< raises the critical hit chance

< loses turns at random (FIGHTSTG_battleFuncs.testParalysis)

< can't act or run away; a hit may wake it up

Definition at line 9 of file rolls.c.

Referenced by FIGHTSTG_adjustDamage().

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

◆ FIGHTSTG_rollMagicCritical()

s32 FIGHTSTG_rollMagicCritical ( u8  side,
s32  id 
)

Whether a magic hit is critical: a chance from the technique's element power against the target's resistance, more against the target's family and while the target is paralyzed, asleep or confused.

< loses turns at random (FIGHTSTG_battleFuncs.testParalysis)

< can't act or run away; a hit may wake it up

Definition at line 72 of file rolls.c.

Referenced by FIGHTSTG_computeMagicDamage().

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

◆ FIGHTSTG_rollHit()

s32 FIGHTSTG_rollHit ( u8  side,
s32  id 
)

Whether a physical hit lands: the technique's accuracy with the speed and level differences and the accuracy and evasion accessories (the critical accessory costs the player some); the enemy hits at least 1 in 4, the player in BATTLE_KIND_FINAL_LAST 2 in 3.

< its third enemy; winning plays the ending

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

< under it, the technique has none

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

Definition at line 123 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollMagicHit()

s32 FIGHTSTG_rollMagicHit ( u8  side,
s32  id 
)

Whether a magic hit lands: the technique's accuracy with the wisdom and level differences; the player in BATTLE_KIND_FINAL_LAST hits 2 in 3.

< its third enemy; winning plays the ending

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

Definition at line 165 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollPoison()

s32 FIGHTSTG_rollPoison ( u8  side,
s32  id 
)

The poison a hit inflicts, or 0: the technique's or the accessory's chance and an eighth of the user's wisdom, less the target's resistances and wisdom (BATTLE_BLOCK_POISON keeps the player from it)

< under it, the technique has none

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

Definition at line 195 of file rolls.c.

Here is the call graph for this function:

◆ rollStatus()

static s32 rollStatus ( u8  side,
s32  id,
s32  block,
s32  status,
s32  resist,
s32  element 
)
inlinestatic

Whether a hit inflicts status, like rollPoison without its power: BLOCK keeps the player from it, and the target resists it with RESIST and the resistance to ELEMENT.

< under it, the technique has none

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

Definition at line 239 of file rolls.c.

Referenced by FIGHTSTG_rollConfusion(), FIGHTSTG_rollKnockOut(), and FIGHTSTG_rollParalysis().

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

◆ FIGHTSTG_rollParalysis()

s32 FIGHTSTG_rollParalysis ( u8  side,
s32  id 
)

Whether a hit paralyzes, like rollPoison (BATTLE_BLOCK_PARALYSIS keeps the player from it)

Definition at line 276 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollConfusion()

s32 FIGHTSTG_rollConfusion ( u8  side,
s32  id 
)

Whether a hit confuses, like rollPoison (BATTLE_BLOCK_CONFUSION keeps the player from it)

Definition at line 282 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollSleep()

s32 FIGHTSTG_rollSleep ( u8  side,
s32  id 
)

Whether a hit puts the target to sleep, like rollPoison with the technique's chance (BATTLE_BLOCK_SLEEP keeps the player from it)

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

Definition at line 288 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollKnockOut()

s32 FIGHTSTG_rollKnockOut ( u8  side,
s32  id 
)

Whether a hit knocks the target out, like rollPoison (BATTLE_BLOCK_KNOCK_OUT keeps the player from it)

< its power is read by nothing

Definition at line 319 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollSteal()

s32 FIGHTSTG_rollSteal ( u8  side,
s32  id 
)

Whether the player steals the enemy's item: its itemChance in 1024 by the speed ratio (at most twice) and the technique's and the accessory's chance.

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

Definition at line 325 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollDrain()

s32 FIGHTSTG_rollDrain ( u8  side,
s32  id 
)

Whether a hit drains HP: the technique's chance, or the accessory's for a technique without an effect.

< under it, the technique has none

< its power is in 128ths of the damage

Definition at line 367 of file rolls.c.

Here is the call graph for this function:

◆ rollTechChance()

static s32 rollTechChance ( s32  id)
inlinestatic

Rolls a technique's effect chance (TechData.effectChance, in 128ths)

Definition at line 390 of file rolls.c.

Referenced by FIGHTSTG_rollDedigivolve(), FIGHTSTG_rollNoDigivolve(), and FIGHTSTG_rollNoSwitch().

Here is the caller graph for this function:

◆ FIGHTSTG_rollDedigivolve()

s32 FIGHTSTG_rollDedigivolve ( s32  actor,
s32  id 
)

Whether a technique turns the player's fighter back: never when it is one of the partners' own Digimon (DIGIMON_DATA's first PARTNER_COUNT, as initNewGameData reads them), otherwise the technique's chance.

Definition at line 400 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollStatusRaise()

s32 FIGHTSTG_rollStatusRaise ( s32  actor,
s32  id 
)

Whether a status raise works: the technique's chance and an eighth of what the enemy's wisdom has over the partner's.

< magic accuracy, statuses and heals

< magic accuracy, statuses and heals

Definition at line 413 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollNoSwitch()

s32 FIGHTSTG_rollNoSwitch ( s32  actor,
s32  id 
)

Whether TECH_EFFECT_NO_SWITCH works: the technique's chance.

Definition at line 425 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollNoDigivolve()

s32 FIGHTSTG_rollNoDigivolve ( s32  actor,
s32  id 
)

Whether TECH_EFFECT_NO_DIGIVOLVE works: the technique's chance.

Definition at line 430 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_rollCounter()

s32 FIGHTSTG_rollCounter ( s32  side,
s32  damage 
)

FIGHTSTG_battleFuncs.rollCounter: a random test, likelier the bigger damage is next to the player's fighter's max HP; side is not used.

Definition at line 437 of file rolls.c.

◆ FIGHTSTG_testRunAway()

s32 FIGHTSTG_testRunAway ( u8  side)

FIGHTSTG_battleFuncs.testRunAway: a random test for side running away, from both sides' stats; the player can't while BATTLE_BLOCK_RUN_AWAY is set, and in the European version neither can the enemy while its fighter is asleep.

The match depends on the battle's runAttempts being read through a pointer to its state, taken before side is tested again, and on the flags being tested with family as a halfword.

< can't act or run away; a hit may wake it up

< can't switch out or run away (TECH_EFFECT_NO_SWITCH)

< loses turns at random (FIGHTSTG_battleFuncs.testParalysis)

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

< can't act or run away; a hit may wake it up

< loses turns at random (FIGHTSTG_battleFuncs.testParalysis)

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

Definition at line 451 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_testWakeUp()

s32 FIGHTSTG_testWakeUp ( u8  side,
s32  value 
)

FIGHTSTG_battleFuncs.testWakeUp: whether a hit of value wakes side's fighter up, likelier the bigger value is next to the fighter's defense, less likely the stronger its sleep and the later its end (EVENT_STATUS_END.

  • 2) is due. The match depends on the 64 being set apart from sleep's half and on the sum being written in one statement.

< 10-12: the end of FIGHTER_PARALYZED, FIGHTER_CONFUSED or FIGHTER_ASLEEP

< against it

Definition at line 510 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_testConfusion()

s32 FIGHTSTG_testConfusion ( u8  side)

FIGHTSTG_battleFuncs.testConfusion: a random test of side's confusion against its resists 9 and 3.

Definition at line 536 of file rolls.c.

Here is the call graph for this function:

◆ FIGHTSTG_testParalysis()

s32 FIGHTSTG_testParalysis ( u8  side)

FIGHTSTG_battleFuncs.testParalysis: whether side's paralysis costs it the turn, a random test of its strength against resists 8 and 4 (at least a chance of 32 in 128)

Definition at line 560 of file rolls.c.

Here is the call graph for this function: