mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-08 17:15:51 -05:00
file split move effects target
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
.string "pksdir0\0"
|
||||
.string "pksdir0\0"
|
||||
.string "pksdir0\0"
|
||||
.string "pksdir0\0"
|
||||
@ HandleExplosion
|
||||
.string "pksdir0\0"
|
||||
|
||||
|
||||
@@ -587,6 +587,7 @@ SECTIONS {
|
||||
src/code_8073CF0.o(.rodata);
|
||||
src/code_8075708.o(.rodata);
|
||||
src/dungeon_ai.o(.rodata);
|
||||
src/move_effects_target.o(.rodata);
|
||||
data/data_8107010.o(.rodata);
|
||||
src/dungeon_serializer.o(.rodata);
|
||||
data/data_8107224.o(.rodata);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "globaldata.h"
|
||||
#include "move_effects_target.h"
|
||||
#include "dungeon_message.h"
|
||||
#include "code_806CD90.h"
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "dungeon_ai_attack.h"
|
||||
#include "dungeon_ai_items.h"
|
||||
#include "dungeon_ai_movement.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_map_access.h"
|
||||
@@ -31,7 +31,11 @@
|
||||
#include "dungeon_misc.h"
|
||||
#include "dungeon_config.h"
|
||||
#include "dungeon_strings.h"
|
||||
#include "status.h"
|
||||
#include "code_803E46C.h"
|
||||
|
||||
extern void sub_80420A0(Entity *);
|
||||
extern void sub_8041C58(Entity *r0);
|
||||
extern void sub_8041F28(Entity *, s32);
|
||||
extern void sub_8041F4C(Entity *, s32);
|
||||
extern void sub_8041F70(Entity *, s32);
|
||||
@@ -54,6 +58,15 @@ extern void nullsub_72(Entity *);
|
||||
extern void nullsub_71(Entity *);
|
||||
extern void nullsub_70(Entity *);
|
||||
extern void nullsub_69(Entity *, Entity *);
|
||||
extern void sub_8041CB8(Entity *r0);
|
||||
extern void sub_8041C1C(Entity *r0);
|
||||
extern void sub_8042060(Entity *, s32);
|
||||
extern void sub_8041FB4(Entity *r0, u32 r1);
|
||||
extern void sub_8041FD8(Entity *r0, u32 r1);
|
||||
extern void sub_804201C(Entity *r0, u32 r1);
|
||||
extern void sub_8041FFC(Entity *r0, u32 r1);
|
||||
extern void sub_8041CCC(Entity *);
|
||||
extern void sub_8042040(Entity *, s32);
|
||||
|
||||
u8 sub_8075BF4(Entity * pokemon, s32 sleepClassStatusTurns)
|
||||
{
|
||||
@@ -1052,3 +1065,402 @@ void RaiseDefenseStageTarget(Entity * pokemon, Entity * target, s32 index, s32 i
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
u8 GetFlashFireStatus(Entity *pokemon)
|
||||
{
|
||||
if (!EntityIsValid(pokemon) || !AbilityIsActive(pokemon, ABILITY_FLASH_FIRE))
|
||||
{
|
||||
return FLASH_FIRE_STATUS_NONE;
|
||||
}
|
||||
if (GetEntInfo(pokemon)->flashFireBoost > 1)
|
||||
{
|
||||
return FLASH_FIRE_STATUS_MAXED;
|
||||
}
|
||||
return FLASH_FIRE_STATUS_NOT_MAXED;
|
||||
}
|
||||
|
||||
static inline s32 UpdateFlashFireBoost_sub(EntityInfo * entityInfo)
|
||||
{
|
||||
s32 flashFireBoost;
|
||||
|
||||
flashFireBoost = entityInfo->flashFireBoost;
|
||||
flashFireBoost++;
|
||||
if (FLASH_FIRE_STATUS_MAXED < flashFireBoost) {
|
||||
flashFireBoost = FLASH_FIRE_STATUS_NOT_MAXED;
|
||||
}
|
||||
return flashFireBoost;
|
||||
}
|
||||
|
||||
void UpdateFlashFireBoost(Entity * pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo * entityInfo;
|
||||
s32 flashFireBoost;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
flashFireBoost = UpdateFlashFireBoost_sub(entityInfo);
|
||||
if (entityInfo->flashFireBoost != flashFireBoost) {
|
||||
entityInfo->flashFireBoost = flashFireBoost;
|
||||
sub_8041C58(target);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeAttackMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s24_8 param_4, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
s24_8 oldMulti;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (statStage != STAT_STAGE_ATK) {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC0C8);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC0B8);
|
||||
}
|
||||
if (F248LessThanInt(param_4, 1) && sub_8071728(pokemon,target,displayMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((HasHeldItem(target,ITEM_TWIST_BAND)) && F248LessThanInt(param_4, 1)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FD550);
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbilityIsActive(target, ABILITY_HYPER_CUTTER) && (statStage == STAT_STAGE_ATK) && F248LessThanInt(param_4, 1)) {
|
||||
if (displayMessage) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCA60);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
oldMulti = entityInfo->offensiveMultipliers[statStage];
|
||||
|
||||
if (F248LessThanInt(param_4, 1)) {
|
||||
sub_8041FD8(target,statStage);
|
||||
}
|
||||
else {
|
||||
sub_8041FB4(target,statStage);
|
||||
}
|
||||
|
||||
entityInfo->offensiveMultipliers[statStage] = s24_8_mul(entityInfo->offensiveMultipliers[statStage],param_4);
|
||||
|
||||
if (F248LessThanFloat(entityInfo->offensiveMultipliers[statStage], 0.01)) {
|
||||
entityInfo->offensiveMultipliers[statStage] = FloatToF248(0.01);
|
||||
}
|
||||
if (FloatLessThanF248(99.99, entityInfo->offensiveMultipliers[statStage])) {
|
||||
entityInfo->offensiveMultipliers[statStage] = FloatToF248(99.99);
|
||||
}
|
||||
if (F248GreaterThan(oldMulti, entityInfo->offensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC11C);
|
||||
}
|
||||
else if (F248LessThan(oldMulti, entityInfo->offensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC118);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC184);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void ChangeDefenseMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s24_8 param_4, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
s24_8 oldMulti;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (statStage != STAT_STAGE_DEF) {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC0AC);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC09C);
|
||||
}
|
||||
if (F248LessThanInt(param_4, 1) && sub_8071728(pokemon,target,displayMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
oldMulti = entityInfo->defensiveMultipliers[statStage];
|
||||
|
||||
if (F248LessThanInt(param_4, 1)) {
|
||||
sub_804201C(target,statStage);
|
||||
}
|
||||
else {
|
||||
sub_8041FFC(target,statStage);
|
||||
}
|
||||
|
||||
entityInfo->defensiveMultipliers[statStage] = s24_8_mul(entityInfo->defensiveMultipliers[statStage],param_4);
|
||||
|
||||
if (F248LessThanFloat(entityInfo->defensiveMultipliers[statStage], 0.01)) {
|
||||
entityInfo->defensiveMultipliers[statStage] = FloatToF248(0.01);
|
||||
}
|
||||
if (FloatLessThanF248(99.99, entityInfo->defensiveMultipliers[statStage])) {
|
||||
entityInfo->defensiveMultipliers[statStage] = FloatToF248(99.99);
|
||||
}
|
||||
if (F248GreaterThan(oldMulti, entityInfo->defensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC114);
|
||||
}
|
||||
else if (F248LessThan(oldMulti, entityInfo->defensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC0FC);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC180);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void RaiseAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
sub_8042040(target,statStage);
|
||||
if (statStage != STAT_STAGE_ACCURACY) {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC090);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC084);
|
||||
}
|
||||
if (entityInfo->hitChanceStages[statStage] < MAX_STAT_STAGE) {
|
||||
entityInfo->hitChanceStages[statStage]++;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC1C4);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC218);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void LowerAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
if (statStage != STAT_STAGE_ACCURACY) {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC090);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],gUnknown_80FC084);
|
||||
}
|
||||
if (!sub_8071728(pokemon,target,displayMessage)) {
|
||||
if (AbilityIsActive(target, ABILITY_KEEN_EYE) && (statStage == STAT_STAGE_ACCURACY)){
|
||||
if(displayMessage)
|
||||
{
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCA64);
|
||||
}
|
||||
}
|
||||
else {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
sub_8042060(target,statStage);
|
||||
if (entityInfo->hitChanceStages[statStage] != 0) {
|
||||
entityInfo->hitChanceStages[statStage]--;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC1A4);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC1F0);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CringeStatusTarget(Entity * pokemon,Entity * target, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
if (!HasSafeguardStatus(pokemon, target, displayMessage)) {
|
||||
if (AbilityIsActive(target, ABILITY_INNER_FOCUS)){
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if(displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCC18);
|
||||
}
|
||||
else {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if(entityInfo->cringeClassStatus.status != STATUS_CRINGE)
|
||||
{
|
||||
entityInfo->cringeClassStatus.status = STATUS_CRINGE;
|
||||
entityInfo->cringeClassStatus.turns = CalculateStatusTurns(target, gCringeTurnRange, TRUE) + 1;
|
||||
sub_80420A0(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB2E0);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB300);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParalyzeStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage)
|
||||
{
|
||||
const Tile *mapTile;
|
||||
EntityInfo *entityInfo;
|
||||
Entity *mapPokemonEntity;
|
||||
int index;
|
||||
bool8 bVar6;
|
||||
bool8 bVar7;
|
||||
|
||||
if ((EntityIsValid(target)) && (!HasSafeguardStatus(pokemon,target,displayMessage))) {
|
||||
if (AbilityIsActive(target, ABILITY_LIMBER)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (displayMessage) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCBF8);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bVar6 = TRUE;
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->burnClassStatus.status != STATUS_PARALYSIS) {
|
||||
entityInfo->burnClassStatus.status = STATUS_PARALYSIS;
|
||||
entityInfo->burnClassStatus.turns = CalculateStatusTurns(target,gParalysisTurnRange,TRUE) + 1;
|
||||
entityInfo->burnClassStatus.damageCountdown = 0;
|
||||
entityInfo->burnClassStatus.unk4 = 0;
|
||||
bVar6 = FALSE;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB2AC);
|
||||
sub_8041C1C(target);
|
||||
CalcSpeedStage(target);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FB2CC);
|
||||
}
|
||||
if ((AbilityIsActive(target, ABILITY_SYNCHRONIZE)) && (!bVar6)) {
|
||||
bVar7 = FALSE;
|
||||
|
||||
for(index = 0; index < NUM_DIRECTIONS; index++)
|
||||
{
|
||||
mapTile = GetTile(target->pos.x + gAdjacentTileOffsets[index].x,target->pos.y + gAdjacentTileOffsets[index].y);
|
||||
mapPokemonEntity = mapTile->monster;
|
||||
if ((EntityIsValid(mapPokemonEntity)) && (GetEntityType(mapPokemonEntity) == ENTITY_MONSTER)) {
|
||||
if (!bVar7) {
|
||||
bVar7 = TRUE;
|
||||
SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FF01C);
|
||||
}
|
||||
if (sub_807167C(target,mapPokemonEntity) == 1) {
|
||||
ParalyzeStatusTarget(pokemon, mapPokemonEntity, displayMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RaiseMovementSpeedTarget(Entity * pokemon, Entity * target, s32 turns, bool8 displayMessage)
|
||||
{
|
||||
s32 movSpeed;
|
||||
s32 index;
|
||||
s32 movSpeed_1;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
if (turns == 0) {
|
||||
turns = CalculateStatusTurns(target,gSpeedRaiseTurnRange,FALSE) + 1;
|
||||
}
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
movSpeed = CalcSpeedStage(target);
|
||||
if (movSpeed == MAX_SPEED_STAGE) {
|
||||
if (displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC2B8);
|
||||
}
|
||||
else {
|
||||
for(index = 0; index < NUM_SPEED_COUNTERS; index++)
|
||||
{
|
||||
if(entityInfo->speedUpCounters[index] == 0)
|
||||
{
|
||||
entityInfo->speedUpCounters[index] = turns;
|
||||
break;
|
||||
}
|
||||
}
|
||||
movSpeed_1 = CalcSpeedStage(target);
|
||||
if (movSpeed == movSpeed_1) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC298);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8041CB8(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FA124[movSpeed_1]);
|
||||
entityInfo->speedStageChanged = TRUE;
|
||||
entityInfo->attacking = FALSE;
|
||||
}
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void LowerMovementSpeedTarget(Entity * pokemon, Entity * target, s32 levels, bool8 displayMessage)
|
||||
{
|
||||
s32 movSpeed;
|
||||
s32 counter;
|
||||
s32 index;
|
||||
s32 movSpeed_1;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
if (HasSafeguardStatus(pokemon,target,displayMessage)) {
|
||||
return;
|
||||
}
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
movSpeed = CalcSpeedStage(target);
|
||||
if (movSpeed == 0) {
|
||||
if (displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC2D8);
|
||||
}
|
||||
else {
|
||||
for(counter = 0; counter < levels; counter++)
|
||||
{
|
||||
for(index = 0; index < NUM_SPEED_COUNTERS; index++)
|
||||
{
|
||||
if (entityInfo->speedDownCounters[index]== 0) {
|
||||
entityInfo->speedDownCounters[index] = CalculateStatusTurns(target,gSpeedLowerTurnRange,TRUE) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
movSpeed_1 = CalcSpeedStage(target);
|
||||
if (movSpeed == movSpeed_1) {
|
||||
if (displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC298);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8041CCC(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FA124[movSpeed_1]);
|
||||
}
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
|
||||
409
src/status.c
409
src/status.c
@@ -147,416 +147,9 @@ extern bool8 sub_8045888(Entity *r0);
|
||||
extern void sub_803ED30(s32, Entity *r0, u8, s32);
|
||||
extern void sub_8041BF8(Entity *);
|
||||
extern void sub_8041BE8(Entity *);
|
||||
extern void sub_8041CCC(Entity *);
|
||||
extern void sub_8041CB8(Entity *r0);
|
||||
extern void sub_8041C1C(Entity *r0);
|
||||
extern void sub_8042060(Entity *, s32);
|
||||
extern void sub_8041FB4(Entity *r0, u32 r1);
|
||||
extern void sub_8041FD8(Entity *r0, u32 r1);
|
||||
extern void sub_804201C(Entity *r0, u32 r1);
|
||||
extern void sub_8041FFC(Entity *r0, u32 r1);
|
||||
extern void sub_8041C58(Entity *r0);
|
||||
extern void EntityUpdateStatusSprites(Entity *);
|
||||
extern void sub_8042040(Entity *, s32);
|
||||
extern void sub_80420A0(Entity *);
|
||||
|
||||
u8 GetFlashFireStatus(Entity *pokemon)
|
||||
{
|
||||
if (!EntityIsValid(pokemon) || !AbilityIsActive(pokemon, ABILITY_FLASH_FIRE))
|
||||
{
|
||||
return FLASH_FIRE_STATUS_NONE;
|
||||
}
|
||||
if (GetEntInfo(pokemon)->flashFireBoost > 1)
|
||||
{
|
||||
return FLASH_FIRE_STATUS_MAXED;
|
||||
}
|
||||
return FLASH_FIRE_STATUS_NOT_MAXED;
|
||||
}
|
||||
|
||||
static inline s32 UpdateFlashFireBoost_sub(EntityInfo * entityInfo)
|
||||
{
|
||||
s32 flashFireBoost;
|
||||
|
||||
flashFireBoost = entityInfo->flashFireBoost;
|
||||
flashFireBoost++;
|
||||
if (FLASH_FIRE_STATUS_MAXED < flashFireBoost) {
|
||||
flashFireBoost = FLASH_FIRE_STATUS_NOT_MAXED;
|
||||
}
|
||||
return flashFireBoost;
|
||||
}
|
||||
|
||||
void UpdateFlashFireBoost(Entity * pokemon, Entity *target)
|
||||
{
|
||||
EntityInfo * entityInfo;
|
||||
s32 flashFireBoost;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
flashFireBoost = UpdateFlashFireBoost_sub(entityInfo);
|
||||
if (entityInfo->flashFireBoost != flashFireBoost) {
|
||||
entityInfo->flashFireBoost = flashFireBoost;
|
||||
sub_8041C58(target);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeAttackMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s24_8 param_4, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
s24_8 oldMulti;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (statStage != STAT_STAGE_ATK) {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC0C8);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC0B8);
|
||||
}
|
||||
if (F248LessThanInt(param_4, 1) && sub_8071728(pokemon,target,displayMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((HasHeldItem(target,ITEM_TWIST_BAND)) && F248LessThanInt(param_4, 1)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FD550);
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbilityIsActive(target, ABILITY_HYPER_CUTTER) && (statStage == STAT_STAGE_ATK) && F248LessThanInt(param_4, 1)) {
|
||||
if (displayMessage) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCA60);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
oldMulti = entityInfo->offensiveMultipliers[statStage];
|
||||
|
||||
if (F248LessThanInt(param_4, 1)) {
|
||||
sub_8041FD8(target,statStage);
|
||||
}
|
||||
else {
|
||||
sub_8041FB4(target,statStage);
|
||||
}
|
||||
|
||||
entityInfo->offensiveMultipliers[statStage] = s24_8_mul(entityInfo->offensiveMultipliers[statStage],param_4);
|
||||
|
||||
if (F248LessThanFloat(entityInfo->offensiveMultipliers[statStage], 0.01)) {
|
||||
entityInfo->offensiveMultipliers[statStage] = FloatToF248(0.01);
|
||||
}
|
||||
if (FloatLessThanF248(99.99, entityInfo->offensiveMultipliers[statStage])) {
|
||||
entityInfo->offensiveMultipliers[statStage] = FloatToF248(99.99);
|
||||
}
|
||||
if (F248GreaterThan(oldMulti, entityInfo->offensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC11C);
|
||||
}
|
||||
else if (F248LessThan(oldMulti, entityInfo->offensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC118);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC184);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void ChangeDefenseMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s24_8 param_4, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
s24_8 oldMulti;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (statStage != STAT_STAGE_DEF) {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC0AC);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC09C);
|
||||
}
|
||||
if (F248LessThanInt(param_4, 1) && sub_8071728(pokemon,target,displayMessage)) {
|
||||
return;
|
||||
}
|
||||
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
oldMulti = entityInfo->defensiveMultipliers[statStage];
|
||||
|
||||
if (F248LessThanInt(param_4, 1)) {
|
||||
sub_804201C(target,statStage);
|
||||
}
|
||||
else {
|
||||
sub_8041FFC(target,statStage);
|
||||
}
|
||||
|
||||
entityInfo->defensiveMultipliers[statStage] = s24_8_mul(entityInfo->defensiveMultipliers[statStage],param_4);
|
||||
|
||||
if (F248LessThanFloat(entityInfo->defensiveMultipliers[statStage], 0.01)) {
|
||||
entityInfo->defensiveMultipliers[statStage] = FloatToF248(0.01);
|
||||
}
|
||||
if (FloatLessThanF248(99.99, entityInfo->defensiveMultipliers[statStage])) {
|
||||
entityInfo->defensiveMultipliers[statStage] = FloatToF248(99.99);
|
||||
}
|
||||
if (F248GreaterThan(oldMulti, entityInfo->defensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC114);
|
||||
}
|
||||
else if (F248LessThan(oldMulti, entityInfo->defensiveMultipliers[statStage])) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC0FC);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC180);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void RaiseAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
sub_8042040(target,statStage);
|
||||
if (statStage != STAT_STAGE_ACCURACY) {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC090);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC084);
|
||||
}
|
||||
if (entityInfo->hitChanceStages[statStage] < MAX_STAT_STAGE) {
|
||||
entityInfo->hitChanceStages[statStage]++;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC1C4);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC218);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
|
||||
void LowerAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
if (statStage != STAT_STAGE_ACCURACY) {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC090);
|
||||
}
|
||||
else {
|
||||
strcpy(gFormatBuffer_Items[0],*gUnknown_80FC084);
|
||||
}
|
||||
if (!sub_8071728(pokemon,target,displayMessage)) {
|
||||
if (AbilityIsActive(target, ABILITY_KEEN_EYE) && (statStage == STAT_STAGE_ACCURACY)){
|
||||
if(displayMessage)
|
||||
{
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCA64);
|
||||
}
|
||||
}
|
||||
else {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
sub_8042060(target,statStage);
|
||||
if (entityInfo->hitChanceStages[statStage] != 0) {
|
||||
entityInfo->hitChanceStages[statStage]--;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC1A4);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC1F0);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CringeStatusTarget(Entity * pokemon,Entity * target, bool8 displayMessage)
|
||||
{
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (EntityIsValid(target)) {
|
||||
if (!HasSafeguardStatus(pokemon, target, displayMessage)) {
|
||||
if (AbilityIsActive(target, ABILITY_INNER_FOCUS)){
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if(displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCC18);
|
||||
}
|
||||
else {
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if(entityInfo->cringeClassStatus.status != STATUS_CRINGE)
|
||||
{
|
||||
entityInfo->cringeClassStatus.status = STATUS_CRINGE;
|
||||
entityInfo->cringeClassStatus.turns = CalculateStatusTurns(target, gCringeTurnRange, TRUE) + 1;
|
||||
sub_80420A0(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB2E0);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB300);
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParalyzeStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage)
|
||||
{
|
||||
const Tile *mapTile;
|
||||
EntityInfo *entityInfo;
|
||||
Entity *mapPokemonEntity;
|
||||
int index;
|
||||
bool8 bVar6;
|
||||
bool8 bVar7;
|
||||
|
||||
if ((EntityIsValid(target)) && (!HasSafeguardStatus(pokemon,target,displayMessage))) {
|
||||
if (AbilityIsActive(target, ABILITY_LIMBER)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (displayMessage) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCBF8);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bVar6 = TRUE;
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
if (entityInfo->burnClassStatus.status != STATUS_PARALYSIS) {
|
||||
entityInfo->burnClassStatus.status = STATUS_PARALYSIS;
|
||||
entityInfo->burnClassStatus.turns = CalculateStatusTurns(target,gParalysisTurnRange,TRUE) + 1;
|
||||
entityInfo->burnClassStatus.damageCountdown = 0;
|
||||
entityInfo->burnClassStatus.unk4 = 0;
|
||||
bVar6 = FALSE;
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB2AC);
|
||||
sub_8041C1C(target);
|
||||
CalcSpeedStage(target);
|
||||
}
|
||||
else {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FB2CC);
|
||||
}
|
||||
if ((AbilityIsActive(target, ABILITY_SYNCHRONIZE)) && (!bVar6)) {
|
||||
bVar7 = FALSE;
|
||||
|
||||
for(index = 0; index < NUM_DIRECTIONS; index++)
|
||||
{
|
||||
mapTile = GetTile(target->pos.x + gAdjacentTileOffsets[index].x,target->pos.y + gAdjacentTileOffsets[index].y);
|
||||
mapPokemonEntity = mapTile->monster;
|
||||
if ((EntityIsValid(mapPokemonEntity)) && (GetEntityType(mapPokemonEntity) == ENTITY_MONSTER)) {
|
||||
if (!bVar7) {
|
||||
bVar7 = TRUE;
|
||||
SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FF01C);
|
||||
}
|
||||
if (sub_807167C(target,mapPokemonEntity) == 1) {
|
||||
ParalyzeStatusTarget(pokemon, mapPokemonEntity, displayMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RaiseMovementSpeedTarget(Entity * pokemon, Entity * target, s32 turns, bool8 displayMessage)
|
||||
{
|
||||
s32 movSpeed;
|
||||
s32 index;
|
||||
s32 movSpeed_1;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
if (turns == 0) {
|
||||
turns = CalculateStatusTurns(target,gSpeedRaiseTurnRange,FALSE) + 1;
|
||||
}
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
movSpeed = CalcSpeedStage(target);
|
||||
if (movSpeed == MAX_SPEED_STAGE) {
|
||||
if (displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC2B8);
|
||||
}
|
||||
else {
|
||||
for(index = 0; index < NUM_SPEED_COUNTERS; index++)
|
||||
{
|
||||
if(entityInfo->speedUpCounters[index] == 0)
|
||||
{
|
||||
entityInfo->speedUpCounters[index] = turns;
|
||||
break;
|
||||
}
|
||||
}
|
||||
movSpeed_1 = CalcSpeedStage(target);
|
||||
if (movSpeed == movSpeed_1) {
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC298);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8041CB8(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FA124[movSpeed_1]);
|
||||
entityInfo->speedStageChanged = TRUE;
|
||||
entityInfo->attacking = FALSE;
|
||||
}
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
|
||||
void LowerMovementSpeedTarget(Entity * pokemon, Entity * target, s32 levels, bool8 displayMessage)
|
||||
{
|
||||
s32 movSpeed;
|
||||
s32 counter;
|
||||
s32 index;
|
||||
s32 movSpeed_1;
|
||||
EntityInfo *entityInfo;
|
||||
|
||||
if (!EntityIsValid(target)) {
|
||||
return;
|
||||
}
|
||||
if (HasSafeguardStatus(pokemon,target,displayMessage)) {
|
||||
return;
|
||||
}
|
||||
entityInfo = GetEntInfo(target);
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
|
||||
movSpeed = CalcSpeedStage(target);
|
||||
if (movSpeed == 0) {
|
||||
if (displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC2D8);
|
||||
}
|
||||
else {
|
||||
for(counter = 0; counter < levels; counter++)
|
||||
{
|
||||
for(index = 0; index < NUM_SPEED_COUNTERS; index++)
|
||||
{
|
||||
if (entityInfo->speedDownCounters[index]== 0) {
|
||||
entityInfo->speedDownCounters[index] = CalculateStatusTurns(target,gSpeedLowerTurnRange,TRUE) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
movSpeed_1 = CalcSpeedStage(target);
|
||||
if (movSpeed == movSpeed_1) {
|
||||
if (displayMessage)
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC298);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8041CCC(target);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FA124[movSpeed_1]);
|
||||
}
|
||||
}
|
||||
EntityUpdateStatusSprites(target);
|
||||
}
|
||||
// FILE SPLIT
|
||||
|
||||
void ConfuseStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user