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

FIGHTSTG's items used in battle: an item's script and its task. More...

Include dependency graph for item.c:

Go to the source code of this file.

Functions

static void lowerEnemyStat (BattleItem *task, BattleChild *children)
 Item 0x58's setup: lowers the higher of the enemy's attack and defense (when that is the defense, the USA version raises it instead), unless the battle blocks it, and picks the script's effect.
 
static void setUpDrain (BattleItem *task, BattleChild *children)
 Item 0x55's setup: its drain of 20 percent of the enemy's max HP, unless the battle blocks draining.
 
static void setUpItemTech (BattleItem *task, BattleChild *children)
 Item 0x5A's setup: the script of technique 0x89 and its magic damage to the enemy.
 
static void setItemScript (BattleItem *task, BattleChild *children)
 The other items' setup: their effect and sound from FIGHTSTG_itemScripts, and the partner's idle motion after what items 0x2B-0x2E and 0x47 heal.
 
s32 FIGHTSTG_runItemScript (BattleItem *task, BattleChild *children)
 An item's script (FIGHTSTG_updateItem): step 0 sets it up and deals the damage (lowerEnemyStat, setUpDrain, setUpItemTech, setItemScript), 1 plays item 0x55's second part when the enemy is still standing, 2 waits.
 
static void healPartner (BattleItem *task, BattleChild *children)
 Items 0x2B-0x41: heal the partner by the item's amount, up to its max HP.
 
static void cureStatus (BattleItem *task, BattleChild *children)
 Items 0x42-0x45: cure the partner of what FIGHTSTG_itemCures says, or say they do nothing.
 
static void reviveParty (BattleItem *task, BattleChild *children)
 Item 0x46: revives the partners knocked out to their max HP, then is taken from the bag and ends the task.
 
static void restoreHalfHpMp (BattleItem *task, BattleChild *children)
 Item 0x47: restores half the partner's max HP and MP, or says it does nothing when both are full.
 
static void boostSpeed (BattleItem *task, BattleChild *children)
 Item 0x48: raises the partner's speed by the item's amount in 128ths, up to double.
 
static void boostAttack (BattleItem *task, BattleChild *children)
 Item 0x49: raises the partner's attack and lowers its defense.
 
static void boostDefense (BattleItem *task, BattleChild *children)
 Item 0x4A: raises the partner's defense and lowers its attack.
 
static void startSpecial (BattleItem *task, BattleChild *children)
 Item 0x4B: puts the partner in its special state, which doubles its effects.
 
static void fillGauge (BattleItem *task, BattleChild *children)
 Item 0x4C: fills the partner's gauge by the item's amount, up to 999.
 
static void boostElement (BattleItem *task, BattleChild *children)
 Items 0x4D-0x53: boost one element on the field.
 
static void boostRandomElement (BattleItem *task, BattleChild *children)
 Item 0x54: boosts the element its script picked at random on the field.
 
static void drainEnemy (BattleItem *task, BattleChild *children)
 Item 0x55: drains the damage from the enemy to the partner, or says it does nothing when the battle blocks draining.
 
static void confuseFighters (BattleItem *task, BattleChild *children)
 Item 0x56: confuses the enemy half of the time, unless the battle blocks it, and then the partner a quarter of those times.
 
static void weakenEnemyDefense (BattleItem *task, BattleChild *children)
 Item 0x57: raises the enemy's attack and lowers its defense, or says it does nothing when the battle blocks it.
 
static void showLoweredStat (BattleItem *task, BattleChild *children)
 Item 0x58: says which of the enemy's stats its script lowered.
 
static void lowerEnemySpeed (BattleItem *task, BattleChild *children)
 Item 0x59: lowers the enemy's speed, or says it does nothing when the battle blocks it.
 
static void damageEnemy (BattleItem *task, BattleChild *children)
 Item 0x5A: deals its technique's damage to the enemy.
 
void FIGHTSTG_updateItem (BattleItem *task, BattleChild *children)
 An item used in battle (FIGHTSTG_startItem): its message, FIGHTSTG_runItemScript's script, then substate 1 does what the item does (healPartner to damageEnemy, one per item) and 2 takes it from the bag (item 0x55 attacks again in BATTLE_KIND_FINAL_LAST).
 
BattleItem * FIGHTSTG_startItem (s32 item)
 Starts an item's script (FIGHTSTG_updateItem)
 

Variables

StatusCure FIGHTSTG_itemCures [4]
 what items 0x42-0x45 cure (FIGHTSTG_updateItem, below)
 
ItemScript FIGHTSTG_itemScripts []
 the items' script settings (FIGHTSTG_runItemScript, above)
 

Detailed Description

FIGHTSTG's items used in battle: an item's script and its task.

Definition in file item.c.

Function Documentation

◆ lowerEnemyStat()

static void lowerEnemyStat ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x58's setup: lowers the higher of the enemy's attack and defense (when that is the defense, the USA version raises it instead), unless the battle blocks it, and picks the script's effect.

< physical damage

< against it

< to 10: attack, defense, speed (a technique's boost stat + 8)

< physical damage

< against it

< physical damage

< physical damage

< physical damage

< against it

< physical damage

< against it

< against it

< against it

Definition at line 8 of file item.c.

Referenced by FIGHTSTG_runItemScript().

Here is the caller graph for this function:

◆ setUpDrain()

static void setUpDrain ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x55's setup: its drain of 20 percent of the enemy's max HP, unless the battle blocks draining.

Definition at line 66 of file item.c.

Referenced by FIGHTSTG_runItemScript().

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

◆ setUpItemTech()

static void setUpItemTech ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x5A's setup: the script of technique 0x89 and its magic damage to the enemy.

Definition at line 91 of file item.c.

Referenced by FIGHTSTG_runItemScript().

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

◆ setItemScript()

static void setItemScript ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

The other items' setup: their effect and sound from FIGHTSTG_itemScripts, and the partner's idle motion after what items 0x2B-0x2E and 0x47 heal.

Definition at line 116 of file item.c.

Referenced by FIGHTSTG_runItemScript().

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

◆ FIGHTSTG_runItemScript()

s32 FIGHTSTG_runItemScript ( BattleItem *  task,
BattleChild *  children 
)

An item's script (FIGHTSTG_updateItem): step 0 sets it up and deals the damage (lowerEnemyStat, setUpDrain, setUpItemTech, setItemScript), 1 plays item 0x55's second part when the enemy is still standing, 2 waits.

The match depends on item 0x55's damage being 20 percent, on the row pointer of item 0x5A, on the stage being written out in each case and on the table being walked by index.

< its third enemy; winning plays the ending

Definition at line 141 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ healPartner()

static void healPartner ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Items 0x2B-0x41: heal the partner by the item's amount, up to its max HP.

Definition at line 257 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ cureStatus()

static void cureStatus ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Items 0x42-0x45: cure the partner of what FIGHTSTG_itemCures says, or say they do nothing.

Definition at line 287 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ reviveParty()

static void reviveParty ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x46: revives the partners knocked out to their max HP, then is taken from the bag and ends the task.

Definition at line 323 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ restoreHalfHpMp()

static void restoreHalfHpMp ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x47: restores half the partner's max HP and MP, or says it does nothing when both are full.

Definition at line 356 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ boostSpeed()

static void boostSpeed ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x48: raises the partner's speed by the item's amount in 128ths, up to double.

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

Definition at line 389 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ boostAttack()

static void boostAttack ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x49: raises the partner's attack and lowers its defense.

< physical damage

< against it

< physical damage

< against it

< against it

Definition at line 416 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ boostDefense()

static void boostDefense ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x4A: raises the partner's defense and lowers its attack.

< physical damage

< against it

< against it

< physical damage

< physical damage

Definition at line 452 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ startSpecial()

static void startSpecial ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x4B: puts the partner in its special state, which doubles its effects.

Definition at line 489 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ fillGauge()

static void fillGauge ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x4C: fills the partner's gauge by the item's amount, up to 999.

Definition at line 502 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ boostElement()

static void boostElement ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Items 0x4D-0x53: boost one element on the field.

Definition at line 520 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ boostRandomElement()

static void boostRandomElement ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x54: boosts the element its script picked at random on the field.

Definition at line 531 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ drainEnemy()

static void drainEnemy ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x55: drains the damage from the enemy to the partner, or says it does nothing when the battle blocks draining.

Definition at line 543 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ confuseFighters()

static void confuseFighters ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x56: confuses the enemy half of the time, unless the battle blocks it, and then the partner a quarter of those times.

Definition at line 574 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ weakenEnemyDefense()

static void weakenEnemyDefense ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x57: raises the enemy's attack and lowers its defense, or says it does nothing when the battle blocks it.

< physical damage

< against it

< physical damage

< against it

< physical damage

< against it

< against it

Definition at line 620 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ showLoweredStat()

static void showLoweredStat ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x58: says which of the enemy's stats its script lowered.

Definition at line 663 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ lowerEnemySpeed()

static void lowerEnemySpeed ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x59: lowers the enemy's speed, or says it does nothing when the battle blocks it.

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

< physical accuracy, evasion and running away

Definition at line 692 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ damageEnemy()

static void damageEnemy ( BattleItem *  task,
BattleChild *  children 
)
inlinestatic

Item 0x5A: deals its technique's damage to the enemy.

Definition at line 726 of file item.c.

Referenced by FIGHTSTG_updateItem().

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

◆ FIGHTSTG_updateItem()

void FIGHTSTG_updateItem ( BattleItem *  task,
BattleChild *  children 
)

An item used in battle (FIGHTSTG_startItem): its message, FIGHTSTG_runItemScript's script, then substate 1 does what the item does (healPartner to damageEnemy, one per item) and 2 takes it from the bag (item 0x55 attacks again in BATTLE_KIND_FINAL_LAST).

The match depends on each case's variables being its own, on item 0x47's halves being declared in its if, on its MP test being written maxMp <= mp + halfMp, on item 0x57's cap being read after the boosts change and on the cases that say the item does nothing ending on their own (item 0x2B's, 0x57's and 0x59's).

< its third enemy; winning plays the ending

Definition at line 759 of file item.c.

Referenced by FIGHTSTG_startItem().

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

◆ FIGHTSTG_startItem()

BattleItem * FIGHTSTG_startItem ( s32  item)

Starts an item's script (FIGHTSTG_updateItem)

Definition at line 870 of file item.c.

Referenced by WFIGHTMN_runCommand().

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

Variable Documentation

◆ FIGHTSTG_itemCures

StatusCure FIGHTSTG_itemCures[4]
Initial value:
= {
{ 0x28, 0x01, 190 },
{ 0x29, 0x02, 192 },
{ 0x2A, 0x04, 194 },
{ 0x2C, 0x3F, 196 },
}

what items 0x42-0x45 cure (FIGHTSTG_updateItem, below)

Definition at line 230 of file item.c.

Referenced by cureStatus().

◆ FIGHTSTG_itemScripts

ItemScript FIGHTSTG_itemScripts[]
Initial value:
= {
{ 0x2B, 0x21, 0x1F },
{ 0x2C, 0x21, 0x1F },
{ 0x2D, 0x21, 0x1F },
{ 0x2E, 0x21, 0x1F },
{ 0x42, 0x22, 0x1F },
{ 0x43, 0x22, 0x1F },
{ 0x44, 0x22, 0x1F },
{ 0x45, 0x22, 0x1F },
{ 0x46, 0x23, 0x1F },
{ 0x47, 0x21, 0x1F },
{ 0x48, 0x28, 0x1F },
{ 0x49, 0x24, 0x1F },
{ 0x4A, 0x26, 0x1F },
{ 0x4B, 0x2E, 0x1E },
{ 0x4C, 0x2E, 0x1E },
{ -1, 0, 0 },
}

the items' script settings (FIGHTSTG_runItemScript, above)

Definition at line 237 of file item.c.

Referenced by setItemScript().