Add config options for Jump Kick

Added options for:
- Gen 4 style recoil when target is immune (user takes 50% of target's max HP)
- Gen 3 style recoil when target is immune (i.e no recoil)
- Gen 5+ recoil was already implemented but was bugged
This commit is contained in:
BuffelSaft 2020-12-07 19:30:31 +13:00
parent ef41a4c14d
commit 72b769ec75
4 changed files with 22 additions and 0 deletions

View File

@ -2806,8 +2806,10 @@ BattleScript_EffectDoubleHit::
BattleScript_EffectRecoilIfMiss:: BattleScript_EffectRecoilIfMiss::
attackcanceler attackcanceler
accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
typecalc typecalc
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveMissedDoDamage jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveMissedDoDamage
.endif
goto BattleScript_HitFromAtkString goto BattleScript_HitFromAtkString
BattleScript_MoveMissedDoDamage:: BattleScript_MoveMissedDoDamage::
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_PrintMoveMissed jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_PrintMoveMissed
@ -2816,18 +2818,33 @@ BattleScript_MoveMissedDoDamage::
pause 0x40 pause 0x40
resultmessage resultmessage
waitmessage 0x40 waitmessage 0x40
.if B_CRASH_IF_TARGET_IMMUNE < GEN_4
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
.endif
printstring STRINGID_PKMNCRASHED printstring STRINGID_PKMNCRASHED
waitmessage 0x40 waitmessage 0x40
damagecalc damagecalc
typecalc typecalc
adjustdamage adjustdamage
.if B_CRASH_IF_TARGET_IMMUNE == GEN_4
manipulatedamage DMG_RECOIL_FROM_IMMUNE
.else
manipulatedamage DMG_RECOIL_FROM_MISS manipulatedamage DMG_RECOIL_FROM_MISS
.endif
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE bichalfword gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
.else
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED
.endif
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER, FALSE, NULL tryfaintmon BS_ATTACKER, FALSE, NULL
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
orhalfword gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE orhalfword gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
.else
orhalfword gMoveResultFlags, MOVE_RESULT_MISSED
.endif
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectMist:: BattleScript_EffectMist::

View File

@ -109,6 +109,7 @@
#define B_DISABLE_TURNS GEN_6 // Disable's turns. See Cmd_disablelastusedattack. #define B_DISABLE_TURNS GEN_6 // Disable's turns. See Cmd_disablelastusedattack.
#define B_INCINERATE_GEMS GEN_6 // In Gen6+, Incinerate can destroy Gems. #define B_INCINERATE_GEMS GEN_6 // In Gen6+, Incinerate can destroy Gems.
#define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. #define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
#define B_CRASH_IF_TARGET_IMMUNE GEN_6 // In Gen4+, The user of Jump Kick or Hi Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
// Ability settings // Ability settings
#define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move. #define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move.

View File

@ -175,6 +175,7 @@
#define DMG_CURR_ATTACKER_HP 5 #define DMG_CURR_ATTACKER_HP 5
#define DMG_BIG_ROOT 6 #define DMG_BIG_ROOT 6
#define DMG_1_2_ATTACKER_HP 7 #define DMG_1_2_ATTACKER_HP 7
#define DMG_RECOIL_FROM_IMMUNE 8 // Used to calculate recoil for the Gen 4 version of Jump Kick
// Cmd_jumpifcantswitch // Cmd_jumpifcantswitch
#define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80 #define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80

View File

@ -8606,6 +8606,9 @@ static void Cmd_manipulatedamage(void)
case DMG_1_2_ATTACKER_HP: case DMG_1_2_ATTACKER_HP:
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
break; break;
case DMG_RECOIL_FROM_IMMUNE:
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2;
break;
} }
gBattlescriptCurrInstr += 2; gBattlescriptCurrInstr += 2;