Skip to content

Commit

Permalink
correct where last damage gets cleared for gen 1 PS
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Jul 4, 2023
1 parent 8779433 commit a324c50
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/gen1/mechanics.zig
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@ fn doMove(
var hits: u4 = 1;
var effectiveness = Effectiveness.neutral;

// Due to control flow shenanigans we need to clear last_damage for Pokémon Showdown
if (showdown and !counter) battle.last_damage = 0;

// The cartridge handles set damage moves in applyDamage but we short circuit to simplify things
if (move.effect == .SuperFang or move.effect == .SpecialDamage) {
return specialDamage(battle, player, move, options);
Expand Down Expand Up @@ -956,9 +959,6 @@ fn doMove(
}
}

// Due to control flow shenanigans we need to clear last_damage for Pokémon Showdown
if (showdown and skip) battle.last_damage = 0;

var zero = battle.last_damage == 0;
miss = if (showdown or skip)
miss
Expand Down
59 changes: 59 additions & 0 deletions src/test/regression/fixtures/gen1/0xA31F27EAF9BF4E3B.input.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
>start {"formatid":"gen1customgame@@@Endless Battle Clause,Sleep Clause Mod,Freeze Clause Mod","seed":[41759,10218,63935,20027]}
>player p1 {"name":"Bot 1","team":"Weedle|||None|razorwind,slash,eggbomb,icebeam||200,126,188,93,93,82|N|5,12,23,18,18,13||70|211]Blastoise|||None|highjumpkick,acidarmor,dig,counter||206,111,13,192,192,100|N|0,28,29,25,25,28||92|159]Bulbasaur|||None|hyperbeam,absorb,psywave,swift||107,239,29,1,1,189|N|3,13,13,19,19,18||98|88]Arbok|||None|sing,horndrill,submission,poisonsting||100,121,81,123,123,241|N|9,26,16,2,2,29||57|67]Pidgeot|||None|bonemerang,psybeam,doublekick,firepunch||138,12,55,79,79,101|N|14,15,,12,12,19||99|107]Flareon|||None|doubleteam,flamethrower,hornattack,barrage||200,88,206,126,126,141|N|1,1,16,18,18,12||52|64"}
>player p2 {"name":"Bot 2","team":"Arcanine|||None|scratch,furyswipes,skullbash,pinmissile||164,3,93,23,23,49|N|15,30,7,6,6,19||72|10]Omanyte|||None|sandattack,seismictoss,withdraw,lightscreen||60,152,138,29,29,117|N|10,14,8,13,13,19||50|178]Raichu|||None|aurorabeam,toxic,headbutt,megadrain||128,210,34,22,22,214|N|11,18,25,10,10,||84|16]Oddish|||None|stunspore,amnesia,growth,sonicboom||89,120,65,74,74,18|N|3,20,9,18,18,11||99|32]Primeape|||None|drillpeck,crabhammer,glare,hydropump||72,153,78,142,142,148|N|12,23,3,0,0,16||91|83]Magmar|||None|bodyslam,softboiled,disable,karatechop||108,35,113,94,94,28|N|11,10,5,23,23,15||71|77"}
>p1 switch 2
>p2 switch 2
>p1 move highjumpkick
>p2 move sandattack
>p1 move acidarmor
>p2 move seismictoss
>p1 move dig
>p2 move withdraw
>p1 move dig
>p2 switch 2
>p1 switch 2
>p2 move scratch
>p1 switch 3
>p2 move furyswipes
>p1 move hyperbeam
>p2 move skullbash
>p1 move recharge
>p2 move skullbash
>p1 switch 4
>p2 move pinmissile
>p1 switch 5
>p2 switch 3
>p1 move bonemerang
>p2 move aurorabeam
>p2 switch 4
>p1 move psybeam
>p2 switch 5
>p1 switch 6
>p2 move drillpeck
>p1 move doubleteam
>p2 switch 6
>p1 move flamethrower
>p2 move bodyslam
>p1 move hornattack
>p2 move softboiled
>p1 switch 2
>p2 move disable
>p1 move counter
>p2 move karatechop
>p1 move acidarmor
>p2 switch 2
>p1 move highjumpkick
>p2 switch 2
>p2 switch 5
>p1 move highjumpkick
>p2 move stunspore
>p1 move acidarmor
>p2 move amnesia
>p1 move dig
>p2 move growth
>p1 move dig
>p2 switch 3
>p1 move highjumpkick
>p2 move skullbash
>p1 move counter
>p2 move skullbash

0 comments on commit a324c50

Please sign in to comment.