mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Item config for repel prompt
This commit is contained in:
parent
2d78ac0192
commit
e3005e5275
@ -30,6 +30,7 @@
|
||||
#include "constants/frontier_util.h"
|
||||
#include "constants/game_stat.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/item_config.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/heal_locations.h"
|
||||
#include "constants/layouts.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
EventScript_RepelWoreOff::
|
||||
checkitem VAR_LAST_REPEL_USED, 1
|
||||
checkitem I_VAR_LAST_REPEL_LURE_USED, 1
|
||||
compare VAR_RESULT, TRUE
|
||||
goto_if_eq EventScript_UseAnother
|
||||
lock
|
||||
@ -16,11 +16,11 @@ EventScript_UseAnother:
|
||||
end
|
||||
|
||||
EventScript_UsedRepel:
|
||||
bufferitemname 0, VAR_LAST_REPEL_USED
|
||||
bufferitemname 0, I_VAR_LAST_REPEL_LURE_USED
|
||||
playse SE_REPEL
|
||||
lock
|
||||
msgbox Text_UsedNewRepelLure, MSGBOX_SIGN
|
||||
removeitem VAR_LAST_REPEL_USED, 1
|
||||
removeitem I_VAR_LAST_REPEL_LURE_USED, 1
|
||||
waitse
|
||||
callnative HandleUseExpiredRepel
|
||||
release
|
||||
@ -38,7 +38,7 @@ Text_UsedNewRepelLure::
|
||||
.string "{STR_VAR_1}.$"
|
||||
|
||||
EventScript_LureWoreOff::
|
||||
checkitem VAR_LAST_REPEL_USED, 1
|
||||
checkitem I_VAR_LAST_REPEL_LURE_USED, 1
|
||||
compare VAR_RESULT, TRUE
|
||||
goto_if_eq EventScript_LureUseAnother
|
||||
lock
|
||||
@ -55,11 +55,11 @@ EventScript_LureUseAnother:
|
||||
end
|
||||
|
||||
EventScript_UsedLure:
|
||||
bufferitemname 0, VAR_LAST_REPEL_USED
|
||||
bufferitemname 0, I_VAR_LAST_REPEL_LURE_USED
|
||||
playse SE_REPEL
|
||||
lock
|
||||
msgbox Text_UsedNewRepelLure, MSGBOX_SIGN
|
||||
removeitem VAR_LAST_REPEL_USED, 1
|
||||
removeitem I_VAR_LAST_REPEL_LURE_USED, 1
|
||||
waitse
|
||||
callnative HandleUseExpiredLure
|
||||
release
|
||||
|
@ -9,4 +9,9 @@
|
||||
#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP.
|
||||
#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat.
|
||||
|
||||
// Var settings
|
||||
// To use the following features, replace the 0s with the var ID you're assigning it to.
|
||||
// Eg: Replace with VAR_UNUSED_0x40F7 so you can use I_VAR_LAST_REPEL_LURE_USED for that feature.
|
||||
#define I_VAR_LAST_REPEL_LURE_USED 0 // If this var has been assigned, B2W2's Repel prompt will trigger once it runs out. It also applies to Lures.
|
||||
|
||||
#endif // GUARD_CONSTANTS_ITEM_CONFIG_H
|
||||
|
@ -271,7 +271,7 @@
|
||||
#define VAR_UNUSED_0x40FC 0x40FC // Unused Var
|
||||
#define VAR_UNUSED_0x40FD 0x40FD // Unused Var
|
||||
#define VAR_UNUSED_0x40FE 0x40FE // Unused Var
|
||||
#define VAR_LAST_REPEL_USED 0x40FF // Unused Var
|
||||
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
|
||||
|
||||
#define VARS_END 0x40FF
|
||||
#define VARS_COUNT (VARS_END - VARS_START + 1)
|
||||
|
@ -873,7 +873,9 @@ static void Task_UseRepel(u8 taskId)
|
||||
if (!IsSEPlaying())
|
||||
{
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
|
||||
VarSet(VAR_LAST_REPEL_USED, gSpecialVar_ItemId);
|
||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
||||
#endif
|
||||
RemoveUsedItem();
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
|
||||
@ -883,7 +885,9 @@ static void Task_UseRepel(u8 taskId)
|
||||
}
|
||||
void HandleUseExpiredRepel(void)
|
||||
{
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_USED)));
|
||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(I_VAR_LAST_REPEL_LURE_USED)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_Lure(u8 taskId)
|
||||
@ -913,7 +917,9 @@ static void Task_UseLure(u8 taskId)
|
||||
if (!IsSEPlaying())
|
||||
{
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId) | REPEL_LURE_MASK);
|
||||
VarSet(VAR_LAST_REPEL_USED, gSpecialVar_ItemId);
|
||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||
VarSet(I_VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
|
||||
#endif
|
||||
RemoveUsedItem();
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
|
||||
@ -924,7 +930,9 @@ static void Task_UseLure(u8 taskId)
|
||||
|
||||
void HandleUseExpiredLure(void)
|
||||
{
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_USED)) | REPEL_LURE_MASK);
|
||||
#if I_VAR_LAST_REPEL_LURE_USED != 0
|
||||
VarSet(VAR_REPEL_LURE_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(I_VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Task_UsedBlackWhiteFlute(u8 taskId)
|
||||
|
@ -968,7 +968,7 @@ static bool8 IsWildLevelAllowedByRepel(u8 wildLevel)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (!VarGet(VAR_REPEL_LURE_STEP_COUNT))
|
||||
if (!REPEL_STEPS(VarGet(VAR_REPEL_LURE_STEP_COUNT)))
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user