pub trait DungeonMonsterWrite: Sealed {
Show 25 methods // Provided methods fn update_move_pp(&mut self, should_consume_pp: bool) { ... } fn try_activate_truant(&mut self) { ... } fn try_weather_form_change(&mut self) { ... } fn restore_pp_for_all_moves_set_flags(&mut self) { ... } fn evolve_this_enemy_if_should(&mut self) { ... } unsafe fn evolve( &mut self, param_2: &mut undefined4, new_monster_idx: MonsterSpeciesId ) { ... } fn calc_speed_stage(&mut self, counter_weight: i32) -> i32 { ... } fn set_reflect_damage_countdown_to_four(&mut self) { ... } fn execute_action(&mut self) { ... } unsafe fn ai_movement(&mut self, param: undefined) { ... } fn calculate_ai_target_pos(&mut self) { ... } fn choose_ai_move(&mut self) { ... } fn clear_monster_action_fields(&mut self) { ... } fn set_monster_action_fields(&mut self, action_id: Type) { ... } fn set_action_pass_turn_or_walk(&mut self, monster_id: MonsterSpeciesId) { ... } fn set_action_regular_attack(&mut self, direction: Direction) { ... } unsafe fn set_action_use_move_ai_unchecked( &mut self, move_index: u8, direction: Direction ) { ... } fn set_action_use_move_ai(&mut self, move_index: u8, direction: Direction) { ... } fn update_ai_target_pos(&mut self) { ... } unsafe fn run_ai(&mut self, param: undefined) { ... } fn ai_consider_move( &mut self, ai_possible_move: &mut ai_possible_move, the_move: &Move ) -> i32 { ... } unsafe fn try_add_target_to_ai_target_list( &mut self, current_num_targets: i32, move_ai_range: MoveTargetAndRange, target: &DungeonEntity, the_move: &Move, check_all_conditions: bool ) -> i32 { ... } fn update_status_icon_flags(&mut self) { ... } fn set_monster_type_and_ability(&mut self) { ... } fn change_shaymin_forme(&mut self, mode: i32) -> i32 { ... }
}
Expand description

Trait for DungeonMonsterMut (write operations).

You may find more operations in DungeonEffectsEmitter.

Important safety note

Please see the safety note of DungeonEntity. It also applies to this trait.

Provided Methods§

source

fn update_move_pp(&mut self, should_consume_pp: bool)

Updates the PP of any moves that were used the a monster, if PP should be consumed.

source

fn try_activate_truant(&mut self)

Checks if the monster has the ability Truant, and if so tries to apply the pause status to it.

source

fn try_weather_form_change(&mut self)

Tries to change a monster into one of its weather-related alternative forms.

Applies to Castform and Cherrim, and checks for their unique abilities.

source

fn restore_pp_for_all_moves_set_flags(&mut self)

Restores PP for all moves, clears flags Move::f_consume_2_pp, Move::flags2_unk5 and Move::flags2_unk7, and sets flag Move::f_consume_pp.

Called when a monster is revived.

source

fn evolve_this_enemy_if_should(&mut self)

Checks if the specified enemy should evolve because it just defeated an ally, and if so, attempts to evolve it.

source

unsafe fn evolve( &mut self, param_2: &mut undefined4, new_monster_idx: MonsterSpeciesId )

Makes the specified monster evolve into the specified species.

Safety

The caller must make sure the undefined params are valid for this function.

source

fn calc_speed_stage(&mut self, counter_weight: i32) -> i32

Calculates the speed stage of a monster from its speed up/down counters. The second parameter is the weight of each counter (how many stages it will add/remove), but appears to be always 1.

Takes modifiers into account (paralysis, snowy weather, Time Tripper). Deoxys-speed, Shaymin-sky and enemy Kecleon during a thief alert get a flat +1 always.

The calculated speed stage is both returned and saved in the monster’s statuses struct.

source

fn set_reflect_damage_countdown_to_four(&mut self)

Sets the monster’s reflect damage countdown to 4.

source

fn execute_action(&mut self)

Executes the set action for the specified monster.

Used for both AI actions and player-inputted actions. If the action is not ACTION_NOTHING, ACTION_PASS_TURN, ACTION_WALK or ACTION_UNK_4, the monster’s already_acted field is set to true.

source

unsafe fn ai_movement(&mut self, param: undefined)

Used by the AI to determine the direction in which a monster should move.

Safety

The caller must make sure the undefined params are valid for this function.

source

fn calculate_ai_target_pos(&mut self)

Calculates the target position of an AI-controlled monster and stores it in the monster’s ffi::monster::ai_target_pos field.

source

fn choose_ai_move(&mut self)

Determines if an AI-controlled monster will use a move and which one it will use.

source

fn clear_monster_action_fields(&mut self)

Clears the fields related to AI in the monster’s data struct, setting them all to 0. Specifically, ffi::monster::action_id, ffi::monster::action_use_idx and ffi::monster::field_0x54 are cleared.

source

fn set_monster_action_fields(&mut self, action_id: Type)

Sets some the fields related to AI in the monster’s data struct. Specifically, ffi::monster::action_id, ffi::monster::action_use_idx and ffi::monster::field_0x54. The last 2 are always set to 0.

source

fn set_action_pass_turn_or_walk(&mut self, monster_id: MonsterSpeciesId)

Sets a monster’s action to ffi::action::ACTION_PASS_TURN or ffi::action::ACTION_WALK, depending on the result of MonsterSpeciesId::get_can_move_flag for the monster’s ID.

source

fn set_action_regular_attack(&mut self, direction: Direction)

Sets a monster’s action to ffi::action::ACTION_REGULAR_ATTACK, with a specified direction.

source

unsafe fn set_action_use_move_ai_unchecked( &mut self, move_index: u8, direction: Direction )

Sets a monster’s action to ffi::action::ACTION_USE_MOVE_AI, with a specified direction and move index.

Safety

The caller must make sure the move index is not out of bounds (normally 0-3).

source

fn set_action_use_move_ai(&mut self, move_index: u8, direction: Direction)

Sets a monster’s action to ffi::action::ACTION_USE_MOVE_AI, with a specified direction and move index.

Panics if the move index is out of bounds (> 3).

source

fn update_ai_target_pos(&mut self)

Updates t monster’s ffi::monster::target_pos field based on its current position and the direction in which it plans to attack.

source

unsafe fn run_ai(&mut self, param: undefined)

Runs the AI for a single monster to determine whether the monster can act and which action it should perform if so.

Safety

The caller must make sure the undefined params are valid for this function.

source

fn ai_consider_move( &mut self, ai_possible_move: &mut ai_possible_move, the_move: &Move ) -> i32

The AI uses this function to check if a move has any potential targets, to calculate the list of potential targets and to calculate the move’s special weight. This weight will be higher if the monster has weak-type picker and the target is weak to the move (allies only, enemies always get a result of 1 even if the move is super effective). More things could affect the result. This function also sets the flag can_be_used on the ai_possible_move struct if it makes sense to use it. More research is needed. There’s more documentation about this special weight. Does all the documented behavior happen in this function?

Returns the move’s calculated weight

source

unsafe fn try_add_target_to_ai_target_list( &mut self, current_num_targets: i32, move_ai_range: MoveTargetAndRange, target: &DungeonEntity, the_move: &Move, check_all_conditions: bool ) -> i32

Checks if the specified target is eligible to be targeted by the AI and if so adds it to the list of targets. This function also fills an array that seems to contain the directions in which the user should turn to look at each of the targets in the list, as well as a third unknown array.

If check_all_conditions is true check all the possible MoveAiCondition values, false to only check for MoveAiCondition::Random (if the move has a different ai condition, the result will be false).

Panics if any field in the MoveTargetAndRange is None or the conversion into the ffi type fails for any other reason.

Returns the new length of the AI target list.

Safety

The length of the target list must be correct.

source

fn update_status_icon_flags(&mut self)

Sets the monster’s status_icon_flags bitfield according to its current status effects. Does not affect a Sudowoodo in the “permanent sleep” state (ffi::statuses::sleep == 0x7F).

Some of the status effect in monster:statuses are used as an index to access an array, where every group of 8 bytes represents a bitmask. All masks are added in a bitwise OR and then stored in ffi::monster::status_icons.

Also sets icon flags for ffi::statuses::exposed, ffi::statuses::grudge, critical HP and lowered stats with explicit checks, and applies the effect of the Identifier Orb (see ffi::dungeon::identify_orb_flag).

source

fn set_monster_type_and_ability(&mut self)

Checks Forecast ability

Note: unverified, ported from Irdkwia’s notes

source

fn change_shaymin_forme(&mut self, mode: i32) -> i32

forme: 1: change from Land to Sky 2: change from Sky to Land

result: 0: not Shaymin 1: not correct Forme 2: frozen 3: ok

Note: unverified, ported from Irdkwia’s notes

Implementors§