pub trait DungeonMonsterRead: Sealed {
Show 59 methods // Provided methods fn is_special_story_ally(&self) -> bool { ... } fn is_experience_locked(&self) -> bool { ... } fn is_holding_item(&self, item_id: ItemId) -> bool { ... } fn has_low_health(&self) -> bool { ... } fn gastro_acid_status(&self) -> bool { ... } fn is_ability_active(&self, ability_id: AbilityId) -> bool { ... } fn is_ability_active_any_entity(&self, ability_id: AbilityId) -> bool { ... } fn has_type(&self, type_id: MonsterTypeId) -> bool { ... } fn is_iq_skill_enabled(&self, iq_skill_id: IqSkillId) -> bool { ... } fn is_defender_ability_active( &self, defender: &DungeonEntity, defender_ability_id: AbilityId, own_ability_is_active: bool ) -> bool { ... } fn is_exclusive_item_effect_active( &self, effect_id: ExclusiveItemEffectId ) -> bool { ... } fn get_type_matchup( &self, defender: &DungeonEntity, target_type_index: TargetTypeIndex, attack_type: MonsterTypeId ) -> Option<DungeonTypeMatchup> { ... } 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 ) { ... } 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 ) { ... } 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 ) { ... } 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 ) { ... } 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 ) { ... } fn calc_damage_projectile( &self, defender: &DungeonEntity, used_move: &Move, move_power: i32, damage_multiplier: I24F8, item_id: ItemId ) -> i32 { ... } fn calc_damage_final( &self, defender: &DungeonEntity, used_move: &Move, damage_out: &mut damage_data, faint_reason: faint_reason ) -> i32 { ... } fn can_target_entity(&self, target: &DungeonEntity) -> bool { ... } fn can_target_position(&self, target: &position) -> bool { ... } fn is_aura_bow_active(&self) -> bool { ... } fn get_exclusive_item_offense_boost( &self, move_category: MoveCategory ) -> i32 { ... } fn get_exclusive_item_defense_boost( &self, move_category: MoveCategory ) -> i32 { ... } fn has_conditional_ground_immunity(&self) -> bool { ... } fn get_move_target_and_range( &self, the_move: &Move, is_ai: bool ) -> MoveTargetAndRange { ... } fn get_apparent_weather(&self) -> Option<Weather> { ... } fn has_held_item(&self, item_id: ItemId) -> bool { ... } fn get_move_power(&self, the_move: &Move) -> i32 { ... } fn get_personality_index(&self) -> i32 { ... } fn calc_status_duration(&self, turn_range: &[u16; 2], effects: bool) -> i32 { ... } fn get_number_of_attacks(&self) -> i32 { ... } fn is_levitating(&self) -> bool { ... } fn is_type_affected_by_gravity(&self, type_id: type_id) -> bool { ... } fn has_type_affected_by_gravity(&self, type_id: type_id) -> bool { ... } fn is_conversion2_active(&self) -> Option<Conversion2Status> { ... } fn get_move_type_if_used_by_self(&self, the_move: &Move) -> MonsterTypeId { ... } fn get_sleep_animation_id(&self) -> u8 { ... } fn is_blinded(&self, check_held_item: bool) -> bool { ... } fn should_monster_run_away(&self) -> bool { ... } unsafe fn should_monster_run_away_variation(&self, param: undefined) -> bool { ... } unsafe fn should_monster_run_away_variation_outlaw_check( &self, param: undefined ) -> bool { ... } fn should_head_to_stairs(&self) -> bool { ... } fn has_status_that_prevents_acting(&self) -> bool { ... } fn is_cornered(&self) -> bool { ... } fn can_attack_in_direction(&self, direction: Direction) -> bool { ... } fn ai_obstruction_in_direction(&self, direction: Direction) -> Option<bool> { ... } fn can_see_invisible_monsters(&self) -> bool { ... } fn has_dropeye_status(&self) -> bool { ... } fn is_target_eligible( &self, move_ai_range: MoveTargetAndRange, target: &DungeonEntity, the_move: &Move, check_all_conditions: bool ) -> bool { ... } fn can_use_move(&self, the_move: &Move, extra_checks: bool) -> bool { ... } unsafe fn can_ai_use_move_unchecked( &self, move_index: i32, extra_checks: bool ) -> bool { ... } fn can_ai_use_move(&self, move_index: u8, extra_checks: bool) -> bool { ... } fn status_checker_check(&self, the_move: &Move) -> bool { ... } fn get_monster_apparent_id(&self, current_id: MonsterSpeciesId) -> i32 { ... } unsafe fn get_monster_name(&self, output: *mut c_char) { ... } fn is_target_recruited(&self, target: &DungeonEntity) -> bool { ... } fn is_satisfying_scenario_condition_to_spawn(&self) -> bool { ... } fn is_in_spawn_list(&self, spawn_list: &mut undefined) -> bool { ... }
}
Expand description

Trait for DungeonMonsterRef and DungeonMonsterMut (read operations).

Important safety note

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

Provided Methods§

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.

This factors in some conditional effects like exclusive items, statuses, etc.

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.

The signature of this method WILL change once we figure out what the parameters are.

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.

The signature of this method WILL change once we figure out what the parameters are.

Safety

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

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.

The signature of this method WILL change once we figure out what the parameters are.

Safety

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

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.

The signature of this method WILL change once we figure out what the parameters are.

Safety

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

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.

The signature of this method WILL change once we figure out what the parameters are.

Safety

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

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.

One of param_5 or param_6 is probably the output struct.

The signature of this method WILL change once we figure out what the parameters are.

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.

The result of this call is the return value of DealDamage.

Arguments
  • attacker - attacker pointer
  • defender - defender pointer
  • the_move - pointer to move data
  • damage_out - struct containing info about the damage calculation
  • faint_reason - faint reason
source

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

Checks if a monster can target another entity when controlled by the AI.

More specifically, it checks if the target is invisible, if the user can see invisible monsters, if the user is blinded and if the target position is in sight from the position of the user (this last check is done by calling is_position_in_sight with the user’s and the target’s position).

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.

This includes checks for Gravity and Magnet Rise.

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.

The fourth field in the returned tuple seems unused. The values in the returned tuple are None, if they are invalid (or we don’t know them yet).

See Move::get_target_and_range for more information.

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.

Returns the number of turns for the status condition.

Arguments
  • turn_range - lower & higher ends of the turn range
  • effects - flag for whether or not to factor in the Self Curer IQ skill and the Natural Cure ability
source

fn get_number_of_attacks(&self) -> i32

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

Checks for the abilities Swift Swim, Chlorophyll, Unburden, and for exclusive items.

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.

Safety

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

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.

Safety

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

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.

The check fails if the destination tile is impassable, contains a monster that isn’t of type DungeonEntityType::Monster or if the monster can’t directly move from the current tile into the destination tile.

source

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

Returns whether the AI could not move the monster in the specified direction.

Accounts for walls, other monsters on the target position and IQ skills that might prevent a monster from moving into a specific location, such as House Avoider, Trap Avoider or Lava Evader.

Returns a None if there are no obstructions. If there are, the Some contains a boolean, that is true if the way is blocked by another entity.

source

fn can_see_invisible_monsters(&self) -> bool

Returns whether this monster can see other invisible monsters.

To be precise, this function returns true if the monster is holding Goggle Specs or if it has the status ffi::status_id::STATUS_EYEDROPS.

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.

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.

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.

If extra_checks is true check whether the move is out of PP, whether it can be used under the taunted status and whether the encore status prevents using the move.

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.

This function also returns true if the call to Self::can_use_move is true. The function contains a loop that is supposed to check other moves after the specified one, but the loop breaks after it finds a move that isn’t linked, which is always true given the checks in place at the start of the function.

If extra_checks is true check whether the move is out of PP, whether it can be used under the taunted status and whether the encore status prevents using the move.

Safety

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

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.

Returns true if it makes sense to use the move, false if it would be redundant given the effects it causes and the effects that all the targets already have.

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

Safety

It’s unknown what size the string passed in must be.

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

Safety

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

Implementors§