In the US version of Paper Mario, the jump action command (action_command_jump) is one press of A timed to the stomp, and runs only once Mario has learned action commands (not AC_MODE_NOT_LEARNED). The basic Jump (EVS_UseMove_Basic, the script for menu level 0) computes the jump's length as (distance - 20) / 10.588 + 15 from Mario to the target, gives that count to PlayerBasicJumpToGoal, and passes the same count to the command as prepareTime, at difficulty AC_DIFFICULTY_STANDARD (index 3 of 8). Each update the command counts prepareTime down until it is no more than the window size, actionCmdTableJump[difficulty], which is 4 at standard in a table running 7 down to 0; it then sets the window timer to that size and counts it down to 0. A press of A while prepareTime is still counting sets wrongButtonPressed, and the window then takes no press; the update in which the count reaches the window size runs that early-press test before falling through into the window, so a press there is early too, and a press counts only while the timer runs from 3 to 0, 4 updates at standard (computed), the last of the command's updates. When the partner isn't acting, adjust_action_command_difficulty lowers the difficulty index by 3 for each Dodge Master badge equipped, clamped at 0, so one badge widens the window to 7 updates (computed). A good press makes the basic Jump's first stomp a nice hit, and the script then bounces Mario into a second stomp; each stomp passes a damage of 1. A missed press ends the move after the first. | src/battle/action_cmd.c L28src/battle/action_cmd.h L41–45src/battle/action_cmd.c L101–114src/inventory.c L1578–1610src/battle/action_cmd/jump.c L57–65src/battle/action_cmd/jump.c L130–188src/battle/common/move/JumpSupport.inc.c L75–88src/battle/common/move/JumpSupport.inc.c L309–318src/battle/move/jump/attack.c L40–43src/battle/move/jump/attack.c L75–95src/battle/move/jump/attack.c L107–113src/battle/dmg_player.c L1545–1548src/battle/dmg_player.c L1028–1031 | Code |
In the US version of Paper Mario, the hammer action command (action_command_hammer) is a hold and release of the stick to the left. When action commands are learned and the Berserker badge isn't equipped, the hammer script (outside the tutorial and auto-success) waits up to 45 updates for the stick to be held left, then starts the command with a duration of 51 (45 plus 6) at AC_DIFFICULTY_STANDARD, whose table value actionCmdTableHammer[3] is 8 without a Dodge Master badge. The command's timer counts up from 0 each update. Its look-back count is the table value minus the updates left (duration - stateTimer) plus 3, at least 0: while it is 0, a stick not held left fails the command at once (ACTION_RESULT_EARLY), and once it is above 0 the command succeeds if any of that many latest entries of the held-button buffer has the stick not held left. That opens the release window at timer 41 and keeps it through timer 51, 11 updates (computed); the command marks ready (HES_TimingReady and its sound) at timer 42, one update after the window opens (computed). A stick still held when the timer passes 51 fails. With the basic hammer, a success passes a damage of 2 and a failure 1 (comments in the script call them "good input dmg" and "bad input dmg"). | src/battle/action_cmd.c L29src/battle/common/move/HammerSupport.inc.c L13–23src/battle/common/move/HammerSupport.inc.c L257–274src/battle/move/hammer/attack.c L17–21src/battle/move/hammer/attack.c L95–118src/battle/action_cmd/hammer.c L99–102src/battle/action_cmd/hammer.c L207–216src/battle/action_cmd/hammer.c L256–258src/battle/action_cmd/hammer.c L268–303src/battle/action_cmd/hammer.c L308–313src/battle/16C8E0.c L292–298 | Code |
In the US version of Paper Mario, an enemy's hit on Mario is guarded when A was pressed shortly before it lands. calc_enemy_damage_target calls check_block_input(BUTTON_A) when Mario's debuff is none or one numbered at or after STATUS_KEY_POISON (so not dizzy, paralyzed, asleep, frozen, or stopped), he isn't stone, and the attack isn't DAMAGE_TYPE_UNBLOCKABLE; with the Berserker badge, rand_int(1) decides instead. The check returns false before action commands are learned and in demo battles, and returns a guard with no press in the tutorial battle while the mode is AC_MODE_TUTORIAL_BLOCK. It guards if a fresh press of A is in the last 3 entries of the battle's pressed-button buffer, which btl_update writes once per battle update (5 entries with a Dodge Master badge, when the partner isn't acting), unless A was also pressed in the 10 entries before those. A guard takes 1 from Mario's damage, plus 1 for each Damage Dodge badge equipped. A guard by the partner, checked the same way when the partner isn't stone or knocked out, sets the damage to 0. | src/battle/action_cmd.c L551–553src/battle/action_cmd.c L556–616src/battle/16C8E0.c L292–295src/battle/1A5830.c L231src/battle/1A5830.c L430–466include/enums.h L2808–2813src/battle/190B20.c L2870–2878src/inventory.c L1881–1883 | Code |
In the US version of Paper Mario, calc_player_damage_enemy works out Mario's damage to an enemy by subtraction. A forced immune hit (BS_FLAGS1_FORCE_IMMUNE_HIT) skips the calculation, and some hits return before it: an illusory, transparent, or buried target (buried unless the attack is a quake) is missed; a stone target takes nothing; a jump on a spiky top without Spike Shield, a contact attack on an explode-on-contact part, on a fiery part without Fire Shield or Ice Power, or on the alternate spiky flag without Spike Shield backfires; and a fire attack that sets off a part that explodes on fire returns before damage. Otherwise it starts from the move's damage (curAttackDamage, which the move script passes), adds Power Plus badges (count_power_plus), and adds or takes fixed amounts for Merlee, the jump and hammer charges, other badges, and statuses (L456-L535). A missed All or Nothing sets the damage to 0, and outside the Japanese build the defense too; a shrunk Mario's damage is halved, but stays at least 1; a blast on a part that explodes on ignition sets the damage to the target's HP and the defense to 0; and DAMAGE_TYPE_STATUS_ALWAYS_HITS sets both to 0. The total is capped at 99, and the target's defense is then subtracted: get_defense, plus the defense boost unless the attack ignores defense, plus 127 for a part flagged extreme defense, or 0 when the total is below 0. A result below 0 becomes 0, and a Power Bounce then adds its counter, keeping a hit above 0 at least 1. The function's one rand_int call, the DAMAGE_TYPE_FEAR scare-away test, runs after the damage is taken off the target's HP. | src/battle/dmg_player.c L240src/battle/dmg_player.c L292–380src/battle/dmg_player.c L443–459src/battle/dmg_player.c L462–492src/battle/dmg_player.c L536–576src/battle/dmg_player.c L578–598src/battle/dmg_player.c L630src/battle/dmg_player.c L672–674src/battle/dmg_player.c L1548 | Code |