Fix grassy terrain freezing the game (#2959)

This commit is contained in:
Alex 2023-04-28 14:58:43 +02:00 committed by GitHub
parent 32dcea0cdb
commit 0cbb80dda7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 118 additions and 2 deletions

View File

@ -6944,14 +6944,14 @@ BattleScript_MagicRoomEnds::
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_GrassyTerrainEnds:
setbyte cMULTISTRING_CHOOSER, B_MSG_TERRAINENDS_GRASS
BattleScript_TerrainEnds_Ret::
printfromtable gTerrainEndingStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG
return
BattleScript_GrassyTerrainEnds:
setbyte cMULTISTRING_CHOOSER, B_MSG_TERRAINENDS_GRASS
BattleScript_TerrainEnds::
call BattleScript_TerrainEnds_Ret
end2

View File

@ -61,3 +61,32 @@ SINGLE_BATTLE_TEST("Electric Terrain increases power of Electric-type moves by 3
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage);
}
}
SINGLE_BATTLE_TEST("Electric Terrain lasts for 5 turns")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_ELECTRIC_TERRAIN); }
TURN {}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Foe Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_ELECTRIC_TERRAIN, player);
MESSAGE("An electric current runs across the battlefield!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("The electricity disappeared from the battlefield.");
}
}

View File

@ -84,3 +84,32 @@ SINGLE_BATTLE_TEST("Grassy Terrain decreases power of Earthquake and Bulldoze by
EXPECT_MUL_EQ(results[2].damage, Q_4_12(0.5), results[3].damage);
}
}
SINGLE_BATTLE_TEST("Grassy Terrain lasts for 5 turns")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_GRASSY_TERRAIN); }
TURN {}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Foe Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_GRASSY_TERRAIN, player);
MESSAGE("Grass grew to cover the battlefield!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("The grass disappeared from the battlefield.");
}
}

View File

@ -78,3 +78,32 @@ SINGLE_BATTLE_TEST("Misty Terrain decreases power of Dragon-type moves by 50 per
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
}
}
SINGLE_BATTLE_TEST("Misty Terrain lasts for 5 turns")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_MISTY_TERRAIN); }
TURN {}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Foe Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_MISTY_TERRAIN, player);
MESSAGE("Mist swirled about the battlefield!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("The mist disappeared from the battlefield.");
}
}

View File

@ -136,3 +136,32 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority field moves", s16 dam
MESSAGE("Sableye used Sunny Day!");
}
}
SINGLE_BATTLE_TEST("Psychic Terrain lasts for 5 turns")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_PSYCHIC_TERRAIN); }
TURN {}
TURN {}
TURN {}
TURN {}
} SCENE {
MESSAGE("Foe Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHIC_TERRAIN, player);
MESSAGE("The battlefield got weird!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Wobbuffet used Celebrate!");
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("The weirdness disappeared from the battlefield.");
}
}