mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Implemented Protosynthesis' effect
Also turned GetHighestStatId into a global function since Protosynthesis' effect uses it.
This commit is contained in:
parent
34cafa746c
commit
a328088122
@ -8410,6 +8410,14 @@ BattleScript_DeltaStreamActivates::
|
||||
playanimation BS_ATTACKER, B_ANIM_STRONG_WINDS
|
||||
end3
|
||||
|
||||
BattleScript_ProtosynthesisActivates::
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_SUNLIGHTACTIVATEDABILITY
|
||||
waitmessage B_WAIT_TIME_MED
|
||||
printstring STRINGID_STATWASHEIGHTENED
|
||||
waitmessage B_WAIT_TIME_MED
|
||||
end3
|
||||
|
||||
BattleScript_AttackWeakenedByStrongWinds::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS
|
||||
|
@ -43,6 +43,7 @@ u16 GetNaturePowerMove(void);
|
||||
u16 GetSecretPowerMoveEffect(void);
|
||||
void StealTargetItem(u8 battlerStealer, u8 battlerItem);
|
||||
u8 GetCatchingBattler(void);
|
||||
u32 GetHighestStatId(u32 battlerId);
|
||||
|
||||
extern void (* const gBattleScriptingCommandsTable[])(void);
|
||||
extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4];
|
||||
|
@ -440,6 +440,7 @@ extern const u8 BattleScript_WindRiderActivatesEnd2[];
|
||||
extern const u8 BattleScript_WindRiderActivatesMoveEnd[];
|
||||
extern const u8 BattleScript_WindPowerActivates[];
|
||||
extern const u8 BattleScript_WindPowerActivatesEnd2[];
|
||||
extern const u8 BattleScript_ProtosynthesisActivates[];
|
||||
|
||||
// zmoves
|
||||
extern const u8 BattleScript_ZMoveActivateDamaging[];
|
||||
|
@ -631,8 +631,10 @@
|
||||
#define STRINGID_ATTACKERMELTEDTHEICE 629
|
||||
#define STRINGID_TARGETTOUGHEDITOUT 630
|
||||
#define STRINGID_BEINGHITCHARGEDPKMNWITHPOWER 631
|
||||
#define STRINGID_SUNLIGHTACTIVATEDABILITY 632
|
||||
#define STRINGID_STATWASHEIGHTENED 633
|
||||
|
||||
#define BATTLESTRINGS_COUNT 632
|
||||
#define BATTLESTRINGS_COUNT 634
|
||||
|
||||
// This is the string id that gBattleStringsTable starts with.
|
||||
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
|
||||
|
@ -4482,6 +4482,7 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId)
|
||||
u32 speed = gBattleMons[battlerId].speed;
|
||||
u32 ability = GetBattlerAbility(battlerId);
|
||||
u32 holdEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
||||
u32 highestStat = GetHighestStatId(battlerId);
|
||||
|
||||
// weather abilities
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
@ -4503,6 +4504,8 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId)
|
||||
speed *= 2;
|
||||
else if (ability == ABILITY_SLOW_START && gDisableStructs[battlerId].slowStartTimer != 0)
|
||||
speed /= 2;
|
||||
else if (ability == ABILITY_PROTOSYNTHESIS && gBattleWeather & B_WEATHER_SUN && highestStat == STAT_SPEED)
|
||||
speed = (speed * 150) / 100;
|
||||
|
||||
// stat stages
|
||||
speed *= gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPEED]][0];
|
||||
|
@ -760,9 +760,13 @@ static const u8 sText_AttackerHealedItsBurn[] = _("{B_ATK_NAME_WITH_PREFIX} heal
|
||||
static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melted the ice with\nits fiery determination!");
|
||||
static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!");
|
||||
static const u8 sText_BeingHitChargedPkmnWithPower[] = _("Being hit by {B_CURRENT_MOVE}\ncharged {B_ATK_NAME_WITH_PREFIX} with power!");
|
||||
static const u8 sText_SunlightActivatedAbility[] = _("The harsh sunlight activated\n{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}!");
|
||||
static const u8 sText_StatWasHeightened[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1} was heightened!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
[STRINGID_STATWASHEIGHTENED - BATTLESTRINGS_TABLE_START] = sText_StatWasHeightened,
|
||||
[STRINGID_SUNLIGHTACTIVATEDABILITY - BATTLESTRINGS_TABLE_START] = sText_SunlightActivatedAbility,
|
||||
[STRINGID_BEINGHITCHARGEDPKMNWITHPOWER - BATTLESTRINGS_TABLE_START] = sText_BeingHitChargedPkmnWithPower,
|
||||
[STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut,
|
||||
[STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce,
|
||||
|
@ -8098,7 +8098,7 @@ static void RecalcBattlerStats(u32 battler, struct Pokemon *mon)
|
||||
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].type2;
|
||||
}
|
||||
|
||||
static u32 GetHighestStatId(u32 battlerId)
|
||||
u32 GetHighestStatId(u32 battlerId)
|
||||
{
|
||||
u32 i, highestId = STAT_ATK, highestStat = gBattleMons[battlerId].attack;
|
||||
|
||||
|
@ -4883,6 +4883,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (!gSpecialStatuses[battler].switchInAbilityDone && gBattleWeather & B_WEATHER_SUN)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
BattleScriptPushCursorAndCallback(BattleScript_ProtosynthesisActivates);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
#if B_WEATHER_FORMS < GEN_5
|
||||
default:
|
||||
if (gBattleMons[battler].species == SPECIES_CHERRIM)
|
||||
@ -8632,15 +8641,19 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
|
||||
static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 updateFlags)
|
||||
{
|
||||
u32 i, ability;
|
||||
u32 i;
|
||||
u32 holdEffectAtk, holdEffectParamAtk;
|
||||
u16 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef);
|
||||
u16 holdEffectModifier;
|
||||
u16 modifier = UQ_4_12(1.0);
|
||||
u32 atkSide = GET_BATTLER_SIDE(battlerAtk);
|
||||
u16 atkAbility = GetBattlerAbility(battlerAtk);
|
||||
u16 defAbility = GetBattlerAbility(battlerDef);
|
||||
u8 atkHighestStat = GetHighestStatId(battlerAtk);
|
||||
u8 defHighestStat = GetHighestStatId(battlerDef);
|
||||
|
||||
// attacker's abilities
|
||||
switch (GetBattlerAbility(battlerAtk))
|
||||
switch (atkAbility)
|
||||
{
|
||||
case ABILITY_TECHNICIAN:
|
||||
if (basePower <= 60)
|
||||
@ -8750,6 +8763,10 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
if (moveType == TYPE_ROCK)
|
||||
MulModifier(&modifier, UQ_4_12(1.5));
|
||||
break;
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT && (atkHighestStat == STAT_ATK || atkHighestStat == STAT_SPATK))
|
||||
MulModifier(&modifier, UQ_4_12(1.3));
|
||||
break;
|
||||
}
|
||||
|
||||
// field abilities
|
||||
@ -8782,8 +8799,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
}
|
||||
|
||||
// target's abilities
|
||||
ability = GetBattlerAbility(battlerDef);
|
||||
switch (ability)
|
||||
switch (defAbility)
|
||||
{
|
||||
case ABILITY_HEATPROOF:
|
||||
case ABILITY_WATER_BUBBLE:
|
||||
@ -8791,7 +8807,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
{
|
||||
MulModifier(&modifier, UQ_4_12(0.5));
|
||||
if (updateFlags)
|
||||
RecordAbilityBattle(battlerDef, ability);
|
||||
RecordAbilityBattle(battlerDef, defAbility);
|
||||
}
|
||||
break;
|
||||
case ABILITY_DRY_SKIN:
|
||||
@ -8803,11 +8819,15 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
{
|
||||
MulModifier(&modifier, UQ_4_12(0.5));
|
||||
if (updateFlags)
|
||||
RecordAbilityBattle(battlerDef, ability);
|
||||
RecordAbilityBattle(battlerDef, defAbility);
|
||||
}
|
||||
if (moveType == TYPE_FIRE)
|
||||
MulModifier(&modifier, UQ_4_12(2.0));
|
||||
break;
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT && (defHighestStat == STAT_DEF || defHighestStat == STAT_SPDEF))
|
||||
MulModifier(&modifier, UQ_4_12(0.3));
|
||||
break;
|
||||
}
|
||||
|
||||
holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user