pub struct DungeonMonsterMut<'a>(pub &'a mut monster, pub &'a mut DungeonEntity);
Expand description

Mutable reference type for the info struct for DungeonEntity objects that are monsters.

For methods, see the DungeonMonsterRead and DungeonMonsterWrite traits.

Tuple Fields§

§0: &'a mut monster§1: &'a mut DungeonEntity

Implementations§

source§

impl<'a> DungeonMonsterMut<'a>

source

pub unsafe fn init_monster(monster: *mut monster, flag: bool)

Initializes a monster struct.

Safety

The monster must be a valid pointer to either a valid monster or an uninitialized monster.

Methods from Deref<Target = monster>§

source

pub fn f_ai_unk(&self) -> bool_

source

pub fn set_f_ai_unk(&mut self, val: bool_)

source

pub fn f_ai_skip_turn(&self) -> bool_

source

pub fn set_f_ai_skip_turn(&mut self, val: bool_)

source

pub fn flags_unk2(&self) -> u16

source

pub fn set_flags_unk2(&mut self, val: u16)

source

pub fn f_swapping_places(&self) -> bool_

source

pub fn set_f_swapping_places(&mut self, val: bool_)

source

pub fn flags_unk6(&self) -> u16

source

pub fn set_flags_unk6(&mut self, val: u16)

source

pub fn f_walking(&self) -> bool_

source

pub fn set_f_walking(&mut self, val: bool_)

source

pub fn flags_unk10(&self) -> u16

source

pub fn set_flags_unk10(&mut self, val: u16)

source

pub fn f_swapping_places_petrified_ally(&self) -> bool_

source

pub fn set_f_swapping_places_petrified_ally(&mut self, val: bool_)

Trait Implementations§

source§

impl<'a> Deref for DungeonMonsterMut<'a>

§

type Target = monster

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for DungeonMonsterMut<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a> DungeonMonsterRead for DungeonMonsterMut<'a>

source§

fn is_special_story_ally(&self) -> bool

Checks if the monster is a special story ally. This is a hard-coded check that looks at the monster’s “Joined At” field. If the value is in the range [ crate::api::dungeons::DungeonId::DUNGEON_JOINED_AT_BIDOOF, crate::api::dungeons::DungeonId::DUNGEON_DUMMY_0xE3 ], this check will return true.
source§

fn is_experience_locked(&self) -> bool

Checks if the monster does not gain experience. This basically just inverts IsSpecialStoryAlly, with the exception of also checking for the “Joined At” field being crate::api::dungeons::DungeonId::DUNGEON_CLIENT.
source§

fn is_holding_item(&self, item_id: ItemId) -> bool

Checks if the monster is holding a certain item that isn’t disabled by Klutz.
source§

fn has_low_health(&self) -> bool

Checks if the monster is at low health (below 25% rounded down).
source§

fn gastro_acid_status(&self) -> bool

Checks if the monster has the Gastro Acid status.
source§

fn is_ability_active(&self, ability_id: AbilityId) -> bool

source§

fn is_ability_active_any_entity(&self, ability_id: AbilityId) -> bool

source§

fn has_type(&self, type_id: MonsterTypeId) -> bool

Checks if the monster has a given type.
source§

fn is_iq_skill_enabled(&self, iq_skill_id: IqSkillId) -> bool

Checks if the monster has a certain IQ skill enabled.
source§

fn is_defender_ability_active( &self, defender: &DungeonEntity, defender_ability_id: AbilityId, own_ability_is_active: bool ) -> bool

Checks if a defender has an active ability that isn’t disabled by an attacker’s (self) Mold Breaker.
source§

fn is_exclusive_item_effect_active( &self, effect_id: ExclusiveItemEffectId ) -> bool

Checks if a certain exclusive item effect is active for the monster.
source§

fn get_type_matchup( &self, defender: &DungeonEntity, target_type_index: TargetTypeIndex, attack_type: MonsterTypeId ) -> Option<DungeonTypeMatchup>

Gets the type matchup for a given combat interaction. Attacker is self. Note that the actual monster’s types on the attacker and defender are not used; the entities are only used to check conditions. The actual type matchup table lookup is done solely using the attack and target type parameters. Read more
source§

fn calc_damage( &self, defender: &DungeonEntity, attack_type: MonsterTypeId, attack_power: i32, crit_chance: i32, damage_out: &mut damage_data, damage_multiplier: I24F8, move_id: MoveId, param_9: i32 )

Probably the damage calculation function. The result seems to get written to the unknown struct behind the pointer provided by damage_out, param_9 is also unknown. Read more
source§

unsafe fn calc_recoil_damage_fixed( &self, fixed_damage: i32, param_3: undefined4, damage_out: &mut damage_data, move_id: MoveId, attack_type: MonsterTypeId, param_7: i16, message_type: undefined4, param_9: undefined4, param_10: undefined4 )

Appears to calculate recoil damage to the monster. This function wraps Self::calc_damage_fixed using the monster as both the attacker and the defender, after doing some basic checks (like if the monster is already at 0 HP) and applying a boost from the Reckless ability if applicable. Some parameters are unknown. The result seems to get written to the unknown struct behind the pointer provided by damage_out, some other parameters are also unknown. Read more
source§

unsafe fn calc_damage_fixed( &self, defender: &DungeonEntity, fixed_damage: i32, param_4: undefined4, damage_out: &mut damage_data, attack_type: MonsterTypeId, move_category: MoveCategory, param_8: i16, message_type: undefined4, param_10: undefined4, param_11: undefined4 )

Appears to calculate damage from a fixed-damage effect. The result seems to get written to the unknown struct behind the pointer provided by damage_out, some other parameters are also unknown. Read more
source§

unsafe fn calc_damage_fixed_no_category( &self, defender: &DungeonEntity, fixed_damage: i32, param_4: undefined4, damage_out: &mut damage_data, attack_type: MonsterTypeId, param_7: i16, message_type: undefined4, param_9: undefined4, param_10: undefined4 )

A wrapper around Self::calc_damage_fixed with the move category set to MoveCategory::None. Read more
source§

unsafe fn calc_damage_fixed_wrapper( &self, defender: &DungeonEntity, fixed_damage: i32, param_4: undefined4, damage_out: &mut damage_data, attack_type: MonsterTypeId, move_category: MoveCategory, param_8: i16, param_9: undefined4, param_10: undefined4, param_11: undefined4 )

A wrapper (with potential side effects…?) around Self::calc_damage_fixed. Read more
source§

fn calc_damage_projectile( &self, defender: &DungeonEntity, used_move: &Move, move_power: i32, damage_multiplier: I24F8, item_id: ItemId ) -> i32

Appears to calculate damage from a variable-damage projectile. Read more
source§

fn calc_damage_final( &self, defender: &DungeonEntity, used_move: &Move, damage_out: &mut damage_data, faint_reason: faint_reason ) -> i32

Last function called by DungeonEffectsEmitter::deal_damage to determine the final damage dealt by the move. Read more
source§

fn can_target_entity(&self, target: &DungeonEntity) -> bool

Checks if a monster can target another entity when controlled by the AI. Read more
source§

fn can_target_position(&self, target: &position) -> bool

Checks if a monster can target a position. This function just calls is_position_in_sight using the position of the user as the origin.
source§

fn is_aura_bow_active(&self) -> bool

Checks if a monster is holding an aura bow that isn’t disabled by Klutz.
source§

fn get_exclusive_item_offense_boost(&self, move_category: MoveCategory) -> i32

Gets the exclusive item boost for attack/special attack for a monster. Panics if the move category is not physical or special.
source§

fn get_exclusive_item_defense_boost(&self, move_category: MoveCategory) -> i32

Gets the exclusive item boost for defense/special defense for a monster. Panics if the move category is not physical or special.
source§

fn has_conditional_ground_immunity(&self) -> bool

Checks if a monster is currently immune to Ground-type moves for reasons other than typing and ability. Read more
source§

fn get_move_target_and_range( &self, the_move: &Move, is_ai: bool ) -> MoveTargetAndRange

Gets the move target-and-range field when used by a given entity. Read more
source§

fn get_apparent_weather(&self) -> Option<Weather>

Get the weather, as experienced by the monster.
source§

fn has_held_item(&self, item_id: ItemId) -> bool

Checks if the monster has a certain held item.
source§

fn get_move_power(&self, the_move: &Move) -> i32

Gets the power of a move, factoring in Ginseng/Space Globe boosts.
source§

fn get_personality_index(&self) -> i32

Note: unverified, ported from Irdkwia’s notes
source§

fn calc_status_duration(&self, turn_range: &[u16; 2], effects: bool) -> i32

Seems to calculate the duration of a volatile status on a monster. Read more
source§

fn get_number_of_attacks(&self) -> i32

Returns the number of attacks that a monster can do in one turn (1 or 2). Read more
source§

fn is_levitating(&self) -> bool

Checks if a monster is levitating (has the effect of Levitate and Gravity is not active)
source§

fn is_type_affected_by_gravity(&self, type_id: type_id) -> bool

Checks if Gravity is active and that the given type is affected (i.e., Flying type).
source§

fn has_type_affected_by_gravity(&self, type_id: type_id) -> bool

Checks if Gravity is active and that this monster is of an affected type (i.e., Flying type).
source§

fn is_conversion2_active(&self) -> Option<Conversion2Status>

Checks if the monster is under the effect of Conversion 2 (its type was changed). Returns None if the value is invalid.
source§

fn get_move_type_if_used_by_self(&self, the_move: &Move) -> MonsterTypeId

Check the type of a move when used by a certain monster. Accounts for special cases such as Hidden Power, Weather Ball, the regular attack…
source§

fn get_sleep_animation_id(&self) -> u8

Returns the animation id to be applied to a monster that has the sleep, napping, nightmare or bide status.
source§

fn is_blinded(&self, check_held_item: bool) -> bool

Returns true if the monster has the blinded status, or if it is not the leader and is holding Y-Ray Specs.
source§

fn should_monster_run_away(&self) -> bool

Checks if a monster should run away from other monsters.
source§

unsafe fn should_monster_run_away_variation(&self, param: undefined) -> bool

Calls Self::should_monster_run_away and returns its result. It also calls another function if the result was true. Read more
source§

unsafe fn should_monster_run_away_variation_outlaw_check( &self, param: undefined ) -> bool

Calls Self::should_monster_run_away_variation. If the result is true, returns true. Otherwise, returns true only if the monster’s behavior field is equal to ffi::monster_behavior::BEHAVIOR_FLEEING_OUTLAW. Read more
source§

fn should_head_to_stairs(&self) -> bool

Checks if this monster should try to reach the stairs when controlled by the AI.
source§

fn has_status_that_prevents_acting(&self) -> bool

Returns true if the monster has any status problem that prevents it from acting.
source§

fn is_cornered(&self) -> bool

True if ths monster is cornered (it can’t move in any direction)
source§

fn can_attack_in_direction(&self, direction: Direction) -> bool

Returns whether a monster can attack in a given direction. Read more
source§

fn ai_obstruction_in_direction(&self, direction: Direction) -> Option<bool>

Returns whether the AI could not move the monster in the specified direction. Read more
source§

fn can_see_invisible_monsters(&self) -> bool

Returns whether this monster can see other invisible monsters. Read more
source§

fn has_dropeye_status(&self) -> bool

Returns whether a certain monster is under the effect of ffi::status_id::STATUS_DROPEYE.
source§

fn is_target_eligible( &self, move_ai_range: MoveTargetAndRange, target: &DungeonEntity, the_move: &Move, check_all_conditions: bool ) -> bool

Checks if a given target is eligible to be targeted by the AI with a certain move. Read more
source§

fn can_use_move(&self, the_move: &Move, extra_checks: bool) -> bool

Checks if a monster can use the given move. Will always return true for the regular attack. Will return false if the move if the flag Move::f_disabled is true, if the flag Move::f_sealed is true. Read more
source§

unsafe fn can_ai_use_move_unchecked( &self, move_index: i32, extra_checks: bool ) -> bool

Checks if an AI-controlled monster can use a move. Will return false if the any of the flags Move::f_exists, Move::f_subsequent_in_link_chain or Move::f_disabled is true. The function does not check if the flag Move::f_enabled_for_ai is set. Read more
source§

fn can_ai_use_move(&self, move_index: u8, extra_checks: bool) -> bool

Checked version of Self::can_ai_use_move_unchecked, that panics if the move index is > 3.
source§

fn status_checker_check(&self, the_move: &Move) -> bool

Determines if using a given move against its intended targets would be redundant because all of them already have the effect caused by said move. Read more
source§

fn get_monster_apparent_id(&self, current_id: MonsterSpeciesId) -> i32

Note: unverified, ported from Irdkwia’s notes
source§

unsafe fn get_monster_name(&self, output: *mut c_char)

Note: unverified, ported from Irdkwia’s notes Read more
source§

fn is_target_recruited(&self, target: &DungeonEntity) -> bool

Note: unverified, ported from Irdkwia’s notes
source§

fn is_satisfying_scenario_condition_to_spawn(&self) -> bool

Note: unverified, ported from Irdkwia’s notes
source§

fn is_in_spawn_list(&self, spawn_list: &mut undefined) -> bool

Note: unverified, ported from Irdkwia’s notes Read more
source§

impl<'a> DungeonMonsterWrite for DungeonMonsterMut<'a>

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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
source§

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

Used by the AI to determine the direction in which a monster should move. Read more
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. Read more
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. Read more
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. Read more
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? Read more
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. Read more
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). Read more
source§

fn set_monster_type_and_ability(&mut self)

Checks Forecast ability Read more
source§

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

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

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for DungeonMonsterMut<'a>

§

impl<'a> !Send for DungeonMonsterMut<'a>

§

impl<'a> !Sync for DungeonMonsterMut<'a>

§

impl<'a> Unpin for DungeonMonsterMut<'a>

§

impl<'a> !UnwindSafe for DungeonMonsterMut<'a>

Blanket Implementations§

§

impl<T> Any for Twhere T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

source§

impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.