Trapping moves, Secret Power, rampage moves
Also tidied up a lot of #ifs and commas in battle_moves.h
This commit is contained in:
parent
b0b9883625
commit
76b4e08e5e
7 changed files with 196 additions and 296 deletions
|
@ -1177,7 +1177,7 @@
|
|||
.4byte \jumpInstr
|
||||
.endm
|
||||
|
||||
.macro getsecretpowereffect
|
||||
.macro unused_0xe4
|
||||
.byte 0xe4
|
||||
.endm
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ gBattleScriptsForMoveEffects::
|
|||
.4byte BattleScript_EffectGrudge @ EFFECT_GRUDGE
|
||||
.4byte BattleScript_EffectSnatch @ EFFECT_SNATCH
|
||||
.4byte BattleScript_EffectHit @ EFFECT_LOW_KICK
|
||||
.4byte BattleScript_EffectSecretPower @ EFFECT_SECRET_POWER
|
||||
.4byte BattleScript_EffectHit @ EFFECT_SECRET_POWER
|
||||
.4byte BattleScript_EffectTeeterDance @ EFFECT_TEETER_DANCE
|
||||
.4byte BattleScript_EffectHitEscape @ EFFECT_HIT_ESCAPE
|
||||
.4byte BattleScript_EffectMudSport @ EFFECT_MUD_SPORT
|
||||
|
@ -1073,15 +1073,15 @@ BattleScript_FlingFailConsumeItem::
|
|||
goto BattleScript_FailedFromAtkString
|
||||
|
||||
BattleScript_FlingFlameOrb:
|
||||
setmoveeffect MOVE_EFFECT_BURN
|
||||
setmoveeffect MOVE_EFFECT_BURN | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
goto BattleScript_FlingEnd
|
||||
BattleScript_FlingFlinch:
|
||||
setmoveeffect MOVE_EFFECT_FLINCH
|
||||
setmoveeffect MOVE_EFFECT_FLINCH | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
goto BattleScript_FlingEnd
|
||||
BattleScript_FlingLightBall:
|
||||
setmoveeffect MOVE_EFFECT_PARALYSIS
|
||||
setmoveeffect MOVE_EFFECT_PARALYSIS | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
goto BattleScript_FlingEnd
|
||||
BattleScript_FlingMentalHerb:
|
||||
|
@ -1095,11 +1095,11 @@ BattleScript_FlingMentalHerb:
|
|||
restoretarget
|
||||
goto BattleScript_FlingEnd
|
||||
BattleScript_FlingPoisonBarb:
|
||||
setmoveeffect MOVE_EFFECT_POISON
|
||||
setmoveeffect MOVE_EFFECT_POISON | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
goto BattleScript_FlingEnd
|
||||
BattleScript_FlingToxicOrb:
|
||||
setmoveeffect MOVE_EFFECT_TOXIC
|
||||
setmoveeffect MOVE_EFFECT_TOXIC | MOVE_EFFECT_CERTAIN
|
||||
seteffectprimary
|
||||
goto BattleScript_FlingEnd
|
||||
BattleScript_FlingWhiteHerb:
|
||||
|
@ -1118,7 +1118,6 @@ BattleScript_FlingMissed:
|
|||
|
||||
BattleScript_EffectShellSideArm:
|
||||
shellsidearmcheck
|
||||
setmoveeffect MOVE_EFFECT_POISON
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_EffectPhotonGeyser:
|
||||
|
@ -5369,7 +5368,6 @@ BattleScript_NotAffectedAbilityPopUp::
|
|||
BattleScript_EffectUproar::
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
setmoveeffect MOVE_EFFECT_UPROAR | MOVE_EFFECT_AFFECTS_USER
|
||||
attackstring
|
||||
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_UproarHit
|
||||
ppreduce
|
||||
|
@ -5915,10 +5913,6 @@ BattleScript_EffectSnatch:
|
|||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectSecretPower::
|
||||
getsecretpowereffect
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_EffectRecoilHP25:
|
||||
setmoveeffect MOVE_EFFECT_RECOIL_HP_25 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
|
||||
jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit
|
||||
|
|
|
@ -252,7 +252,7 @@ void RemoveConfusionStatus(u32 battler);
|
|||
u8 GetBattlerGender(u32 battler);
|
||||
bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2);
|
||||
bool32 AreBattlersOfSameGender(u32 battler1, u32 battler2);
|
||||
u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance, u16 moveEffect);
|
||||
u32 CalcSecondaryEffectChance(u32 battler, const struct AdditionalEffect *additionalEffect);
|
||||
u8 GetBattlerType(u32 battler, u8 typeIndex);
|
||||
bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon);
|
||||
bool8 IsMonBannedFromSkyBattles(u16 species);
|
||||
|
|
|
@ -393,8 +393,9 @@
|
|||
#define MOVE_EFFECT_SPIKES 76
|
||||
#define MOVE_EFFECT_SYRUP_BOMB 77
|
||||
#define MOVE_EFFECT_FLORAL_HEALING 78
|
||||
#define MOVE_EFFECT_SECRET_POWER 79
|
||||
|
||||
#define NUM_MOVE_EFFECTS 79
|
||||
#define NUM_MOVE_EFFECTS 80
|
||||
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x2000
|
||||
#define MOVE_EFFECT_CERTAIN 0x4000
|
||||
|
|
|
@ -584,7 +584,7 @@ static void Cmd_trysetsnatch(void);
|
|||
static void Cmd_unused2(void);
|
||||
static void Cmd_switchoutabilities(void);
|
||||
static void Cmd_jumpifhasnohp(void);
|
||||
static void Cmd_getsecretpowereffect(void);
|
||||
static void Cmd_unused0xe4(void);
|
||||
static void Cmd_pickup(void);
|
||||
static void Cmd_unused3(void);
|
||||
static void Cmd_unused4(void);
|
||||
|
@ -843,7 +843,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
|||
Cmd_unused2, //0xE1
|
||||
Cmd_switchoutabilities, //0xE2
|
||||
Cmd_jumpifhasnohp, //0xE3
|
||||
Cmd_getsecretpowereffect, //0xE4
|
||||
Cmd_unused0xe4, //0xE4
|
||||
Cmd_pickup, //0xE5
|
||||
Cmd_unused3, //0xE6
|
||||
Cmd_unused4, //0xE7
|
||||
|
@ -3662,7 +3662,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
{
|
||||
static const u8 sDireClawEffects[] = { MOVE_EFFECT_POISON, MOVE_EFFECT_PARALYSIS, MOVE_EFFECT_SLEEP };
|
||||
gBattleScripting.moveEffect = RandomElement(RNG_DIRE_CLAW, sDireClawEffects);
|
||||
SetMoveEffect(TRUE, 0);
|
||||
SetMoveEffect(FALSE, 0);
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_STEALTH_ROCK:
|
||||
|
@ -3697,6 +3697,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
gBattlescriptCurrInstr = BattleScript_SyrupBombActivates;
|
||||
}
|
||||
break;
|
||||
case MOVE_EFFECT_SECRET_POWER:
|
||||
gBattleScripting.moveEffect = GetSecretPowerMoveEffect();
|
||||
SetMoveEffect(FALSE, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3712,7 +3716,7 @@ static void Cmd_seteffectwithchance(void)
|
|||
{
|
||||
if (gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CONTINUE))
|
||||
{
|
||||
u32 percentChance = CalcSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance, gCurrentMove);
|
||||
u32 percentChance = gBattleMoves[gCurrentMove].secondaryEffectChance; // CalcSecondaryEffectChance(gBattlerAttacker, gBattleMoves[gCurrentMove].secondaryEffectChance, gCurrentMove);
|
||||
if (gBattleScripting.moveEffect & MOVE_EFFECT_CERTAIN
|
||||
|| percentChance >= 100)
|
||||
{
|
||||
|
@ -3733,8 +3737,7 @@ static void Cmd_seteffectwithchance(void)
|
|||
{
|
||||
u32 percentChance = CalcSecondaryEffectChance(
|
||||
gBattlerAttacker,
|
||||
gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter].chance,
|
||||
gCurrentMove
|
||||
&gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter]
|
||||
);
|
||||
const u8 *currentPtr = gBattlescriptCurrInstr;
|
||||
|
||||
|
@ -3746,7 +3749,7 @@ static void Cmd_seteffectwithchance(void)
|
|||
|
||||
SetMoveEffect(
|
||||
percentChance == 0, // a primary effect
|
||||
percentChance >= 100 // certain to happen
|
||||
MOVE_EFFECT_CERTAIN * (percentChance >= 100) // certain to happen
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -11649,7 +11652,7 @@ static void Cmd_confuseifrepeatingattackends(void)
|
|||
CMD_ARGS();
|
||||
|
||||
if (!(gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE) && !gSpecialStatuses[gBattlerAttacker].dancerUsedMove)
|
||||
gBattleScripting.moveEffect = (MOVE_EFFECT_THRASH | MOVE_EFFECT_AFFECTS_USER);
|
||||
gBattleScripting.moveEffect = (MOVE_EFFECT_THRASH | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN);
|
||||
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
@ -14391,12 +14394,8 @@ static void Cmd_jumpifhasnohp(void)
|
|||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
||||
static void Cmd_getsecretpowereffect(void)
|
||||
static void Cmd_unused0xe4(void)
|
||||
{
|
||||
CMD_ARGS();
|
||||
|
||||
gBattleScripting.moveEffect = GetSecretPowerMoveEffect();
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
||||
u16 GetSecretPowerMoveEffect(void)
|
||||
|
|
|
@ -11351,17 +11351,18 @@ bool32 AreBattlersOfSameGender(u32 battler1, u32 battler2)
|
|||
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 == gender2);
|
||||
}
|
||||
|
||||
u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance, u16 move)
|
||||
u32 CalcSecondaryEffectChance(u32 battler, const struct AdditionalEffect *additionalEffect)
|
||||
{
|
||||
bool8 hasSereneGrace = (GetBattlerAbility(battler) == ABILITY_SERENE_GRACE);
|
||||
bool8 hasRainbow = (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_RAINBOW) != 0;
|
||||
u16 secondaryEffectChance = additionalEffect->chance;
|
||||
|
||||
if (hasRainbow && hasSereneGrace && MoveHasMoveEffect(move, MOVE_EFFECT_FLINCH, FALSE))
|
||||
return secondaryEffectChance *= 2;
|
||||
if (hasRainbow && hasSereneGrace && additionalEffect->moveEffect == MOVE_EFFECT_FLINCH)
|
||||
return secondaryEffectChance * 2;
|
||||
|
||||
if (hasSereneGrace)
|
||||
secondaryEffectChance *= 2;
|
||||
if (hasRainbow && gBattleMoves[move].effect != EFFECT_SECRET_POWER)
|
||||
if (hasRainbow && additionalEffect->moveEffect != MOVE_EFFECT_SECRET_POWER)
|
||||
secondaryEffectChance *= 2;
|
||||
|
||||
return secondaryEffectChance;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue