diff --git a/include/pokemon.h b/include/pokemon.h index d1f2c1d575..23e79f5573 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -399,44 +399,22 @@ struct BattleMove const struct AdditionalEffect *additionalEffects; }; -// for some reason struct arguments are counted as 2? -#define ADDITIONAL_EFFECTS(...)\ - .numAdditionalEffects = NARG_8(__VA_ARGS__) / 2,\ - .additionalEffects = (const struct AdditionalEffect[]){\ - VARARG_8(ADDITIONAL_EFFECTS_, __VA_ARGS__)\ - } -#define ADDITIONAL_EFFECTS_0() -#define ADDITIONAL_EFFECTS_2(a, b) a, b -#define ADDITIONAL_EFFECTS_4(a, b, c, d) a, b, c, d -#define ADDITIONAL_EFFECTS_6(a, b, c, d, e, f) a, b, c, d, e, f +#define ADDITIONAL_EFFECTS(...) \ + .numAdditionalEffects = NARG_8(__VA_ARGS__) / 3, \ + .additionalEffects = (const struct AdditionalEffect[]) { __VA_ARGS__ } -#define PRIMARY_EFFECT(_moveEffect, ...){.moveEffect = _moveEffect} -#define PRIMARY_EFFECT_SELF(_moveEffect, ...){.self = TRUE, .moveEffect = _moveEffect} -#define SECONDARY_EFFECT(_moveEffect, _chance, ...){.chance = _chance, .moveEffect = _moveEffect} -#define SECONDARY_EFFECT_SELF(_moveEffect, _chance, ...){.self = TRUE, .chance = _chance, .moveEffect = _moveEffect} +#define PRIMARY_EFFECT(_moveEffect) {.self = FALSE, .chance = 0, .moveEffect = _moveEffect} +#define PRIMARY_EFFECT_SELF(_moveEffect) {.self = TRUE, .chance = 0, .moveEffect = _moveEffect} +#define SECONDARY_EFFECT(_moveEffect, _chance) {.self = FALSE, .chance = _chance, .moveEffect = _moveEffect} +#define SECONDARY_EFFECT_SELF(_moveEffect, _chance) {.self = TRUE, .chance = _chance, .moveEffect = _moveEffect} struct AdditionalEffect { bool8 self; u8 chance; // 0% = effect certain, primary effect u16 moveEffect; - // union { - // u32 data; // status effect etc. (not sure what to call this) - // // struct StatChange *statChange; // will include when stat changer overhaul is merged - // }; }; -// struct StatChange -// { -// s8 atk; -// s8 def; -// s8 spa; -// s8 spd; -// s8 spe; -// s8 acc; -// s8 eva; -// }; - #define SPINDA_SPOT_WIDTH 16 #define SPINDA_SPOT_HEIGHT 16 diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 0efdd68498..b116756d6b 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -12176,9 +12176,9 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] = .zMoveEffect = Z_EFFECT_NONE, .makesContact = TRUE, .bitingMove = TRUE, - // ADDITIONAL_EFFECTS( // broke it oops - // PRIMARY_EFFECT(MOVE_EFFECT_TRAP_BOTH), - // ) + ADDITIONAL_EFFECTS( + PRIMARY_EFFECT(MOVE_EFFECT_TRAP_BOTH), + ), }, [MOVE_STUFF_CHEEKS] = diff --git a/test/battle/move_effect/jaw_lock.c b/test/battle/move_effect/jaw_lock.c new file mode 100644 index 0000000000..6f7239231b --- /dev/null +++ b/test/battle/move_effect/jaw_lock.c @@ -0,0 +1,23 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gBattleMoves[MOVE_JAW_LOCK].additionalEffects[0].moveEffect == MOVE_EFFECT_TRAP_BOTH); +} + +SINGLE_BATTLE_TEST("Jaw Lock traps both opponents") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_JAW_LOCK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_JAW_LOCK, player); + MESSAGE("Neither Pokémon can run away!"); + } THEN { // Can't find good way to test trapping + EXPECT(opponent->status2 & STATUS2_ESCAPE_PREVENTION); + EXPECT(player->status2 & STATUS2_ESCAPE_PREVENTION); + } +}