Removed PRIMARY/SECONDARY macros; added flags
Just a couple for now; cleaned up parts of setadditionaleffects
This commit is contained in:
parent
daeba066e0
commit
4556ecc71e
4 changed files with 1127 additions and 839 deletions
|
@ -515,7 +515,7 @@ struct BattleMove
|
|||
|
||||
#define ADDITIONAL_EFFECTS(...) EFFECTS_ARR( __VA_ARGS__ ), .numAdditionalEffects = ARRAY_COUNT(EFFECTS_ARR( __VA_ARGS__ ))
|
||||
|
||||
#define EFFECTS_ARR(...) (const struct AdditionalEffect[]) { __VA_ARGS__ }
|
||||
#define EFFECTS_ARR(...) (const struct AdditionalEffect[]) {__VA_ARGS__}
|
||||
|
||||
#define PRIMARY_EFFECT(_moveEffect) {.self = FALSE, .chance = 0, .moveEffect = _moveEffect}
|
||||
#define PRIMARY_EFFECT_SELF(_moveEffect) {.self = TRUE, .chance = 0, .moveEffect = _moveEffect}
|
||||
|
@ -524,7 +524,9 @@ struct BattleMove
|
|||
|
||||
struct AdditionalEffect
|
||||
{
|
||||
bool8 self;
|
||||
u8 self:1;
|
||||
u8 onChargeTurnOnly:1;
|
||||
u8 onlyIfTargetRaisedStats:1;
|
||||
u8 chance; // 0% = effect certain, primary effect
|
||||
u16 moveEffect;
|
||||
};
|
||||
|
|
|
@ -2893,9 +2893,6 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
|||
statusChanged = TRUE;
|
||||
break;
|
||||
case STATUS1_BURN:
|
||||
if (gCurrentMove == MOVE_BURNING_JEALOUSY && !gProtectStructs[gEffectBattler].statRaised)
|
||||
break;
|
||||
|
||||
if ((battlerAbility == ABILITY_WATER_VEIL || battlerAbility == ABILITY_WATER_BUBBLE)
|
||||
&& (primary == TRUE || certain == TRUE))
|
||||
{
|
||||
|
@ -3127,9 +3124,6 @@ void SetMoveEffect(bool32 primary, bool32 certain)
|
|||
switch (gBattleScripting.moveEffect)
|
||||
{
|
||||
case MOVE_EFFECT_CONFUSION:
|
||||
if (gCurrentMove == MOVE_ALLURING_VOICE && !gProtectStructs[gEffectBattler].statRaised)
|
||||
break;
|
||||
|
||||
if (!CanBeConfused(gEffectBattler))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
|
@ -3804,23 +3798,23 @@ static void Cmd_setadditionaleffects(void)
|
|||
{
|
||||
if (gBattleMoves[gCurrentMove].numAdditionalEffects > gBattleStruct->additionalEffectsCounter)
|
||||
{
|
||||
u32 percentChance;
|
||||
const u8 *currentPtr = gBattlescriptCurrInstr;
|
||||
const struct AdditionalEffect *additionalEffect = &gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter];
|
||||
|
||||
// Check additional effect flags
|
||||
// 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
|
||||
&& !(additionalEffect->onlyIfTargetRaisedStats && !gProtectStructs[gBattlerTarget].statRaised)
|
||||
&& GetNextTarget(gBattleMoves[gCurrentMove].target, TRUE) != MAX_BATTLERS_COUNT))
|
||||
{
|
||||
u32 percentChance = CalcSecondaryEffectChance(
|
||||
gBattlerAttacker,
|
||||
GetBattlerAbility(gBattlerAttacker),
|
||||
&gBattleMoves[gCurrentMove].additionalEffects[gBattleStruct->additionalEffectsCounter]
|
||||
);
|
||||
percentChance = CalcSecondaryEffectChance(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker), additionalEffect);
|
||||
|
||||
// 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));
|
||||
gBattleScripting.moveEffect = additionalEffect->moveEffect | (MOVE_EFFECT_AFFECTS_USER * (additionalEffect->self));
|
||||
|
||||
SetMoveEffect(
|
||||
percentChance == 0, // a primary effect
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@ SINGLE_BATTLE_TEST("Sheer Force boosts power, but removes secondary effects of m
|
|||
PLAYER(SPECIES_TAUROS) { Ability(ability); Status1(move == MOVE_SNORE ? STATUS1_SLEEP : STATUS1_NONE); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
if (move == MOVE_ALLURING_VOICE) // Alluring Voice requires the target to boost stats to have an effect
|
||||
if (move == MOVE_ALLURING_VOICE || move == MOVE_BURNING_JEALOUSY) // Alluring Voice requires the target to boost stats to have an effect
|
||||
TURN { MOVE(opponent, MOVE_AGILITY); MOVE(player, move); }
|
||||
else
|
||||
TURN { MOVE(player, move); }
|
||||
|
@ -35,8 +35,7 @@ SINGLE_BATTLE_TEST("Sheer Force boosts power, but removes secondary effects of m
|
|||
if (ability == ABILITY_SHEER_FORCE) {
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
if (move != MOVE_ALLURING_VOICE)
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||
STATUS_ICON(opponent, STATUS1_FREEZE);
|
||||
STATUS_ICON(opponent, STATUS1_POISON);
|
||||
STATUS_ICON(opponent, STATUS1_BURN);
|
||||
|
|
Loading…
Reference in a new issue