From 597299136f766890385d7394af6f9daf856c131c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 29 Sep 2018 14:10:53 +0200 Subject: [PATCH] Add Pollen Puff effect --- asm/macros/battle_script.inc | 5 +++++ data/battle_scripts_1.s | 5 +++++ include/constants/battle_move_effects.h | 1 + include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 6 ++++++ src/data/battle_moves.h | 18 +++++++++--------- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 19755a579..689cd8855 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1512,6 +1512,11 @@ .4byte \ptr .endm + .macro jumpiftargetally ptr + various BS_ATTACKER, VARIOUS_JUMP_IF_TARGET_ALLY + .4byte \ptr + .endm + @ helpful macros .macro setstatchanger stat, stages, down setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5e4b11218..1f487d87a 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -318,6 +318,11 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectAutonomize .4byte BattleScript_EffectCopycat .4byte BattleScript_EffectDefog + .4byte BattleScript_EffectHitEnemyHealAlly + +BattleScript_EffectHitEnemyHealAlly: + jumpiftargetally BattleScript_EffectHealPulse + goto BattleScript_EffectHit BattleScript_EffectDefog: setstatchanger STAT_EVASION, 1, TRUE diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 76e5182fd..fb641e329 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -307,5 +307,6 @@ #define EFFECT_AUTONOMIZE 301 #define EFFECT_COPYCAT 302 #define EFFECT_DEFOG 303 +#define EFFECT_HIT_ENEMY_HEAL_ALLY 304 // Pollen Puff #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 90e72e717..518c6a103 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -109,6 +109,7 @@ #define VARIOUS_TRY_COPYCAT 56 #define VARIOUS_ABILITY_POPUP 57 #define VARIOUS_DEFOG 58 +#define VARIOUS_JUMP_IF_TARGET_ALLY 59 // atk80, dmg manipulation #define ATK80_DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 15b50f6ed..4a41b34ad 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6838,6 +6838,12 @@ static void atk76_various(void) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 4); } return; + case VARIOUS_JUMP_IF_TARGET_ALLY: + if (GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)) + gBattlescriptCurrInstr += 7; + else + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + return; } gBattlescriptCurrInstr += 3; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 50a83ebc3..ecef5a3a4 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -7680,7 +7680,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .split = SPLIT_PHYSICAL, }, { // MOVE_POLLEN_PUFF - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_HIT_ENEMY_HEAL_ALLY, .power = 90, .type = TYPE_BUG, .accuracy = 100, @@ -7721,7 +7721,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_BUG, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, @@ -7733,7 +7733,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_FIRE, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, @@ -7829,7 +7829,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_GRASS, .accuracy = 100, .pp = 15, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, @@ -7865,7 +7865,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_DRAGON, .accuracy = 100, .pp = 5, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SOUND, @@ -7925,7 +7925,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_FAIRY, .accuracy = 90, .pp = 5, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, @@ -7961,7 +7961,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_GHOST, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, @@ -7985,7 +7985,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_WATER, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 20, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED, @@ -8057,7 +8057,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_ELECTRIC, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 30, .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED,