Struct eos_rs::api::dungeon_mode::GlobalDungeonData
source · pub struct GlobalDungeonData<'a>(_, _, _, _);
Expand description
Helper struct for dealing with the current floor, the global dungeon and the mission state.
This is essentially an extension and wrapper of Dungeon
that works on the
global dungeon struct only.
To generate dungeons and manipulate floors layouts, you can get the game’s
builtin generator with Self::get_builtin_dungeon_generator
, or configure the global
state of the current floor correctly and use Self::generate_floor
.
Implementations§
source§impl<'a> GlobalDungeonData<'a>
impl<'a> GlobalDungeonData<'a>
sourcepub fn is_global_dungeon_ptr_null(_ov29: &OverlayLoadLease<29>) -> bool
pub fn is_global_dungeon_ptr_null(_ov29: &OverlayLoadLease<29>) -> bool
Checks if the global dungeon pointer is null.
sourcepub unsafe fn get(ov29: &'a OverlayLoadLease<29>) -> Self
pub unsafe fn get(ov29: &'a OverlayLoadLease<29>) -> Self
Returns a mutable reference to the global dungeon struct wrapped in this struct.
Safety
This is unsafe, since it borrows the global dungeon struct (essentially a static mut
)
mutably.
You need to make sure no other borrows over the global dungeon struct (or any of it’s values) exist.
sourcepub unsafe fn alloc(ov29: &'a OverlayLoadLease<29>) -> Self
pub unsafe fn alloc(ov29: &'a OverlayLoadLease<29>) -> Self
This will allocate a new dungeon struct and update the global dungeon pointer to it.
Safety
This is unsafe, since it borrows the global dungeon struct (essentially a static mut
)
mutably. It also invalidates any previously borrowed global dungeon struct.
You need to make sure no other borrows over the global dungeon struct (or any of it’s values) exist.
sourcepub fn effects(&'a mut self) -> &'a mut DungeonEffectsEmitter<'a>
pub fn effects(&'a mut self) -> &'a mut DungeonEffectsEmitter<'a>
Get the effects handler.
sourcepub fn sprites(&'a mut self) -> &'a mut DungeonSpriteHandler<'a>
pub fn sprites(&'a mut self) -> &'a mut DungeonSpriteHandler<'a>
Get the sprites handler.
sourcepub unsafe fn z_init(&mut self)
pub unsafe fn z_init(&mut self)
Zeros out the struct pointed to by the global dungeon pointer.
Safety
This is unsafe, since it updates the global dungeon struct (essentially a static mut
).
sourcepub unsafe fn free(self)
pub unsafe fn free(self)
Frees the dungeons struct pointer to by the master dungeon pointer, and nullifies the pointer.
Safety
This is unsafe, since it completely invalidates borrows of the old global dungeon struct and then invalidates the global dungeon pointer.
sourcepub fn inner(&self) -> &Dungeon<&'a mut dungeon>
pub fn inner(&self) -> &Dungeon<&'a mut dungeon>
Returns a reference to the inner dungeon struct.
sourcepub fn inner_mut(&mut self) -> &mut Dungeon<&'a mut dungeon>
pub fn inner_mut(&mut self) -> &mut Dungeon<&'a mut dungeon>
Returns a mutable reference to the inner dungeon struct.
sourcepub fn run_dungeon(
&mut self,
dungeon_init_data: &mut dungeon_init,
dungeon: &mut dungeon
) -> i32
pub fn run_dungeon( &mut self, dungeon_init_data: &mut dungeon_init, dungeon: &mut dungeon ) -> i32
Called at the start of a dungeon. Initializes the dungeon struct from specified dungeon data. Includes a loop that does not break until the dungeon is cleared, and another one inside it that runs until the current floor ends.
sourcepub fn get_builtin_dungeon_generator(
&'a mut self
) -> GlobalDungeonStructureGenerator<'a>
pub fn get_builtin_dungeon_generator( &'a mut self ) -> GlobalDungeonStructureGenerator<'a>
Returns an abstraction over the game’s builtin dungeon generator. This
struct implements dungeon_generator::DungeonFloorGeneration
, which is the
recommended way to work with it, see the documentation of dungeon_generator
.
Note
Note that the builtin dungeon generator works on the global dungeon struct directly.
sourcepub fn generate_floor(&'a mut self)
pub fn generate_floor(&'a mut self)
Generates a dungeon floor.
If not changed by a patch, this function will use the game’s default built in generator and generate the floor based on the current global configuration for the floor.
For more granular control over the floor generation, you can get an abstraction over
the builtin generator with Self::get_builtin_dungeon_generator
.
sourcepub fn get_floor_type(&self) -> Option<FloorType>
pub fn get_floor_type(&self) -> Option<FloorType>
Gets the floor type. Returns None if the global dungeon struct contains invalid data.
sourcepub fn is_substitute_room(&self) -> bool
pub fn is_substitute_room(&self) -> bool
Checks if the current fixed floor is the “substitute room” (Fixed Room ID 0x6E).
sourcepub fn is_current_fixed_room_boss_fight(&self) -> bool
pub fn is_current_fixed_room_boss_fight(&self) -> bool
Note: unverified, ported from Irdkwia’s notes
sourcepub fn is_full_floor_fixed_room(&self) -> bool
pub fn is_full_floor_fixed_room(&self) -> bool
Checks if the current fixed room on the dungeon generation info corresponds to a fixed, full-floor layout.
The first non-full-floor fixed room is 0xA5, which is for Sealed Chambers.
sourcepub fn is_even_floor(&self) -> bool
pub fn is_even_floor(&self) -> bool
Checks if the current dungeon floor number is even. This is probably, among other things(?), used to determine whether male or female monsters should be spawned. Has a special check to return false for Labyrinth Cave B10F (the Gabite boss fight).
sourcepub fn get_tile(&self, x: i32, y: i32) -> &DungeonTile
pub fn get_tile(&self, x: i32, y: i32) -> &DungeonTile
Returns the tile at the given coordinates.
If the coordinates are out-of-bounds, this seems to return a copy of a default tile.
sourcepub fn get_tile_mut(&mut self, x: i32, y: i32) -> &mut DungeonTile
pub fn get_tile_mut(&mut self, x: i32, y: i32) -> &mut DungeonTile
Returns the tile at the given coordinates.
If the coordinates are out-of-bounds, this seems to return a copy of a default tile.
sourcepub fn is_gravity_active(&self) -> bool
pub fn is_gravity_active(&self) -> bool
Checks if gravity is active on the floor.
sourcepub fn is_secret_floor(&self) -> bool
pub fn is_secret_floor(&self) -> bool
Checks if the current floor is a secret bazaar or a secret room.
sourcepub fn is_secret_bazaar(&self) -> bool
pub fn is_secret_bazaar(&self) -> bool
Checks if the current floor is the Secret Bazaar.
sourcepub fn is_secret_room(&self) -> bool
pub fn is_secret_room(&self) -> bool
Checks if the current floor is the Secret Room fixed floor (from hidden stairs).
sourcepub fn is_normal_floor(&self) -> bool
pub fn is_normal_floor(&self) -> bool
Checks if the current floor is a normal layout.
“Normal” means any layout that is NOT one of the following:
- Hidden stairs floors
- Golden Chamber
- Challenge Request floor
- Outlaw hideout
- Treasure Memo floor
- Full-room fixed floors (ID < 0xA5) [0xA5 == Sealed Chamber]
Gets the boost_hidden_stairs_spawn_chance field on the dungeon struct.
Sets the boost_hidden_stairs_spawn_chance field on the dungeon struct to the given value.
Clears the tile (terrain and spawns) on which Hidden Stairs are spawned, if applicable.
sourcepub fn is_pos_out_of_bounds(&self, x: i32, y: i32) -> bool
pub fn is_pos_out_of_bounds(&self, x: i32, y: i32) -> bool
Checks if a position (x, y) is out of bounds on the map: !((0 <= x <= 55) && (0 <= y <= 31)).
Checks if the current floor is either the Secret Bazaar or a Secret Room.
sourcepub fn is_outlaw_or_challenge_request_floor(&self) -> bool
pub fn is_outlaw_or_challenge_request_floor(&self) -> bool
Checks if the current floor is an active mission destination of type
MissionType::TakeItemFromOutlaw
, MissionType::ArrestOutlaw
or
MissionType::ChallengeRequest
.
sourcepub fn is_destination_floor(&self) -> bool
pub fn is_destination_floor(&self) -> bool
Checks if the current floor is a mission destination floor.
sourcepub fn is_current_mission_type(
&self,
mission_type_group: MissionTypeGroup
) -> bool
pub fn is_current_mission_type( &self, mission_type_group: MissionTypeGroup ) -> bool
Checks if the current floor is an active mission destination of a given type group.
sourcepub fn is_current_mission_type_exact(&self, mission_type: MissionType) -> bool
pub fn is_current_mission_type_exact(&self, mission_type: MissionType) -> bool
Checks if the current floor is an active mission destination of a given type.
sourcepub fn is_outlaw_monster_house_floor(&self) -> bool
pub fn is_outlaw_monster_house_floor(&self) -> bool
Checks if the current floor is a mission destination for a Monster House outlaw mission.
sourcepub fn is_golden_chamber(&self) -> bool
pub fn is_golden_chamber(&self) -> bool
Checks if the current floor is a Golden Chamber floor.
sourcepub fn is_legendary_challenge_floor(&self) -> bool
pub fn is_legendary_challenge_floor(&self) -> bool
Checks if the current floor is a boss floor for a Legendary Challenge Letter mission.
sourcepub fn is_jirachi_challenge_floor(&self) -> bool
pub fn is_jirachi_challenge_floor(&self) -> bool
Checks if the current floor is the boss floor in Star Cave Pit for Jirachi’s Challenge Letter mission.
sourcepub fn is_destination_floor_with_monster(&self) -> bool
pub fn is_destination_floor_with_monster(&self) -> bool
Checks if the current floor is a mission destination floor with a special monster.
See Self::floor_has_mission_monster
for details.
sourcepub fn get_stairs_room(&self) -> u8
pub fn get_stairs_room(&self) -> u8
Returns the index of the room that contains the stairs.
sourcepub fn floor_has_mission_monster(&self) -> bool
pub fn floor_has_mission_monster(&self) -> bool
Checks if a given floor is a mission destination with a special monster, either a target to rescue or an enemy to defeat.
Mission types with a monster on the destination floor:
- Rescue client
- Rescue target
- Escort to target
- Deliver item
- Search for target
- Take item from outlaw
- Arrest outlaw
- Challenge Request
sourcepub fn floor_has_mission_monster_static(
mission_destination: &mission_destination_info,
_ov29: &OverlayLoadLease<29>
) -> bool
pub fn floor_has_mission_monster_static( mission_destination: &mission_destination_info, _ov29: &OverlayLoadLease<29> ) -> bool
Static version of Self::floor_has_mission_monster
. See it for details.
sourcepub fn is_mission_target_enemy_defeated(&self) -> bool
pub fn is_mission_target_enemy_defeated(&self) -> bool
Checks if the target enemy of the mission on the current floor has been defeated.
sourcepub fn set_mission_target_enemy_defeated(&mut self, flag: bool)
pub fn set_mission_target_enemy_defeated(&mut self, flag: bool)
Set the flag for whether or not the target enemy of the current mission has been defeated.
sourcepub fn is_destination_floor_with_fixed_room(&self) -> bool
pub fn is_destination_floor_with_fixed_room(&self) -> bool
Checks if the current floor is a mission destination floor with a fixed room.
The entire floor can be a fixed room layout, or it can just contain a Sealed Chamber.
sourcepub fn get_item_to_retrieve(&self) -> ItemId
pub fn get_item_to_retrieve(&self) -> ItemId
Get the ID of the item that needs to be retrieve on the current floor for a mission, if one exists.
sourcepub fn get_item_to_deliver(&self) -> ItemId
pub fn get_item_to_deliver(&self) -> ItemId
Get the ID of the item that needs to be delivered to a mission client on the current floor, if one exists.
sourcepub fn get_special_target_item(&self) -> ItemId
pub fn get_special_target_item(&self) -> ItemId
Get the ID of the special target item for a Sealed Chamber or Treasure Memo mission on the current floor.
sourcepub fn is_destination_floor_with_item(&self) -> bool
pub fn is_destination_floor_with_item(&self) -> bool
Checks if the current floor is a mission destination floor with a special item.
This excludes missions involving taking an item from an outlaw.
Checks if the current floor is a mission destination floor with a “hidden outlaw” that behaves like a normal enemy.
sourcepub fn is_destination_floor_with_fleeing_outlaw(&self) -> bool
pub fn is_destination_floor_with_fleeing_outlaw(&self) -> bool
Checks if the current floor is a mission destination floor with a “fleeing outlaw” that runs away.
sourcepub fn get_mission_target_enemy(&self) -> MonsterSpeciesId
pub fn get_mission_target_enemy(&self) -> MonsterSpeciesId
Get the monster ID of the target enemy to be defeated on the current floor for a mission, if one exists.
sourcepub fn get_mission_enemy_minion_group(
&self,
minion_group_index: i32
) -> MonsterSpeciesId
pub fn get_mission_enemy_minion_group( &self, minion_group_index: i32 ) -> MonsterSpeciesId
Get the monster ID of the specified minion group on the current floor for a mission, if it exists.
Note that a single minion group can correspond to multiple actual minions of the same species. There can be up to 2 minion groups.
sourcepub fn get_target_monster_not_found_flag(&self) -> bool
pub fn get_target_monster_not_found_flag(&self) -> bool
Gets the value of ffi::dungeon::target_monster_not_found_flag
.
sourcepub fn set_target_monster_not_found_flag(&mut self, value: bool)
pub fn set_target_monster_not_found_flag(&mut self, value: bool)
Sets ffi::dungeon::target_monster_not_found_flag
to the specified value.
sourcepub fn get_leader(&mut self) -> Option<&DungeonEntity>
pub fn get_leader(&mut self) -> Option<&DungeonEntity>
Gets a reference to the entity that is currently leading the team, or None if none of the first 4 entities is a valid monster with its is_team_leader flag set.
sourcepub fn get_leader_mut(&mut self) -> Option<&mut DungeonEntity>
pub fn get_leader_mut(&mut self) -> Option<&mut DungeonEntity>
Gets a mutable reference to the entity that is currently leading the team, or None if none of the first 4 entities is a valid monster with its is_team_leader flag set.
sourcepub fn story_restrictions_enabled(&self) -> bool
pub fn story_restrictions_enabled(&self) -> bool
Returns true if certain special restrictions are enabled.
If true, you will get kicked out of the dungeon if a team member that passes the
DungeonId::is_special_joined_at_location2
check faints.
Returns !ffi::dungeon::nonstory_flag || ffi::dungeon::hidden_land_flag
sourcepub fn is_on_monster_spawn_list(&self, monster_id: MonsterSpeciesId) -> bool
pub fn is_on_monster_spawn_list(&self, monster_id: MonsterSpeciesId) -> bool
Returns true if the specified monster is included in the floor’s monster spawn list (the modified list after a maximum of 14 different species were chosen).
sourcepub unsafe fn load_fixed_room_data(&mut self)
pub unsafe fn load_fixed_room_data(&mut self)
Loads fixed room data from BALANCE/fixed.bin into the buffer pointed to by
FIXED_ROOM_DATA_PTR
(see symbol table).
Safety
This modifies a global buffer. FIXED_ROOM_DATA_PTR
needs to be valid, no references
to it’s content must exist.
sourcepub unsafe fn load_fixed_room(
&mut self,
param_1: i32,
param_2: i32,
param_3: i32,
param_4: undefined4
) -> i32
pub unsafe fn load_fixed_room( &mut self, param_1: i32, param_2: i32, param_3: i32, param_4: undefined4 ) -> i32
Loads fixed room data from BALANCE/fixed.bin into the buffer pointed to by
FIXED_ROOM_DATA_PTR
(see symbol table).
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub fn set_forced_loss_reason(&mut self, reason: ForcedLossReason)
pub fn set_forced_loss_reason(&mut self, reason: ForcedLossReason)
Sets the forced loss reason to a given value.
sourcepub fn get_forced_loss_reason(&self) -> Option<ForcedLossReason>
pub fn get_forced_loss_reason(&self) -> Option<ForcedLossReason>
Gets the forced loss reason, returns None if it’s invalid.
sourcepub fn change_leader(&mut self)
pub fn change_leader(&mut self)
Tries to change the current leader to the monster specified by ffi::dungeon::new_leader
.
Accounts for situations that can prevent changing leaders, such as having stolen from a
Kecleon shop. If one of those situations prevents changing leaders, prints the
corresponding message to the message log.
sourcepub fn handle_faint(
&mut self,
fainted_entity: &mut DungeonEntity,
faint_reason: faint_reason,
killer: &mut DungeonEntity
)
pub fn handle_faint( &mut self, fainted_entity: &mut DungeonEntity, faint_reason: faint_reason, killer: &mut DungeonEntity )
Handles a fainted monster (reviving does not count as fainting).
Arguments
fainted_entity
: Fainted entityfaint_reason
: Faint reason (move ID or greater than the max move id for other causes)killer
: Entity responsible of the fainting
sourcepub fn get_minimap_data(&self) -> Option<&minimap_display_data>
pub fn get_minimap_data(&self) -> Option<&minimap_display_data>
Returns a reference to the minimap_display_data struct in the dungeon struct, if it exists.
sourcepub fn get_minimap_data_mut(&mut self) -> Option<&mut minimap_display_data>
pub fn get_minimap_data_mut(&mut self) -> Option<&mut minimap_display_data>
Returns a mutable reference to the minimap_display_data struct in the dungeon struct, if it exists.
sourcepub fn set_minimap_data_e447(&mut self, value: u8)
pub fn set_minimap_data_e447(&mut self, value: u8)
Sets ffi::minimap_display_data::field_0xE447
to the specified value
sourcepub fn get_minimap_data_e447(&mut self) -> u8
pub fn get_minimap_data_e447(&mut self) -> u8
Gets the value of ffi::minimap_display_data::field_0xE447
.
sourcepub fn set_minimap_data_e448(&mut self, value: u8)
pub fn set_minimap_data_e448(&mut self, value: u8)
Sets ffi::minimap_display_data::field_0xE448
to the specified value
sourcepub unsafe fn open_message_log(
&mut self,
param_1: undefined4,
param_2: undefined4
)
pub unsafe fn open_message_log( &mut self, param_1: undefined4, param_2: undefined4 )
Opens the message log window.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub fn display_dungeon_tip(&mut self, tip: &mut message_tip, log: bool)
pub fn display_dungeon_tip(&mut self, tip: &mut message_tip, log: bool)
Checks if a given dungeon tip was not displayed yet and if so, displays it.
If log
is true, the tip will also be written to the message log.
sourcepub unsafe fn display_message(
&mut self,
param_1: undefined4,
message_id: i32,
wait_for_input: bool
)
pub unsafe fn display_message( &mut self, param_1: undefined4, message_id: i32, wait_for_input: bool )
Displays a message in a dialogue box that optionally waits for player input before closing.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub unsafe fn display_message2(
&mut self,
param_1: undefined4,
message_id: i32,
wait_for_input: bool
)
pub unsafe fn display_message2( &mut self, param_1: undefined4, message_id: i32, wait_for_input: bool )
Displays a message in a dialogue box that optionally waits for player input before closing.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub fn try_forced_loss(&mut self, skip_floor_end_check: bool) -> bool
pub fn try_forced_loss(&mut self, skip_floor_end_check: bool) -> bool
Attempts to trigger a forced loss of the type set with Self::set_forced_loss_reason
.
Returns whether the forced loss happens or not.
The flag controls, if the function will not check for the end of the floor condition and will skip other (unknown) actions in case of forced loss.
sourcepub fn update_map_surveyor_flag(&mut self) -> bool
pub fn update_map_surveyor_flag(&mut self) -> bool
Sets the Map Surveyor flag in the dungeon struct to true if a team member has Map Surveyor, sets it to false otherwise.
This function has two variants: in the EU ROM, it will return true if the flag was changed. The NA version will return the new value of the flag instead.
sourcepub fn get_monster_id_to_spawn(
&mut self,
is_for_monster_house: bool
) -> MonsterSpeciesId
pub fn get_monster_id_to_spawn( &mut self, is_for_monster_house: bool ) -> MonsterSpeciesId
Get the id of the monster to be randomly spawned.
sourcepub fn get_monster_level_to_spawn(&mut self, monster_id: MonsterSpeciesId) -> u8
pub fn get_monster_level_to_spawn(&mut self, monster_id: MonsterSpeciesId) -> u8
Get the level of the monster to be spawned, given its id.
Returns the level of the monster to be spawned, or 1 if the specified ID can’t be found on the floor’s spawn table.
sourcepub fn tick_status_turn_counter(&mut self, counter: &mut u8) -> u8
pub fn tick_status_turn_counter(&mut self, counter: &mut u8) -> u8
Ticks down a turn counter for a status condition. If the counter equals 0x7F, it will not be decreased.
Returns the new counter value.
sourcepub fn run_fractional_turn(&mut self, is_first_loop: bool)
pub fn run_fractional_turn(&mut self, is_first_loop: bool)
The main function which executes the actions that take place in a fractional turn.
Called in a loop by Self::run_dungeon
while Self::is_floor_over
returns
false.
The flag should set to true when the function is first called during a floor.
sourcepub unsafe fn run_leader_turn(&mut self, param_1: undefined) -> bool
pub unsafe fn run_leader_turn(&mut self, param_1: undefined) -> bool
Handles the leader’s turn. Includes a movement speed check that might cause it to return early if the leader isn’t fast enough to act in this fractional turn. If that check (and some others) pass, the function does not return until the leader performs an action.
Returns true, if the leader has performed an action.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub fn set_leader_action(&mut self)
pub fn set_leader_action(&mut self)
Sets the leader’s action field depending on the inputs given by the player.
This function also accounts for other special situations that can force a certain action, such as when the leader is running. The function also takes care of opening the main menu when X is pressed.
The function generally doesn’t return until the player has an action set.
sourcepub fn try_spawn_monster_and_activate_plus_minus(&mut self)
pub fn try_spawn_monster_and_activate_plus_minus(&mut self)
Called at the beginning of Self::run_fractional_turn
. Executed only if
FRACTIONAL_TURN_SEQUENCE[fractional_turn * 2] is not 0.
First it calls Self::try_spawn_monster_and_tick_spawn_counter
, then tries to activate
the Plus and Minus abilities for both allies and enemies, and finally calls
Self::try_forced_loss
.
sourcepub fn is_floor_over(&self) -> bool
pub fn is_floor_over(&self) -> bool
Checks if the current floor should end, and updates ffi::dungeon::floor_loop_status
if required.
If the player has been defeated, sets ffi::dungeon::floor_loop_status
to
ffi::floor_loop_status::FLOOR_LOOP_LEADER_FAINTED
.
If ffi::dungeon::end_floor_flag
is 1 or 2, sets ffi::dungeon::floor_loop_status
to
ffi::floor_loop_status::FLOOR_LOOP_NEXT_FLOOR
.
sourcepub fn decrement_wind_counter(&self)
pub fn decrement_wind_counter(&self)
Decrements ffi::dungeon::wind_turns
and displays a wind warning message if required.
sourcepub fn get_kecleon_id_to_spawn_by_floor(&self) -> MonsterSpeciesId
pub fn get_kecleon_id_to_spawn_by_floor(&self) -> MonsterSpeciesId
If the current floor number is even, returns female Kecleon’s id (default: 0x3D7), otherwise returns male Kecleon’s id (default: 0x17F).
sourcepub fn mew_spawn_check(
&self,
monster_id: MonsterSpeciesId,
force_fail_if_mew: bool
) -> bool
pub fn mew_spawn_check( &self, monster_id: MonsterSpeciesId, force_fail_if_mew: bool ) -> bool
If the monster id parameter is 0x97 (Mew), returns false if either
ffi::dungeon::mew_cannot_spawn
or the second parameter are true.
Called before spawning an enemy, appears to be checking if Mew can spawn on the current floor.
sourcepub fn get_random_spawn_monster_id(&self) -> MonsterSpeciesId
pub fn get_random_spawn_monster_id(&self) -> MonsterSpeciesId
Note: unverified, ported from Irdkwia’s notes
sourcepub fn get_team_member_with_iq_skill(
&self,
iq_skill: IqSkillId
) -> Option<&DungeonEntity>
pub fn get_team_member_with_iq_skill( &self, iq_skill: IqSkillId ) -> Option<&DungeonEntity>
Returns an entity reference to the first team member which has the specified iq skill.
sourcepub fn get_team_member_with_iq_skill_mut(
&mut self,
iq_skill: IqSkillId
) -> Option<&mut DungeonEntity>
pub fn get_team_member_with_iq_skill_mut( &mut self, iq_skill: IqSkillId ) -> Option<&mut DungeonEntity>
Returns an entity reference to the first team member which has the specified iq skill.
sourcepub fn team_member_has_enabled_iq_skill(&self, iq_skill: IqSkillId) -> bool
pub fn team_member_has_enabled_iq_skill(&self, iq_skill: IqSkillId) -> bool
Returns true if any team member has the specified iq skill.
sourcepub fn team_leader_has_enabled_iq_skill(&self, iq_skill: IqSkillId) -> bool
pub fn team_leader_has_enabled_iq_skill(&self, iq_skill: IqSkillId) -> bool
Returns true the leader has the specified iq skill.
sourcepub unsafe fn init_team(&mut self, param_1: undefined)
pub unsafe fn init_team(&mut self, param_1: undefined)
Initializes the team when entering a dungeon.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub unsafe fn init_team_member(
&mut self,
arg1: MonsterSpeciesId,
x_pos: i16,
y_pos: i16,
team_member_data: &mut team_member,
param_5: undefined,
param_6: undefined,
param_7: undefined,
param_8: undefined,
param_9: undefined
)
pub unsafe fn init_team_member( &mut self, arg1: MonsterSpeciesId, x_pos: i16, y_pos: i16, team_member_data: &mut team_member, param_5: undefined, param_6: undefined, param_7: undefined, param_8: undefined, param_9: undefined )
Initializes a team member. Run at the start of each floor in a dungeon.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub fn generate_mission_egg_monster(&mut self, mission: &mut mission)
pub fn generate_mission_egg_monster(&mut self, mission: &mut mission)
Generates the monster ID in the egg from the given mission. Uses the base form of the monster.
Note: unverified, ported from Irdkwia’s notes
sourcepub fn spawn_monster(
&mut self,
spawn_data: &mut spawned_monster_data,
force_awake: bool
) -> Option<&mut DungeonEntity>
pub fn spawn_monster( &mut self, spawn_data: &mut spawned_monster_data, force_awake: bool ) -> Option<&mut DungeonEntity>
Spawns the given monster on a tile. Returns None, if the game returned a null-pointer after the spawn.
sourcepub fn spawn_enemy_trap_bound(
&mut self,
trap_id: TrapId,
x_position: i16,
y_position: i16,
flags: u8,
is_visible: bool
)
pub fn spawn_enemy_trap_bound( &mut self, trap_id: TrapId, x_position: i16, y_position: i16, flags: u8, is_visible: bool )
A convenience wrapper around Self::spawn_trap
and DungeonTile::bind_trap
(or to be precise the game’s functions, see implementation!).
Always passes 0 for the team parameter (making it an enemy trap).
sourcepub fn spawn_trap(
&mut self,
trap_id: TrapId,
position: &position,
team: u8,
flags: u8
) -> Option<&mut DungeonEntity>
pub fn spawn_trap( &mut self, trap_id: TrapId, position: &position, team: u8, flags: u8 ) -> Option<&mut DungeonEntity>
Spawns a trap on the floor. Fails if there are more than 64 traps already on the floor.
This modifies the appropriate fields on the dungeon struct, initializing new entries in the entity table and the trap info list.
sourcepub fn spawn_item(
&'a mut self,
position: &position,
item: &'a mut Item,
flag: bool
) -> bool
pub fn spawn_item( &'a mut self, position: &position, item: &'a mut Item, flag: bool ) -> bool
Spawns an item on the floor. Fails if there are more than 64 items already on the floor.
This calls Self::spawn_item_entity
, fills in the item info struct, sets the entity to
be visible, binds the entity to the tile it occupies, updates the n_items counter on the
dungeon struct, and various other bits of bookkeeping.
Hint: Consider using Self::generate_and_spawn_item
instead for ease of use.
sourcepub fn generate_and_spawn_item(
&mut self,
item_id: ItemId,
x: i16,
y: i16,
quantity: u16,
sticky: bool,
check_in_bag: bool
)
pub fn generate_and_spawn_item( &mut self, item_id: ItemId, x: i16, y: i16, quantity: u16, sticky: bool, check_in_bag: bool )
Generates an item with Item::generate_explicit
, then spawns it with
Self::spawn_item
.
If the check-in-bag flag is set and the player’s bag already contains an item with the given ID, a Reviver Seed will be spawned instead.
It seems like this function is only ever called in one place, with an item ID of 0x49 (Reviver Seed).
sourcepub fn spawn_item_entity(
&mut self,
position: &position
) -> Option<&mut DungeonEntity>
pub fn spawn_item_entity( &mut self, position: &position ) -> Option<&mut DungeonEntity>
Spawns a blank item entity on the floor. Fails if there are more than 64 items already on the floor.
This initializes a new entry in the entity table and points it to the corresponding slot in the item info list.
sourcepub unsafe fn spawn_enemy_item_drop(
&mut self,
entity: &mut DungeonEntity,
item_entity: &mut DungeonEntity,
item: &mut Item,
param_4: i32,
dir_xy: &mut i16,
param_6: undefined
)
pub unsafe fn spawn_enemy_item_drop( &mut self, entity: &mut DungeonEntity, item_entity: &mut DungeonEntity, item: &mut Item, param_4: i32, dir_xy: &mut i16, param_6: undefined )
Appears to spawn an enemy item drop at a specified location, with a log message.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub unsafe fn spawn_enemy_item_drop_wrapper(
&mut self,
entity: &mut DungeonEntity,
pos: &mut position,
item: &mut Item,
param_4: undefined4
)
pub unsafe fn spawn_enemy_item_drop_wrapper( &mut self, entity: &mut DungeonEntity, pos: &mut position, item: &mut Item, param_4: undefined4 )
Wraps Self::spawn_enemy_item_drop
in a more convenient interface.
Safety
The caller must make sure the undefined params are valid for this function.
sourcepub fn try_generate_unown_drop(monster_id: MonsterSpeciesId) -> Option<Item>
pub fn try_generate_unown_drop(monster_id: MonsterSpeciesId) -> Option<Item>
Determine if a defeated monster should drop a Unown Stone, and generate the item if so.
Checks that the current dungeon isn’t a Marowak Dojo training maze, and that the monster is an Unown. If so, there’s a 21% chance that an Unown Stone will be generated.
sourcepub fn try_activate_slow_start(&mut self)
pub fn try_activate_slow_start(&mut self)
Runs a check over all monsters on the field for the ability Slow Start, and lowers the speed of those who have it.
sourcepub fn try_activate_artificial_weather_abilities(&mut self)
pub fn try_activate_artificial_weather_abilities(&mut self)
Runs a check over all monsters on the field for abilities that affect the weather and changes the floor’s weather accordingly.
sourcepub fn try_spawn_monster_and_tick_spawn_counter(&mut self)
pub fn try_spawn_monster_and_tick_spawn_counter(&mut self)
First ticks up the spawn counter, and if it’s equal or greater than the spawn cooldown, it will try to spawn an enemy if the number of enemies is below the spawn cap.
If the spawn counter is greater than 900, it will instead perform the special spawn caused by the ability Illuminate.
sourcepub fn get_dungeon_gen_info_unk_0c(&self) -> undefined4
pub fn get_dungeon_gen_info_unk_0c(&self) -> undefined4
Returns ffi::dungeon_generation_info::field_0xc
for the global dungeon struct.
sourcepub fn check_team_member_index(&self, team_member: &team_member) -> bool
pub fn check_team_member_index(&self, team_member: &team_member) -> bool
Checks if a value obtained from ffi::team_member::member_index
is equal to certain
values.
This is known to return true for some or all of the guest monsters (if the value is equal to 0x55AA or 0x5AA5).
Note
The underlying function ffi::CheckTeamMemberField8
does not need overlay29 to be loaded.
sourcepub fn check_team_items_flag(&self, flags: i32) -> bool
pub fn check_team_items_flag(&self, flags: i32) -> bool
Checks whether any of the items in the bag or any of the items carried by team members has any of the specified flags set in its flags field:
(0 = f_exists, 1 = f_in_shop, 2 = f_unpaid, etc.)
Returns true if any of the items of the team has the specified flags set, false otherwise.
sourcepub fn check_active_challenge_request(&self) -> bool
pub fn check_active_challenge_request(&self) -> bool
Checks if there’s an active challenge request on the current dungeon.
sourcepub fn is_marowak_training_maze(&self) -> bool
pub fn is_marowak_training_maze(&self) -> bool
Check if the current dungeon is one of the training mazes in Marowak Dojo (this excludes Final Maze).