Fixed Make it Rain

To do: misc fixes here and there, maybe do Burn Up/Double Shock, Dragon Rage/SonicBoom...
This commit is contained in:
Nephrite 2023-12-29 01:40:43 +09:00
parent 77c722ea09
commit 417a02c95e
7 changed files with 53 additions and 56 deletions

View file

@ -383,7 +383,6 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_UNUSED_358
.4byte BattleScript_EffectTakeHeart @ EFFECT_TAKE_HEART
.4byte BattleScript_EffectHit @ EFFECT_COLLISION_COURSE
.4byte BattleScript_EffectMakeItRain @ EFFECT_MAKE_IT_RAIN
.4byte BattleScript_EffectCorrosiveGas @ EFFECT_CORROSIVE_GAS
.4byte BattleScript_EffectHit @ EFFECT_POPULATION_BOMB
.4byte BattleScript_EffectSaltCure @ EFFECT_SALT_CURE
@ -623,19 +622,6 @@ BattleScript_CorrosiveGasFail:
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectMakeItRain:
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_MakeItRainDoubles
BattleScript_MakeItRainContinuous:
setmoveeffect MOVE_EFFECT_PAYDAY | MOVE_EFFECT_CERTAIN
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
setmoveeffect MOVE_EFFECT_SP_ATK_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
seteffectprimary
goto BattleScript_MoveEnd
BattleScript_MakeItRainDoubles:
jumpifword CMP_NO_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING | HITMARKER_NO_PPDEDUCT, BattleScript_NoMoveEffect
goto BattleScript_MakeItRainContinuous
BattleScript_EffectTakeHeart::
attackcanceler
attackstring

View file

@ -362,17 +362,16 @@
#define EFFECT_UNUSED_358 358
#define EFFECT_TAKE_HEART 359
#define EFFECT_COLLISION_COURSE 360
#define EFFECT_MAKE_IT_RAIN 361
#define EFFECT_CORROSIVE_GAS 362
#define EFFECT_POPULATION_BOMB 363
#define EFFECT_SALT_CURE 364
#define EFFECT_CHILLY_RECEPTION 365
#define EFFECT_MAX_MOVE 366
#define EFFECT_GLAIVE_RUSH 367
#define EFFECT_RAGING_BULL 368
#define EFFECT_RAGE_FIST 369
#define EFFECT_DOODLE 370
#define EFFECT_CORROSIVE_GAS 361
#define EFFECT_POPULATION_BOMB 362
#define EFFECT_SALT_CURE 363
#define EFFECT_CHILLY_RECEPTION 364
#define EFFECT_MAX_MOVE 365
#define EFFECT_GLAIVE_RUSH 366
#define EFFECT_RAGING_BULL 367
#define EFFECT_RAGE_FIST 368
#define EFFECT_DOODLE 369
#define NUM_BATTLE_MOVE_EFFECTS 371
#define NUM_BATTLE_MOVE_EFFECTS 370
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View file

@ -4216,10 +4216,6 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
else
ADJUST_SCORE(1);
break;
case EFFECT_MAKE_IT_RAIN:
if (aiData->abilities[battlerAtk] == ABILITY_CONTRARY)
ADJUST_SCORE(3);
break;
case EFFECT_MAGIC_COAT:
if (IS_MOVE_STATUS(predictedMove) && AI_GetBattlerMoveTargetType(battlerDef, predictedMove) & (MOVE_TARGET_SELECTED | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH))
ADJUST_SCORE(3);

View file

@ -960,7 +960,6 @@ static bool32 AI_IsMoveEffectInMinus(u32 battlerAtk, u32 battlerDef, u32 move, s
switch (gBattleMoves[move].effect)
{
case EFFECT_MAKE_IT_RAIN:
case EFFECT_MIND_BLOWN:
case EFFECT_STEEL_BEAM:
return TRUE;

View file

@ -355,6 +355,7 @@ void ApplyExperienceMultipliers(s32 *expAmount, u8 expGetterMonId, u8 faintedBat
static void RemoveAllTerrains(void);
static bool8 CanAbilityPreventStatLoss(u16 abilityDef, bool8 isIntimidate);
static bool8 CanBurnHitThaw(u16 move);
static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent);
static void Cmd_attackcanceler(void);
static void Cmd_accuracycheck(void);
@ -3192,8 +3193,15 @@ void SetMoveEffect(bool32 primary, u32 certain)
if (payday > gPaydayMoney)
gPaydayMoney = 0xFFFF;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectPayDay;
// For a move that hits multiple targets (i.e. Make it Rain)
// we only want to print the message on the final hit
if (GetNextTarget(gBattleMoves[gCurrentMove].target, TRUE) == MAX_BATTLERS_COUNT)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectPayDay;
}
else
gBattlescriptCurrInstr++;
}
else
{
@ -3719,22 +3727,28 @@ static void Cmd_seteffectwithchance(void)
}
else if (gBattleMoves[gCurrentMove].numAdditionalEffects > gBattleStruct->additionalEffectsCounter)
{
u32 percentChance = CalcSecondaryEffectChance(
gBattlerAttacker,
&gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter]
);
const u8 *currentPtr = gBattlescriptCurrInstr;
// Activate effect if it's primary (chance == 0) or if RNGesus says so
if ((percentChance == 0) || RandomPercentage(RNG_SECONDARY_EFFECT + gBattleStruct->additionalEffectsCounter, percentChance))
// self-targeting move effects cannot occur multiple times per turn
// only occur on the last setmoveeffect when there are multiple targets
if (!(gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter].self
&& GetNextTarget(gBattleMoves[gCurrentMove].target, TRUE) != MAX_BATTLERS_COUNT))
{
gBattleScripting.moveEffect = gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter].moveEffect
| (MOVE_EFFECT_AFFECTS_USER * (gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter].self));
SetMoveEffect(
percentChance == 0, // a primary effect
MOVE_EFFECT_CERTAIN * (percentChance >= 100) // certain to happen
u32 percentChance = CalcSecondaryEffectChance(
gBattlerAttacker,
&gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter]
);
// Activate effect if it's primary (chance == 0) or if RNGesus says so
if ((percentChance == 0) || RandomPercentage(RNG_SECONDARY_EFFECT + gBattleStruct->additionalEffectsCounter, percentChance))
{
gBattleScripting.moveEffect = gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter].moveEffect
| (MOVE_EFFECT_AFFECTS_USER * (gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter].self));
SetMoveEffect(
percentChance == 0, // a primary effect
MOVE_EFFECT_CERTAIN * (percentChance >= 100) // certain to happen
);
}
}
// Move script along if we haven't jumped elsewhere
@ -3742,13 +3756,11 @@ static void Cmd_seteffectwithchance(void)
gBattlescriptCurrInstr = cmd->nextInstr;
// Call seteffectwithchance again in the case of a move with multiple effects
if (gBattleMoves[gCurrentMove].numAdditionalEffects - 1 > gBattleStruct->additionalEffectsCounter)
{
gBattleStruct->additionalEffectsCounter++;
gBattleStruct->additionalEffectsCounter++;
if (gBattleMoves[gCurrentMove].numAdditionalEffects > gBattleStruct->additionalEffectsCounter)
gBattleScripting.moveEffect = MOVE_EFFECT_CONTINUE;
}
else
gBattleScripting.moveEffect = 0;
gBattleScripting.moveEffect = gBattleStruct->additionalEffectsCounter = 0;
}
else
{
@ -5230,12 +5242,13 @@ static bool32 TryKnockOffBattleScript(u32 battlerDef)
&& gBattleMons[battler].hp != 0 \
&& gBattleMons[ally].hp != 0
static u32 GetNextTarget(u32 moveTarget)
static u32 GetNextTarget(u32 moveTarget, bool32 excludeCurrent)
{
u32 i;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (i != gBattlerAttacker
&& !(excludeCurrent && i == gBattlerTarget)
&& IsBattlerAlive(i)
&& !(gBattleStruct->targetsDone[gBattlerAttacker] & gBitTable[i])
&& (GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker) || moveTarget == MOVE_TARGET_FOES_AND_ALLY))
@ -5769,7 +5782,7 @@ static void Cmd_moveend(void)
|| moveTarget == MOVE_TARGET_FOES_AND_ALLY)
&& !(gHitMarker & HITMARKER_NO_ATTACKSTRING))
{
u32 nextTarget = GetNextTarget(moveTarget);
u32 nextTarget = GetNextTarget(moveTarget, FALSE);
gHitMarker |= HITMARKER_NO_PPDEDUCT;
if (nextTarget != MAX_BATTLERS_COUNT)
@ -5790,7 +5803,7 @@ static void Cmd_moveend(void)
gBattleStruct->targetsDone[gBattlerAttacker] |= gBitTable[originalBounceTarget];
gBattleStruct->targetsDone[originalBounceTarget] = 0;
nextTarget = GetNextTarget(moveTarget);
nextTarget = GetNextTarget(moveTarget, FALSE);
if (nextTarget != MAX_BATTLERS_COUNT)
{
// We found another target for the original move user.

View file

@ -13167,7 +13167,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
[MOVE_MAKE_IT_RAIN] =
{
.effect = EFFECT_MAKE_IT_RAIN,
.effect = EFFECT_HIT,
.power = 120,
.type = TYPE_STEEL,
.accuracy = 100,
@ -13176,7 +13176,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
.priority = 0,
.category = BATTLE_CATEGORY_SPECIAL,
.metronomeBanned = TRUE,
// additional effects handled in script due to weird behaviour in doubles
ADDITIONAL_EFFECTS(
PRIMARY_EFFECT(MOVE_EFFECT_PAYDAY),
PRIMARY_EFFECT_SELF(MOVE_EFFECT_SP_ATK_MINUS_1)
),
},
[MOVE_RUINATION] =

View file

@ -3,7 +3,8 @@
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_MAKE_IT_RAIN].effect == EFFECT_MAKE_IT_RAIN);
ASSUME(MoveHasMoveEffect(MOVE_MAKE_IT_RAIN, MOVE_EFFECT_PAYDAY, FALSE));
ASSUME(MoveHasMoveEffectSelf(MOVE_MAKE_IT_RAIN, MOVE_EFFECT_SP_ATK_MINUS_1));
}
SINGLE_BATTLE_TEST("Make It Rain lowers special attack by one stage")