Add Dazzling

This commit is contained in:
DizzyEggg 2018-11-30 22:12:18 +01:00
parent dc7be39894
commit 1a8859b1d8
8 changed files with 31 additions and 8 deletions

View file

@ -5975,6 +5975,15 @@ BattleScript_SoundproofProtected::
printstring STRINGID_PKMNSXBLOCKSY
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_DazzlingProtected::
attackstring
ppreduce
pause 0x20
call BattleScript_AbilityPopUp
printstring STRINGID_POKEMONCANNOTUSEMOVE
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_AbilityNoSpecificStatLoss::
pause 0x20

View file

@ -588,6 +588,7 @@ struct BattleStruct
struct MegaEvolutionData mega;
const u8 *trainerSlideMsg;
bool8 trainerSlideLowHpMsgDone;
s8 movePriorities[MAX_BATTLERS_COUNT];
};
#define GET_MOVE_TYPE(move, typeArg) \

View file

@ -284,5 +284,6 @@ extern const u8 BattleScript_TrainerSlideMsgRet[];
extern const u8 BattleScript_TrainerSlideMsgEnd2[];
extern const u8 BattleScript_MoveEffectFeint[];
extern const u8 BattleScript_ProteanActivates[];
extern const u8 BattleScript_DazzlingProtected[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -513,6 +513,7 @@
#define STRINGID_BESTOWITEMGIVING 509
#define STRINGID_THIRDTYPEADDED 510
#define STRINGID_FELLFORFEINT 511
#define STRINGID_POKEMONCANNOTUSEMOVE 512
#define BATTLESTRINGS_COUNT 525

View file

@ -4726,7 +4726,6 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId)
static s8 GetMovePriority(u8 battlerId)
{
s8 priority;
u16 move;
if (gProtectStructs[battlerId].noValidMoves)
@ -4734,17 +4733,17 @@ static s8 GetMovePriority(u8 battlerId)
else
move = gBattleMons[battlerId].moves[*(gBattleStruct->chosenMovePositions + battlerId)];
priority = gBattleMoves[move].priority;
gBattleStruct->movePriorities[battlerId] = gBattleMoves[move].priority;
if (GetBattlerAbility(battlerId) == ABILITY_GALE_WINGS
&& gBattleMoves[move].type == TYPE_FLYING
&& (B_GALE_WINGS == GEN_6 || BATTLER_MAX_HP(battlerId)))
{
priority++;
gBattleStruct->movePriorities[battlerId]++;
}
else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER
&& gBattleMoves[move].split == SPLIT_STATUS)
{
priority++;
gBattleStruct->movePriorities[battlerId]++;
}
else if (GetBattlerAbility(battlerId) == ABILITY_TRIAGE)
{
@ -4762,12 +4761,12 @@ static s8 GetMovePriority(u8 battlerId)
case EFFECT_SOFTBOILED:
case EFFECT_ABSORB:
case EFFECT_ROOST:
priority += 3;
gBattleStruct->movePriorities[battlerId] += 3;
break;
}
}
return priority;
return gBattleStruct->movePriorities[battlerId];
}
u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
@ -4849,7 +4848,6 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
strikesFirst = 0; // battler1's move has greater priority
}
return strikesFirst;
}

View file

@ -650,6 +650,7 @@ static const u8 sText_BurstingFlames[] = _("The bursting flames\nhit {B_SCR_ACTI
static const u8 sText_BestowItemGiving[] = _("{B_DEF_NAME_WITH_PREFIX} received {B_LAST_ITEM}\nfrom {B_ATK_NAME_WITH_PREFIX}!");
static const u8 sText_ThirdTypeAdded[] = _("{B_BUFF1} type was added to\n{B_DEF_NAME_WITH_PREFIX}!");
static const u8 sText_FellForFeint[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe feint!");
static const u8 sText_PokemonCannotUseMove[] = _("{B_ATK_NAME_WITH_PREFIX} cannot\nuse {B_CURRENT_MOVE}!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
@ -1154,6 +1155,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
sText_BestowItemGiving,
sText_ThirdTypeAdded,
sText_FellForFeint,
sText_PokemonCannotUseMove,
};
const u16 gTerrainStringIds[] =

View file

@ -940,7 +940,7 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
else if (gProtectStructs[battlerId].kingsShielded && gBattleMoves[move].power != 0)
return TRUE;
else if ((gProtectStructs[battlerId].quickGuarded || gProtectStructs[BATTLE_PARTNER(battlerId)].quickGuarded)
&& gBattleMoves[move].priority > 0)
&& gBattleStruct->movePriorities[battlerId] > 0)
return TRUE;
else
return FALSE;

View file

@ -2846,6 +2846,17 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
gBattlescriptCurrInstr = BattleScript_SoundproofProtected;
effect = 1;
}
else if ((gLastUsedAbility == ABILITY_DAZZLING
|| (IsBattlerAlive(battler ^= BIT_FLANK) && GetBattlerAbility(battler) == ABILITY_DAZZLING)
)
&& gBattleStruct->movePriorities[gBattlerAttacker] > 0
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(battler))
{
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)
gHitMarker |= HITMARKER_NO_PPDEDUCT;
gBattlescriptCurrInstr = BattleScript_DazzlingProtected;
effect = 1;
}
break;
case ABILITYEFFECT_ABSORBING: // 3
if (move != MOVE_NONE)