Convert settotemboost command to callnative (#5418)
* settotemboost use callnative * Update src/battle_main.c --------- Co-authored-by: ghoulslash <pokevoyager0@gmail.com> Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
parent
16e8be1233
commit
d695a6240d
3 changed files with 17 additions and 18 deletions
|
@ -2105,15 +2105,15 @@
|
|||
@ The rest of the arguments are the stat change values to each stat.
|
||||
@ For example, giving the first opponent +1 to atk and -2 to speed would be: settotemboost B_POSITION_OPPONENT_LEFT, 1, 0, -2
|
||||
.macro settotemboost battler:req, atk=0,def=0,speed=0,spatk=0,spdef=0,acc=0,evas=0
|
||||
setvar VAR_0x8000, \battler
|
||||
setvar VAR_0x8001, \atk
|
||||
setvar VAR_0x8002, \def
|
||||
setvar VAR_0x8003, \speed
|
||||
setvar VAR_0x8004, \spatk
|
||||
setvar VAR_0x8005, \spdef
|
||||
setvar VAR_0x8006, \acc
|
||||
setvar VAR_0x8007, \evas
|
||||
special SetTotemBoost
|
||||
callnative ScriptSetTotemBoost
|
||||
.2byte \battler
|
||||
.2byte \atk
|
||||
.2byte \def
|
||||
.2byte \speed
|
||||
.2byte \spatk
|
||||
.2byte \spdef
|
||||
.2byte \acc
|
||||
.2byte \evas
|
||||
.endm
|
||||
|
||||
@ useful totem boost macros
|
||||
|
|
|
@ -534,7 +534,6 @@ gSpecials::
|
|||
def_special RemoveRecordsWindow
|
||||
def_special CloseDeptStoreElevatorWindow
|
||||
def_special TrySetBattleTowerLinkType
|
||||
def_special SetTotemBoost
|
||||
def_special TrySpecialOverworldEvo
|
||||
def_special GetNumberSprayStrength
|
||||
def_special GetSprayId
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "roamer.h"
|
||||
#include "safari_zone.h"
|
||||
#include "scanline_effect.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "string_util.h"
|
||||
|
@ -5935,21 +5936,20 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
|
|||
}
|
||||
}
|
||||
|
||||
// special to set a field's totem boost(s)
|
||||
// inputs:
|
||||
// var8000: battler
|
||||
// var8001 - var8007: stat changes
|
||||
void SetTotemBoost(void)
|
||||
// Queues stat boosts for a given battler for totem battles
|
||||
void ScriptSetTotemBoost(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 battler = gSpecialVar_0x8000;
|
||||
u32 battler = VarGet(ScriptReadHalfword(ctx));
|
||||
u32 stat;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < (NUM_BATTLE_STATS - 1); i++)
|
||||
{
|
||||
if (*(&gSpecialVar_0x8001 + i))
|
||||
stat = VarGet(ScriptReadHalfword(ctx));
|
||||
if (stat)
|
||||
{
|
||||
gQueuedStatBoosts[battler].stats |= (1 << i);
|
||||
gQueuedStatBoosts[battler].statChanges[i] = *(&gSpecialVar_0x8001 + i);
|
||||
gQueuedStatBoosts[battler].statChanges[i] = stat;
|
||||
gQueuedStatBoosts[battler].stats |= 0x80; // used as a flag for the "totem flared to life" script
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue