Skip to content

Multi-turn move mechanics, and stat changes landing on the right Pokémon - #5

Merged
TechLuddite merged 1 commit into
mainfrom
claude/pokemon-battle-sim-rules-gx0od0
Aug 4, 2026
Merged

TechLuddite merged 1 commit into
mainfrom
claude/pokemon-battle-sim-rules-gx0od0

Conversation

@TechLuddite

Copy link
Copy Markdown
Owner

From Joseph's feedback after playing the sim: moves that charge or spread their effect over several turns were missing, and stat drops weren't always going to the right Pokémon.

1. Anything that takes more than one turn

All of it curated, modeled and tested — nothing guessed at:

  • Charge moves — Solar Beam, Fly, Dig, Dive, Bounce, Phantom Force, Shadow Force, Sky Attack, Skull Bash, Meteor Beam, Electro Shot, Razor Wind, Geomancy and the rest. Semi-invulnerability while hiding, the short list of moves that reach through it (Earthquake finds a digging Pokémon, and hits twice as hard for it), Solar Beam firing instantly in sun and at half power in bad weather, charge-turn stat boosts, and Power Herb to skip the wind-up.
  • Recharge moves — Hyper Beam and friends cost the next turn. A miss doesn't.
  • Rampage locks — Outrage, Thrash, Petal Dance lock you in for 2–3 turns and leave you confused. A miss ends it early with no confusion.
  • Confusion — 1/3 to hit yourself for a 40-power typeless hit off your own Attack into your own Defence.
  • Momentum moves — Rollout and Fury Cutter double on each consecutive use.
  • Partial trapping — Bind, Fire Spin, Whirlpool, Infestation: 1/8 a turn and no switching out. Mean Look holds with no timer.
  • Leech Seed, Wish, Future Sight, Doom Desire, Perish Song, Yawn.
  • Taunt, Encore, Disable — three different ways to take a move away.
  • Reflect, Light Screen, Aurora Veil, Tailwind, Trick Room.
  • Protect — with the escalating failure odds that stop it being unbeatable, and Shadow Force going straight through it. Substitute — soaks damage, blocks status and stat drops.
  • Fake Out and First Impression only work the turn you come in; Focus Punch breaks if you're hit first; Roost costs a Flying type its wings for the turn; U-turn and friends hand the turn back so you can swap.

Every counter now ticks in one documented place (endOfTurn), in a fixed order — a Pokémon on 4 HP with a burn and a Wish incoming lives or dies on it.

2. Stat changes on the right Pokémon

Three real bugs, all in the same place:

  • The self-vs-target test compared PokéAPI's meta category against "damage+raise", but the baked data spells it "damage-raise". So every self-boosting damaging move was buffing the opponent — Power-Up Punch raised the foe's Attack, and so did Meteor Mash, Metal Claw, Flame Charge, Charge Beam, Ancient Power, Steel Wing, Diamond Storm and Fiery Dance.
  • A move's own stat change was skipped when the hit knocked the target out, so a Draco Meteor that KOs left the user at full Sp. Atk. It now drops either way, as it does in game.
  • Moves with no meta block at all (Make It Rain, Armor Cannon, Headlong Rush) applied no stat change whatsoever. Fixed.

Verified against the real baked dex: Draco Meteor/Overheat drop the user's Sp. Atk, Close Combat/Armor Cannon drop the user's defences, Power-Up Punch raises the user's Attack, and Snarl/Mystical Fire/Eerie Impulse drop the target's Sp. Atk.

Also corrected

Status moves no longer bounce off type immunities — Encore, Yawn and Perish Song work on a Ghost, Confuse Ray works on a Normal type. That gate is for attacks; only Electric and Poison status moves respect it. And a simultaneous double faint (very reachable now Perish Song exists) names one winner consistently instead of leaving state.winner disagreeing with the event log.

Checks

  • npm run test:run — 156 pass, 63 of them new, every expected value derived by hand from the formulas before the code was run.
  • npm run build — clean.
  • 400 randomised auto-battles against the full 1300-entry dex, teams of 1–6 with real learnsets and a heavy bias toward the new moves: no crashes, no stalls, all decided.

battle.js and typeChart.js are untouched. ROADMAP.md records what's still deliberately not modeled — contact-triggered items and abilities (which is why Spiky Shield and King's Shield block but don't punish), terrain, and the switch-out timing simplification.

🤖 Generated with Claude Code

https://claude.ai/code/session_017SGWh8kJjQsy4QB9pigonf


Generated by Claude Code

Joseph's feedback after playing the sim: moves that charge or spread their
effect over several turns were missing, and stat drops weren't always landing
on the right Pokémon.

Multi-turn mechanics, all with hand-derived tests:

- two-turn charge moves, with semi-invulnerability (Fly, Dig, Dive, Phantom
  Force), the moves that reach through it, Solar Beam's sun skip and bad
  weather penalty, charge-turn boosts, and Power Herb
- recharge moves, rampage locks and the confusion they end in
- confusion itself, plus momentum moves (Rollout, Fury Cutter)
- partial trapping and the switch block it applies; Mean Look
- Leech Seed, Wish, Future Sight, Perish Song, Yawn
- Taunt, Encore, Disable
- Reflect / Light Screen / Aurora Veil, Tailwind, Trick Room
- Protect (with escalating failure odds) and Substitute
- Fake Out, Focus Punch, Roost's grounding, and the switch-out moves

Every counter now ticks in one documented place, endOfTurn.

Stat-change fixes:

- the self/target test read PokeAPI's meta category as "damage+raise", but the
  baked data spells it "damage-raise", so every self-boosting damaging move
  was buffing the OPPONENT instead. Power-Up Punch raised the foe's Attack;
  Meteor Mash, Flame Charge, Charge Beam and Ancient Power did the same
- a move's own stat change now happens even when the hit knocks the target
  out, so a Draco Meteor that KOs still leaves the user at -2 Sp. Atk
- moves with no meta block at all (Make It Rain, Armor Cannon, Headlong Rush)
  applied no stat change whatsoever; they now drop the user correctly

Also corrected along the way: status moves no longer bounce off type
immunities, so Encore, Yawn and Perish Song work on a Ghost and Confuse Ray
works on a Normal type. Electric and Poison status moves still respect it.
A simultaneous double faint now names one winner consistently.

156 tests pass, 63 of them new.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017SGWh8kJjQsy4QB9pigonf
@TechLuddite
TechLuddite merged commit 63c6cdd into main Aug 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants