Grassy Terrain + minor fixes

Includes strings for all
Fixes:
・Psychic Terrain blocks priority if the TARGET is grounded, not the user
・Psychic Terrain no longer targets an opponent
・Terrains no longer boost (or nerf, for Misty) the power of certain moves if the affect mon is semi-invulnerable
・Small fix: Meteor Mash corrected to being a physical attack
This commit is contained in:
Papa Cancer 2019-02-28 14:02:54 +00:00
parent df9e6a6889
commit cfd50eb65a
9 changed files with 71 additions and 8 deletions

View file

@ -1592,6 +1592,11 @@
.macro bringdownairbornebattler battler:req
various \battler, VARIOUS_GRAVITY_ON_AIRBORNE_MONS
.endm
.macro checkgrassyterrainheal battler:req, ptr:req
various \battler, VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req

View file

@ -6155,6 +6155,23 @@ BattleScript_MoveUsedPsychicTerrainPrevents::
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_GrassyTerrainLoop::
copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 0x1
checkgrassyterrainheal BS_ATTACKER, BattleScript_GrassyTerrainLoopIncrement
printstring STRINGID_GRASSYTERRAINHEALS
waitmessage 0x40
BattleScript_GrassyTerrainHpChange:
orword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
BattleScript_GrassyTerrainLoopIncrement::
jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_GrassyTerrainLoopEnd
addbyte gBattleCommunication, 0x1
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_GrassyTerrainLoop
BattleScript_GrassyTerrainLoopEnd::
bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
end2
BattleScript_AbilityNoSpecificStatLoss::
pause 0x20
call BattleScript_AbilityPopUp

View file

@ -296,5 +296,7 @@ extern const u8 BattleScript_ElectricSurgeActivates[];
extern const u8 BattleScript_SpectralThiefSteal[];
extern const u8 BattleScript_StatUpMsg[];
extern const u8 BattleScript_DefiantActivates[];
extern const u8 BattleScript_PowderMoveNoEffect[];
extern const u8 BattleScript_GrassyTerrainLoop[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -137,6 +137,7 @@
#define VARIOUS_SET_POWDER 74
#define VARIOUS_SPECTRAL_THIEF 75
#define VARIOUS_GRAVITY_ON_AIRBORNE_MONS 76
#define VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS 77
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0

View file

@ -519,6 +519,10 @@
#define STRINGID_BELCHCANTSELECT 515
#define STRINGID_SPECTRALTHIEFSTEAL 516
#define STRINGID_GRAVITYGROUNDING 517
#define STRINGID_MISTYTERRAINPREVENTS 518
#define STRINGID_GRASSYTERRAINHEALS 519
#define STRINGID_ELECTRICTERRAINPREVENTS 520
#define STRINGID_PSYCHICTERRAINPREVENTS 521
#define BATTLESTRINGS_COUNT 529

View file

@ -644,6 +644,10 @@ static const u8 sText_PowderExplodes[] = _("When the flame touched the powder\no
static const u8 sText_BelchCantUse[] = _("Belch cannot be used!\p");
static const u8 sText_SpectralThiefSteal[] = _("{B_ATK_NAME_WITH_PREFIX} stole the target's\nboosted stats!");
static const u8 sText_GravityGrounding[] = _("{B_DEF_NAME_WITH_PREFIX} can't stay airborne\nbecause of gravity!");
static const u8 sText_MistyTerrainPreventsStatus[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith a protective mist!");
static const u8 sText_GrassyTerrainHeals[] = _("{B_ATK_NAME_WITH_PREFIX} is healed\nby the grassy terrain!");
static const u8 sText_ElectricTerrainPreventsSleep[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith electrified terrain!");
static const u8 sText_PsychicTerrainPreventsPriority[] = _("{B_DEF_NAME_WITH_PREFIX} surrounds itself\nwith psychic terrain!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
@ -1153,6 +1157,10 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_COVEREDINPOWDER - 12] = sText_CoveredInPowder,
[STRINGID_POWDEREXPLODES - 12] = sText_PowderExplodes,
[STRINGID_GRAVITYGROUNDING - 12] = sText_GravityGrounding,
[STRINGID_MISTYTERRAINPREVENTS - 12] = sText_MistyTerrainPreventsStatus,
[STRINGID_GRASSYTERRAINHEALS - 12] = sText_GrassyTerrainHeals,
[STRINGID_ELECTRICTERRAINPREVENTS - 12] = sText_ElectricTerrainPreventsSleep,
[STRINGID_PSYCHICTERRAINPREVENTS - 12] = sText_PsychicTerrainPreventsPriority,
};
const u16 gTerrainStringIds[] =
@ -1160,6 +1168,11 @@ const u16 gTerrainStringIds[] =
STRINGID_TERRAINBECOMESMISTY, STRINGID_TERRAINBECOMESGRASSY, STRINGID_TERRAINBECOMESELECTRIC, STRINGID_TERRAINBECOMESPSYCHIC
};
const u16 gTerrainPreventsStringIds[] =
{
STRINGID_MISTYTERRAINPREVENTS, STRINGID_ELECTRICTERRAINPREVENTS, STRINGID_PSYCHICTERRAINPREVENTS
};
const u16 gMagicCoatBounceStringIds[] =
{
STRINGID_PKMNMOVEBOUNCED, STRINGID_PKMNMOVEBOUNCEDABILITY

View file

@ -6368,6 +6368,22 @@ static void atk76_various(void)
switch (gBattlescriptCurrInstr[2])
{
case VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS:
if ((gStatuses3[gActiveBattler] & (STATUS3_SEMI_INVULNERABLE)) || BATTLER_MAX_HP(gActiveBattler) || !(IsBattlerGrounded(gActiveBattler)))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
return;
}
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
if (gAbsentBattlerFlags & gBitTable[gBattlerAttacker])
gBattleMoveDamage = 0;
gBattlescriptCurrInstr += 7;
return;
case VARIOUS_GRAVITY_ON_AIRBORNE_MONS:
if (gStatuses3[gActiveBattler] & STATUS3_ON_AIR)
CancelMultiTurnMoves(gActiveBattler);

View file

@ -1256,6 +1256,11 @@ u8 DoFieldEndTurnEffects(void)
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_GRASSY_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN)
{
BattleScriptExecute(BattleScript_GrassyTerrainLoop);
effect++;
}
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && --gFieldTimers.grassyTerrainTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN);
@ -2344,7 +2349,7 @@ u8 AtkCanceller_UnableToUseMove2(void)
gBattleStruct->atkCancellerTracker++;
case CANCELLER_PSYCHIC_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN
&& IsBattlerGrounded(gBattlerAttacker)
&& IsBattlerGrounded(gBattlerTarget)
&& GetChosenMovePriority(gBattlerAttacker) > 0
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
{
@ -5159,7 +5164,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
case EFFECT_BULLDOZE:
case EFFECT_MAGNITUDE:
case EFFECT_EARTHQUAKE:
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && IsBattlerGrounded(battlerDef))
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, UQ_4_12(0.5));
break;
case EFFECT_KNOCK_OFF:
@ -5175,13 +5180,13 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, UQ_4_12(2.0));
if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST)
MulModifier(&modifier, UQ_4_12(1.5));
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk))
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, UQ_4_12(1.5));
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef))
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)
MulModifier(&modifier, UQ_4_12(0.5));
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk))
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, UQ_4_12(1.5));
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk))
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, UQ_4_12(1.5));
return ApplyModifier(modifier, basePower);

View file

@ -4339,7 +4339,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED | FLAG_IRON_FIST_BOOST,
.split = SPLIT_SPECIAL,
.split = SPLIT_PHYSICAL,
},
[MOVE_ASTONISH] =
@ -9003,7 +9003,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.accuracy = 0,
.pp = 10,
.secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED,
.target = MOVE_TARGET_USER,
.priority = 0,
.flags = 0,
.split = SPLIT_STATUS,