File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2789,6 +2789,29 @@ fn add_end_of_turn_instructions(
27892789
27902790 // Terrain decrement / dissipation
27912791 if state. terrain . turns_remaining > 0 && state. terrain . terrain_type != Terrain :: NONE {
2792+ if state. terrain . terrain_type == Terrain :: GRASSYTERRAIN {
2793+ for side_ref in sides {
2794+ let side = state. get_side ( side_ref) ;
2795+ let active_pkmn = side. get_active ( ) ;
2796+ if active_pkmn. hp == 0 || !active_pkmn. is_grounded ( ) {
2797+ continue ;
2798+ }
2799+ let heal_amount = cmp:: min (
2800+ ( active_pkmn. maxhp as f32 * 0.0625 ) as i16 ,
2801+ active_pkmn. maxhp - active_pkmn. hp ,
2802+ ) ;
2803+ if heal_amount > 0 {
2804+ let heal_instruction = Instruction :: Heal ( HealInstruction {
2805+ side_ref : * side_ref,
2806+ heal_amount,
2807+ } ) ;
2808+ active_pkmn. hp += heal_amount;
2809+ incoming_instructions
2810+ . instruction_list
2811+ . push ( heal_instruction) ;
2812+ }
2813+ }
2814+ }
27922815 let terrain_dissipate_instruction = Instruction :: DecrementTerrainTurnsRemaining ;
27932816 incoming_instructions
27942817 . instruction_list
Original file line number Diff line number Diff line change @@ -12146,6 +12146,10 @@ fn test_grassyglide_in_grassyterrain_increased_priority() {
1214612146 side_ref: SideReference::SideTwo,
1214712147 damage_amount: 1,
1214812148 }),
12149+ Instruction::Heal(HealInstruction {
12150+ side_ref: SideReference::SideOne,
12151+ heal_amount: 6,
12152+ }),
1214912153 Instruction::DecrementTerrainTurnsRemaining,
1215012154 ],
1215112155 }];
@@ -12160,8 +12164,8 @@ fn test_grassyglide_not_in_grassyterrain_increased_priority() {
1216012164
1216112165 let vec_of_instructions = set_moves_on_pkmn_and_call_generate_instructions(
1216212166 &mut state,
12163- Choices::GRASSYGLIDE,
12164- Choices::TACKLE, // no chance to run this even though side_two is faster
12167+ Choices::GRASSYGLIDE, // no chance to execute this because side_two kills side_one
12168+ Choices::TACKLE,
1216512169 );
1216612170
1216712171 let expected_instructions = vec![StateInstructions {
You can’t perform that action at this time.
0 commit comments