sovereignx/src/fldeff_softboiled.c

85 lines
2.1 KiB
C
Raw Normal View History

2018-02-15 09:59:26 +00:00
#include "global.h"
#include "fldeff_softboiled.h"
#include "menu.h"
#include "party_menu.h"
#include "pokemon.h"
//#include "pokemon_menu.h"
#include "constants/songs.h"
#include "sound.h"
#include "sprite.h"
#include "string_util.h"
2018-02-15 09:59:26 +00:00
#include "strings.h"
#include "task.h"
void sub_816166C(u8 taskId);
void sub_81617B8(u8 taskId);
2018-02-15 10:35:27 +00:00
void sub_81616C0(u8 taskId);
void sub_8161724(u8 taskId);
2018-02-15 09:59:26 +00:00
bool8 SetUpFieldMove_SoftBoiled(void)
{
u16 maxHp;
u16 hp;
u16 minHp;
maxHp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_MAX_HP);
hp = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_HP);
minHp = (maxHp / 5);
if (hp > minHp)
{
return TRUE;
}
return FALSE;
}
void sub_8161560(u8 taskId)
{
gUnknown_0203CEC8.unkB = 0xA;
gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.unk9;
sub_81B0FCC(GetCursorSelectionMonId(), 0x1);
display_pokemon_menu_message(0x5);
gTasks[taskId].func = sub_81B1370;
}
void sub_81615A8(u8 taskId)
{
u16 hp;
u8 unk9 = gUnknown_0203CEC8.unk9;
u8 pokemonIndex = gUnknown_0203CEC8.unkA;
if(pokemonIndex > 6)
{
gUnknown_0203CEC8.unkB = 0;
display_pokemon_menu_message(0x0);
gTasks[taskId].func = sub_81B1370;
return;
}
hp = GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_HP);
if(hp == 0 || unk9 == pokemonIndex || GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_MAX_HP) == hp)
{
sub_81617B8(taskId);
return;
}
PlaySE(SE_KAIFUKU);
sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C);
}
2018-02-15 10:35:27 +00:00
void sub_816166C(u8 taskId)
{
2018-02-15 09:59:26 +00:00
PlaySE(SE_KAIFUKU);
2018-02-15 10:35:27 +00:00
sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAX_HP)/5, sub_81616C0);
2018-02-15 09:59:26 +00:00
}
void sub_81616C0(u8 taskId)
{
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
sub_81B1B5C(gStringVar4, 0);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161724;
2018-02-15 09:59:26 +00:00
}