merge with be

This commit is contained in:
ghoulslash 2021-11-01 11:36:18 -04:00
commit b5d20da927
11 changed files with 92 additions and 6 deletions

View File

@ -1586,6 +1586,10 @@
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
.byte \clear

View File

@ -7975,6 +7975,34 @@ 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
switchinabilities BS_ATTACKER
switchinabilities BS_TARGET
return
BattleScript_TargetsStatWasMaxedOut::
call BattleScript_AbilityPopUp
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL

View File

@ -101,5 +101,6 @@ bool32 CanThrowLastUsedBall(void);
void TryHideLastUsedBall(void);
void TryRestoreLastUsedBall(void);
void TryAddLastUsedBallItemSprites(void);
void UpdateAbilityPopup(u8 battlerId);
#endif // GUARD_BATTLE_INTERFACE_H

View File

@ -403,5 +403,6 @@ extern const u8 BattleScript_BlockedByPrimalWeatherRet[];
extern const u8 BattleScript_PrimalReversion[];
extern const u8 BattleScript_HyperspaceFuryRemoveProtect[];
extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[];
extern const u8 BattleScript_WanderingSpiritActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -194,8 +194,9 @@
#define VARIOUS_HANDLE_PRIMAL_REVERSION 121
#define VARIOUS_APPLY_PLASMA_FISTS 122
#define VARIOUS_JUMP_IF_SPECIES 123
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 124
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 125
#define VARIOUS_UPDATE_ABILITY_POPUP 124
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 125
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 126
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -598,8 +598,9 @@
#define STRINGID_BUTHOOPACANTUSEIT 595
#define STRINGID_BROKETHROUGHPROTECTION 596
#define STRINGID_ABILITYALLOWSONLYMOVE 597
#define STRINGID_SWAPPEDABILITIES 598
#define BATTLESTRINGS_COUNT 598
#define BATTLESTRINGS_COUNT 599
// The below IDs are all indexes into battle message tables,
// used to determine which of a set of messages to print.

View File

@ -3138,8 +3138,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;
@ -3157,6 +3157,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)

View File

@ -724,9 +724,11 @@ static const u8 sText_ButPokemonCantUseTheMove[] = _("But {B_ATK_NAME_WITH_PREFI
static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way it is now!");
static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!");
static const u8 sText_AbilityAllowsOnlyMove[] = _("{B_ATK_ABILITY} allows the\nuse of only {B_CURRENT_MOVE}!\p");
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_ABILITYALLOWSONLYMOVE - 12] = sText_AbilityAllowsOnlyMove,
[STRINGID_BROKETHROUGHPROTECTION - 12] = sText_BrokeThroughProtection,
[STRINGID_BUTPOKEMONCANTUSETHEMOVE - 12] = sText_ButPokemonCantUseTheMove,

View File

@ -8385,6 +8385,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
{

View File

@ -4851,6 +4851,41 @@ 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_HUNGER_SWITCH:
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;
RecordAbilityBattle(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability);
RecordAbilityBattle(gBattlerTarget, gBattleMons[gBattlerTarget].ability);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_WanderingSpiritActivates;
effect++;
break;
}
}
break;
case ABILITY_ANGER_POINT:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gIsCriticalHit

View File

@ -10446,7 +10446,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.accuracy = 100,
.pp = 15,
.secondaryEffectChance = 0,
.target = MOVE_TARGET_FOES_AND_ALLY,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_IRON_FIST_BOOST,
.split = SPLIT_PHYSICAL,