Merge pull request #86 from thechurchofcage/beta

All terrain effects added
This commit is contained in:
DizzyEggg 2019-03-05 21:21:43 +01:00 committed by GitHub
commit bf0c45d4b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 15 deletions

View File

@ -1593,6 +1593,11 @@
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
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -6171,6 +6171,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
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
BattleScript_GrassyTerrainLoopIncrement::
addbyte gBattleCommunication, 0x1
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_GrassyTerrainLoop
BattleScript_GrassyTerrainLoopEnd::
bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
jumpifbyte CMP_EQUAL, gFieldTimers + 5, 0x0, BattleScript_GrassyTerrainEnds
end2
BattleScript_AbilityNoSpecificStatLoss::
pause 0x20
call BattleScript_AbilityPopUp

View File

@ -297,5 +297,6 @@ 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

@ -575,10 +575,10 @@ static const u8 sText_TargetAbilityRaisedStat[] = _("{B_DEF_NAME_WITH_PREFIX}'s
static const u8 sText_TargetAbilityLoweredStat[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nlowered its {B_BUFF1}!");
static const u8 sText_AttackerAbilityRaisedStat[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nraised its {B_BUFF1}!");
static const u8 sText_AuroraVeilEnds[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nwore off!");
static const u8 sText_ElectricTerrainEnds[] = _("{B_ATK_ABILITY} wore off.");
static const u8 sText_MistyTerrainEnds[] = _("{B_ATK_ABILITY} wore off.");
static const u8 sText_PsychicTerrainEnds[] = _("{B_ATK_ABILITY} wore off.");
static const u8 sText_GrassyTerrainEnds[] = _("{B_ATK_ABILITY} wore off.");
static const u8 sText_ElectricTerrainEnds[] = _("The electricity disappeared\nfrom the battlefield.");
static const u8 sText_MistyTerrainEnds[] = _("The mist disappeared\nfrom the battlefield.");
static const u8 sText_PsychicTerrainEnds[] = _("The weirdness disappeared\nfrom the battlefield.");
static const u8 sText_GrassyTerrainEnds[] = _("The grass disappeared\nfrom the battlefield.");
static const u8 sText_AngryPointActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} maxed\nits attack!");
static const u8 sText_PoisonHealHpUp[] = _("The poisoning healed {B_ATK_NAME_WITH_PREFIX}\na little bit!");
static const u8 sText_BadDreamsDmg[] = _("The {B_DEF_NAME_WITH_PREFIX} is tormented\nby {B_DEF_ABILITY}!");
@ -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,24 @@ 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)
|| !gBattleMons[gActiveBattler].hp
|| !(IsBattlerGrounded(gActiveBattler)))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
else
{
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
gBattlescriptCurrInstr += 7;
}
return;
case VARIOUS_GRAVITY_ON_AIRBORNE_MONS:
if (gStatuses3[gActiveBattler] & STATUS3_ON_AIR)
CancelMultiTurnMoves(gActiveBattler);

View File

@ -1256,10 +1256,11 @@ u8 DoFieldEndTurnEffects(void)
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_GRASSY_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && --gFieldTimers.grassyTerrainTimer == 0)
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN)
{
if (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0)
gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN);
BattleScriptExecute(BattleScript_GrassyTerrainEnds);
BattleScriptExecute(BattleScript_GrassyTerrainLoop);
effect++;
}
gBattleStruct->turnCountersTracker++;
@ -2365,7 +2366,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))
{
@ -5183,7 +5184,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:
@ -5199,13 +5200,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,