30 ownerId, targetId, 1);
31 if (useResult != -1) {
80 if (effect->
range == 0xff && partyResultShown != 0)
84 for (targetIndex = 0; targetIndex < menu->
partyCount; targetIndex++) {
85 if (effect->
range == 0xff) {
86 targetId = menu->
ownerIds[targetIndex];
90 amount = effect->
power;
91 switch (effect->
flags & 0xf) {
93 if (fixedScale == 0) {
105 if (target->
hp <= 0) {
106 if (partyResultShown == 0)
109 if (target->
hp == target->
maxHp) {
110 if (partyResultShown == 0)
113 target->
hp += amount;
114 if (target->
hp > target->
maxHp) {
115 amount -= target->
hp - target->
maxHp;
117 if (partyResultShown == 0)
119 }
else if (partyResultShown == 0) {
124 if (effect->
range == 0xff) {
125 partyResultShown = 1;
133 randomAdjust = (
Random16() * 4) >> 16;
134 if (randomAdjust == 0) {
137 randomDifference = 1 ^ randomAdjust;
138 randomAdjust = (
u32)((-randomDifference) | randomDifference) >> 31;
139 randomAdjust = 1 - randomAdjust;
144 target->
baseHp += amount + randomAdjust;
145 messageOffset = 0x10;
149 target->
basePp += amount + randomAdjust;
150 messageOffset = 0x11;
155 messageOffset = 0x12;
160 messageOffset = 0x13;
166 messageOffset = 0x14;
172 messageOffset = 0x15;
179 if (target->
pp == target->
maxPp) {
180 if (partyResultShown == 0)
183 target->
pp += amount;
184 if (target->
pp > target->
maxPp) {
185 amount -= target->
pp - target->
maxPp;
187 if (partyResultShown == 0)
189 }
else if (partyResultShown == 0) {
194 if (effect->
range == 0xff) {
195 partyResultShown = 1;
214 if (target->
hp <= 0 || target->
hp == target->
maxHp) {
215 if (partyResultShown == 0)
218 target->
hp += amount;
219 if (target->
hp > target->
maxHp) {
221 if (partyResultShown == 0)
223 }
else if (partyResultShown == 0) {
232 if (target->
pp == target->
maxPp) {
233 if (partyResultShown == 0)
236 target->
pp += amount;
237 if (target->
pp > target->
maxPp) {
239 if (partyResultShown == 0)
241 }
else if (partyResultShown == 0) {
250 if (target->
hp == 0) {
254 if (partyResultShown == 0)
256 }
else if (partyResultShown == 0) {
262 if (target->
hp == 0) {
263 target->
hp = target->
maxHp / 2;
265 if (partyResultShown == 0)
267 }
else if (partyResultShown == 0) {
273 if (target->
hp == 0) {
274 target->
hp = target->
maxHp * 7 / 10;
276 if (partyResultShown == 0)
278 }
else if (partyResultShown == 0) {
284 if (target->
poison != 0) {
287 if (partyResultShown == 0)
289 }
else if (partyResultShown == 0) {
295 if (effect->
range != 0xff)
304 for (targetIndex = 0; targetIndex < menu->
partyCount; targetIndex++)
323 animationType = 0xf & actionDefinition->
flags;
324 switch (animationType) {
335 targetType = actionDefinition->
effect - 1;
336 switch (targetType) {
@ ABILITY_EFFECT_REVIVE_HALF
Quartz.
@ ABILITY_EFFECT_REVIVE_80
Dew: 80% of max HP.
@ ABILITY_EFFECT_REVIVE
Revive, Water of Life: full HP.
@ ABILITY_EFFECT_CURE_POISON
Cure Poison, Antidote.
void Palette_LightenBankHighlight(s32 bank)
Copies the last background palette (15) into background palette bank and lightens its colour 4 by 9 s...
void Palette_CopyObjectBankToBackground14(void)
Copies the first sprite palette into background palette 14, then colour 4 of background palette 15 ov...
s32 Audio_PlayCueReturnOne(s32 cue)
struct BattleUnit * UnitGetFar(u32 owner)
struct ItemDefinition * Item_GetDirectFar(s32 item)
void UnitRatioFar(s32 owner_id)
struct BattleAct * BattleActGet(s32 actionId)
Far call to BattleAction_GetDirect.
s32 Inventory_RemoveFar(s32 owner, s32 slot)
s32 BattleRecoveryCalc(s32 power, s32 element, s32 rate)
Far call to Battle_CalcRecovery.
void UnitCalcFar(s32 owner)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
s32 ItemMenu_CollectItems(struct BattleUnit *unit, u16 *items, s32 mode)
Copies the unit's items into the list items (32 entries), skipping empty slots and clearing the rest.
u32 Random16(void)
Advances the game's random number generator (the C library's classic linear congruential one),...
An ability's definition, a row of gBattleAction_DefinitionTable: its targeting, kind,...
u8 effect
enum AbilityEffect
u8 range
the aimed unit and range - 1 either side, or ABILITY_RANGE_ALL
u8 flags
bits: 7 usable in battle | 6 usable in the field | 5..4 clear in every row | 3..0 kind (ABILITY_KIND_...
u16 power
what the kind applies, 0 for none
s16 power
Elemental power in the element.
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u16 baseDefense
before equipment, Djinn, class and stages
u16 baseAttack
before equipment, Djinn, class and stages
u16 baseAgility
before equipment, Djinn, class and stages
s16 maxPp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s8 poison
1 poisoned, 2 deadly poison
s16 hp
current HP, 0 when downed
struct BattleElementStats element[4]
Power and resistance in each element, 0 to 200, after equipment, element levels and Resistance stages...
u8 baseLuck
before equipment, Djinn and class
s16 basePp
before equipment, Djinn and class (UnitCalc)
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s16 baseHp
before equipment, Djinn and class (UnitCalc)
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
An item's definition: its price, type, who can equip it, its bonuses and unleash, its effects and the...
u8 useType
what using it costs (ITEM_USE_), or 0 for nothing
u16 actionId
the ability used, or taught as Psynergy
void Item_PlayUseAnimation(u32 item)
Runs the animation selected by the item's action definition.
void Item_PrepareUsePalette(void)
Copies and lightens the palette used by the item-use animation.
void Ability_PlayUseAnimation(s32 action)
Starts the action's menu animation and waits for its completion.
s32 Menu_ReservedStatusZero(void)
void Item_UseNoOpCallback(void)
Reserved empty callback during an item's menu animation.
s32 Item_Use(s32 slot, s32 ownerId, s32 targetId)
Applies the slot's action, then consumes or transforms the item on success.
s32 BattleEffect_ApplyToTargets(s32 effectId, s32 sourceId, s32 targetId, s32 fixedScale)
Applies healing or permanent-stat effects to one member or the whole party.