@@ -23,18 +23,14 @@ use poke_engine::instruction::{
2323 ToggleTrickRoomInstruction,
2424};
2525use poke_engine::pokemon::PokemonName;
26- use poke_engine::state::LastUsedMove;
2726use poke_engine::state::{
28- pokemon_index_iter, Move, PokemonBoostableStat, PokemonIndex, PokemonMoveIndex,
27+ pokemon_index_iter, LastUsedMove, Move, PokemonBoostableStat, PokemonIndex, PokemonMoveIndex,
2928 PokemonSideCondition, PokemonStatus, PokemonType, SideReference, State, StateWeather,
3029};
3130
3231#[cfg(feature = "terastallization")]
3332use poke_engine::instruction::ToggleTerastallizedInstruction;
3433
35- #[cfg(not(feature = "terastallization"))]
36- use poke_engine::state::LastUsedMove;
37-
3834pub fn generate_instructions_with_state_assertion(
3935 state: &mut State,
4036 side_one_move: &MoveChoice,
@@ -11983,6 +11979,40 @@ fn test_priority_move_on_grounded_pkmn_in_psychicterrain() {
1198311979 assert_eq!(expected_instructions, vec_of_instructions);
1198411980}
1198511981
11982+ #[test]
11983+ fn test_protect_in_psychicterrain() {
11984+ let mut state = State::default();
11985+ state.terrain.terrain_type = Terrain::PSYCHICTERRAIN;
11986+ state.terrain.turns_remaining = 5;
11987+
11988+ let vec_of_instructions = set_moves_on_pkmn_and_call_generate_instructions(
11989+ &mut state,
11990+ Choices::PROTECT,
11991+ Choices::SPLASH,
11992+ );
11993+
11994+ let expected_instructions = vec![StateInstructions {
11995+ percentage: 100.0,
11996+ instruction_list: vec![
11997+ Instruction::ApplyVolatileStatus(ApplyVolatileStatusInstruction {
11998+ side_ref: SideReference::SideOne,
11999+ volatile_status: PokemonVolatileStatus::PROTECT,
12000+ }),
12001+ Instruction::DecrementTerrainTurnsRemaining,
12002+ Instruction::RemoveVolatileStatus(RemoveVolatileStatusInstruction {
12003+ side_ref: SideReference::SideOne,
12004+ volatile_status: PokemonVolatileStatus::PROTECT,
12005+ }),
12006+ Instruction::ChangeSideCondition(ChangeSideConditionInstruction {
12007+ side_ref: SideReference::SideOne,
12008+ side_condition: PokemonSideCondition::Protect,
12009+ amount: 1,
12010+ }),
12011+ ],
12012+ }];
12013+ assert_eq!(expected_instructions, vec_of_instructions);
12014+ }
12015+
1198612016#[test]
1198712017fn test_priority_move_on_non_grounded_pkmn_in_psychicterrain() {
1198812018 let mut state = State::default();
0 commit comments