mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
add wandering spirit
This commit is contained in:
parent
e66820e646
commit
bbd09fdcf7
@ -1580,6 +1580,10 @@
|
||||
.macro showabilitypopup battler:req
|
||||
various \battler, VARIOUS_ABILITY_POPUP
|
||||
.endm
|
||||
|
||||
.macro updateabilitypopup battler:req
|
||||
various \battler, VARIOUS_UPDATE_ABILITY_POPUP
|
||||
.endm
|
||||
|
||||
.macro defogclear battler:req, clear:req, ptr:req
|
||||
various \battler, VARIOUS_DEFOG
|
||||
@ -1825,6 +1829,10 @@
|
||||
various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER
|
||||
.endm
|
||||
|
||||
.macro swapabilities
|
||||
various BS_ATTACKER, VARIOUS_SWAP_ABILITIES
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat:req, stages:req, down:req
|
||||
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
|
||||
|
@ -7676,6 +7676,32 @@ BattleScript_MummyActivates::
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_WanderingSpiritActivates::
|
||||
.if B_ABILITY_POP_UP == TRUE
|
||||
setbyte sFIXED_ABILITY_POPUP, TRUE
|
||||
sethword sABILITY_OVERWRITE, ABILITY_WANDERING_SPIRIT
|
||||
showabilitypopup BS_TARGET
|
||||
pause 60
|
||||
sethword sABILITY_OVERWRITE, 0
|
||||
updateabilitypopup BS_TARGET
|
||||
pause 20
|
||||
destroyabilitypopup
|
||||
pause 40
|
||||
|
||||
setbyte sFIXED_ABILITY_POPUP, TRUE
|
||||
copyhword sABILITY_OVERWRITE, gLastUsedAbility
|
||||
showabilitypopup BS_ATTACKER
|
||||
pause 60
|
||||
sethword sABILITY_OVERWRITE, 0
|
||||
updateabilitypopup BS_ATTACKER
|
||||
pause 20
|
||||
destroyabilitypopup
|
||||
pause 40
|
||||
.endif
|
||||
printstring STRINGID_SWAPPEDABILITIES
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
return
|
||||
|
||||
BattleScript_TargetsStatWasMaxedOut::
|
||||
call BattleScript_AbilityPopUp
|
||||
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL
|
||||
|
@ -97,5 +97,6 @@ bool32 CanThrowLastUsedBall(void);
|
||||
void TryHideLastUsedBall(void);
|
||||
void TryRestoreLastUsedBall(void);
|
||||
void TryAddLastUsedBallItemSprites(void);
|
||||
void UpdateAbilityPopup(u8 battlerId);
|
||||
|
||||
#endif // GUARD_BATTLE_INTERFACE_H
|
||||
|
@ -398,5 +398,6 @@ extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[];
|
||||
extern const u8 BattleScript_AttackWeakenedByStrongWinds[];
|
||||
extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[];
|
||||
extern const u8 BattleScript_BlockedByPrimalWeatherRet[];
|
||||
extern const u8 BattleScript_WanderingSpiritActivates[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPTS_H
|
||||
|
@ -185,6 +185,7 @@
|
||||
#define VARIOUS_REMOVE_TERRAIN 113
|
||||
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
|
||||
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115
|
||||
#define VARIOUS_UPDATE_ABILITY_POPUP 116
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -592,8 +592,9 @@
|
||||
#define STRINGID_STRONGWINDSDISSIPATED 588
|
||||
#define STRINGID_MYSTERIOUSAIRCURRENTBLOWSON 589
|
||||
#define STRINGID_ATTACKWEAKENEDBSTRONGWINDS 590
|
||||
#define STRINGID_SWAPPEDABILITIES 591
|
||||
|
||||
#define BATTLESTRINGS_COUNT 591
|
||||
#define BATTLESTRINGS_COUNT 592
|
||||
|
||||
// The below IDs are all indexes into battle message tables,
|
||||
// used to determine which of a set of messages to print.
|
||||
|
@ -3065,8 +3065,8 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
|
||||
gSprites[spriteId2].tRightToLeft = FALSE;
|
||||
}
|
||||
|
||||
gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][0] = spriteId1;
|
||||
gBattleStruct->abilityPopUpSpriteIds[gBattleAnimAttacker][1] = spriteId2;
|
||||
gBattleStruct->abilityPopUpSpriteIds[battlerId][0] = spriteId1;
|
||||
gBattleStruct->abilityPopUpSpriteIds[battlerId][1] = spriteId2;
|
||||
|
||||
taskId = CreateTask(Task_FreeAbilityPopUpGfx, 5);
|
||||
gTasks[taskId].tSpriteId1 = spriteId1;
|
||||
@ -3084,6 +3084,16 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
|
||||
RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32));
|
||||
}
|
||||
|
||||
void UpdateAbilityPopup(u8 battlerId)
|
||||
{
|
||||
u8 spriteId1 = gBattleStruct->abilityPopUpSpriteIds[battlerId][0];
|
||||
u8 spriteId2 = gBattleStruct->abilityPopUpSpriteIds[battlerId][1];
|
||||
u16 ability = (gBattleScripting.abilityPopupOverwrite != 0) ? gBattleScripting.abilityPopupOverwrite : gBattleMons[battlerId].ability;
|
||||
|
||||
PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2);
|
||||
RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32));
|
||||
}
|
||||
|
||||
#define FRAMES_TO_WAIT 48
|
||||
|
||||
static void SpriteCb_AbilityPopUp(struct Sprite *sprite)
|
||||
|
@ -718,9 +718,11 @@ static const u8 sText_MysteriousAirCurrent[] = _("A mysterious air current is\np
|
||||
static const u8 sText_StrongWindsDissipated[] = _("The mysterious strong winds\nhave dissipated!{PAUSE 64}");
|
||||
static const u8 sText_MysteriousAirCurrentBlowsOn[] = _("The mysterious air current\nblows on regardless!");
|
||||
static const u8 sText_AttackWeakenedByStrongWinds[] = _("The mysterious strong winds\nweakened the attack!");
|
||||
static const u8 sText_SwappedAbilities[] = _("{B_DEF_NAME_WITH_PREFIX} swapped Abilities\nwith its target!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
[STRINGID_SWAPPEDABILITIES - 12] = sText_SwappedAbilities,
|
||||
[STRINGID_ATTACKWEAKENEDBSTRONGWINDS - 12] = sText_AttackWeakenedByStrongWinds,
|
||||
[STRINGID_MYSTERIOUSAIRCURRENTBLOWSON - 12] = sText_MysteriousAirCurrentBlowsOn,
|
||||
[STRINGID_STRONGWINDSDISSIPATED - 12] = sText_StrongWindsDissipated,
|
||||
|
@ -8317,6 +8317,9 @@ static void Cmd_various(void)
|
||||
case VARIOUS_ABILITY_POPUP:
|
||||
CreateAbilityPopUp(gActiveBattler, gBattleMons[gActiveBattler].ability, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0);
|
||||
break;
|
||||
case VARIOUS_UPDATE_ABILITY_POPUP:
|
||||
UpdateAbilityPopup(gActiveBattler);
|
||||
break;
|
||||
case VARIOUS_DEFOG:
|
||||
if (T1_READ_8(gBattlescriptCurrInstr + 3)) // Clear
|
||||
{
|
||||
|
@ -4803,6 +4803,40 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ABILITY_WANDERING_SPIRIT:
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||
{
|
||||
switch (gBattleMons[gBattlerAttacker].ability)
|
||||
{
|
||||
case ABILITY_DISGUISE:
|
||||
case ABILITY_FLOWER_GIFT:
|
||||
case ABILITY_GULP_MISSILE:
|
||||
case ABILITY_ICE_FACE:
|
||||
case ABILITY_ILLUSION:
|
||||
case ABILITY_IMPOSTER:
|
||||
case ABILITY_RECEIVER:
|
||||
case ABILITY_RKS_SYSTEM:
|
||||
case ABILITY_SCHOOLING:
|
||||
case ABILITY_STANCE_CHANGE:
|
||||
case ABILITY_WONDER_GUARD:
|
||||
case ABILITY_ZEN_MODE:
|
||||
break;
|
||||
default:
|
||||
gLastUsedAbility = gBattleMons[gBattlerAttacker].ability;
|
||||
|
||||
gBattleMons[gBattlerAttacker].ability = gBattleMons[gBattlerTarget].ability;
|
||||
gBattleMons[gBattlerTarget].ability = gLastUsedAbility;
|
||||
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_WanderingSpiritActivates;
|
||||
effect++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ABILITY_ANGER_POINT:
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gIsCriticalHit
|
||||
|
Loading…
Reference in New Issue
Block a user