pub struct Dungeon<T: AsRef<dungeon> + AsMut<dungeon>>(_);
Expand description

The Rust-safe wrapped master struct that contains the state of the dungeon. Can be owned or mutably borrowed from a low-level ffi::dungeon.

To get a reference to the global dungeon struct, use GlobalDungeonData::get and then GlobalDungeonData::inner.

To access the raw struct, use Self::inner.

Implementations§

source§

impl Dungeon<dungeon>

Dungeon structs.

To get a reference to the global dungeon struct instead, use GlobalDungeonData::get and then GlobalDungeonData::inner.

source

pub fn new() -> Self

Create a new empty dungeon struct. Note that this struct is mostly zeroed and since we don’t know all the field values, it could be (=probably is) invalid.

source

pub fn from_owned(dungeon: dungeon) -> Self

Create a new wrapper for an owned dungeon state.

source§

impl<T: AsRef<dungeon> + AsMut<dungeon>> Dungeon<T>

Manipulate the dungeon.

source

pub fn id(&self) -> DungeonId

Dungeon ID.

source

pub fn set_id(&mut self, id: DungeonId)

Set Dungeon ID.

source

pub fn group_id(&self) -> DungeonGroupId

Dungeon group ID.

source

pub fn set_group_id(&mut self, id: DungeonGroupId)

Set Dungeon group ID.

source

pub fn floor(&self) -> u8

Floor number.

source

pub fn set_floor(&mut self, floor: u8)

Set Floor number.

source

pub fn rescue_floor(&self) -> u8

Rescue floor number.

source

pub fn set_rescue_floor(&mut self, rescue_floor: u8)

Set Rescue floor number.

source

pub fn is_iq_disabled(&self) -> bool

Whether or not IQ is disabled.

source

pub fn set_iq_disabled(&mut self, value: bool)

Set whether or not IQ is disabled.

source

pub fn is_recruiting_enabled(&self) -> bool

Whether or not recruiting is enabled.

source

pub fn set_recruiting_enabled(&mut self, value: bool)

Set whether or not recruiting is enabled.

source

pub fn is_story_mission(&self) -> bool

Whether or not the current mission is a story mission.

If not, allows leader changing and continuing without the partner

source

pub fn set_story_mission(&mut self, value: bool)

Set whether or not the current mission is a story mission.

If not, allows leader changing and continuing without the partner

source

pub fn is_send_home_disabled(&self) -> bool

Whether or not sending home is disabled.

source

pub fn set_send_home_disabled(&mut self, value: bool)

Set whether or not sending home is disabled.

source

pub fn is_hidden_land(&self) -> bool

Hidden Land flag.

Disables sending home/leader changing, lose if partner faints. Set for dungeons between DUNGEON_HIDDEN_LAND and DUNGEON_TEMPORAL_PINNACLE.

source

pub fn set_hidden_land(&mut self, value: bool)

Set whether or not sending home is disabled.

Disables sending home/leader changing, lose if partner faints. Set for dungeons between DUNGEON_HIDDEN_LAND and DUNGEON_TEMPORAL_PINNACLE.

source

pub fn get_mission_destination(&self) -> &mission_destination_info

Info about the next mission destination floor, if applicable

source

pub fn get_mission_destination_mut(&mut self) -> &mut mission_destination_info

Info about the next mission destination floor, if applicable

source

pub fn get_fractional_turn(&self) -> u16

Gets the fractional turn speed.

Controls when a monster at a certain speed stage is able to act.

At normal speed, this will tick up by 4 each turn (can act when x % 4 == 3) At +1 speed, ticks up by 2 each turn (can act when x % 2 == 1) At +2 speed, ticks up by 1 or 2 each turn (can act when x % 4 != 0) At +3 speed, ticks up by 1 each turn (an act every tick)

source

pub fn set_fractional_turn(&mut self, value: u16)

Sets the fractional turn speed.

Controls when a monster at a certain speed stage is able to act.

At normal speed, this will tick up by 4 each turn (can act when x % 4 == 3) At +1 speed, ticks up by 2 each turn (can act when x % 2 == 1) At +2 speed, ticks up by 1 or 2 each turn (can act when x % 4 != 0) At +3 speed, ticks up by 1 each turn (an act every tick)

source

pub fn get_enemy_spawn_counter(&self) -> u16

Enemy spawn counter.

Counts from 0-35, spawns happen at 0.

source

pub fn set_enemy_spawn_counter(&mut self, value: u16)

Sets the enemy spawn counter.

Counts from 0-35, spawns happen at 0.

source

pub fn get_wind_turns(&self) -> i16

Countdown to the wind blowing you out of the dungeon.

source

pub fn set_wind_turns(&mut self, value: i16)

Sets the wind countdown.

source

pub fn get_enemy_density(&self) -> u16

Enemy density. 0, prevents the enemy_spawn_counter for increasing

source

pub fn set_enemy_density(&mut self, value: u16)

Sets the enemy density. 0, prevents the enemy_spawn_counter for increasing

source

pub fn is_thief_alert(&self) -> bool

If you’ve stolen from Kecleon (actual dungeon state)

source

pub fn set_thief_alert(&mut self, value: bool)

Sets the thief alert state.

source

pub fn is_thief_alert_event(&self) -> bool

If you’ve stolen from Kecleon (triggers music and other events?)

source

pub fn set_thief_alert_event(&mut self, value: bool)

Sets the thief alert event state.

source

pub fn is_monster_house_triggered(&self) -> bool

You Entered a Monster House (actual dungeon state)

source

pub fn set_monster_house_triggered(&mut self, value: bool)

Sets the monster house triggered state.

source

pub fn is_monster_house_triggered_event(&self) -> bool

You Entered a Monster House (triggers music and other events?)

source

pub fn set_monster_house_triggered_event(&mut self, value: bool)

Sets the monster house triggered event state.

source

pub fn get_dungeon_objective(&self) -> Option<DungeonObjective>

Objective of the current dungeon. Returns None if the objective is invalid.

source

pub fn set_dungeon_objective(&mut self, objective: DungeonObjective)

Set objective of the current dungeon

source

pub fn get_rescue_attempts_left(&self) -> i8

Gets the number of times the player can still be rescued in this dungeon.

source

pub fn set_rescue_attempts_left(&mut self, value: i8)

Sets the number of times the player can still be rescued in this dungeon.

source

pub fn get_dungeon_generation_info(&self) -> &dungeon_generation_info

Dungeon generation info.

source

pub fn get_dungeon_generation_info_mut( &mut self ) -> &mut dungeon_generation_info

Dungeon generation info.

source

pub fn get_weather(&self) -> Option<Weather>

Get the current weather. Returns None if the weather is invalid.

source

pub fn set_weather(&mut self, weather: Weather)

Sets the current weather

source

pub fn get_natural_weather(&self) -> Option<Weather>

Get the natural weather of this floor. Returns None if the weather is invalid.

source

pub fn set_natural_weather(&mut self, weather: Weather)

sets the natural weather of this floor.

source

pub fn get_weather_turns(&self) -> &[u16; 8]

Turns left for each weather type in enum weather_id (except Weather::Random). If multiple of these are nonzero, the one with the highest number of turns left is chosen. Ties are broken in enum order

source

pub fn get_weather_turns_mut(&mut self) -> &mut [u16; 8]

Turns left for each weather type in enum weather_id (except Weather::Random). If multiple of these are nonzero, the one with the highest number of turns left is chosen. Ties are broken in enum order

source

pub fn get_artificial_permaweather_turns(&self) -> &[u16; 8]

Turns left for artificial permaweather from weather-setting abilities like Drought, Sand Stream, Drizzle, and Snow Warning; one counter for each weather type in enum weather_id (except WEATHER_RANDOM). Any nonzero value triggers that weather condition (it’s usually set to 1 or 0). If the weather’s source is removed, this value becomes the normal number of turns left for that weather condition. Priority in the event of multiple nonzero counters is the same as with weather_turns.

source

pub fn set_artificial_permaweather_turns(&mut self) -> &mut [u16; 8]

Turns left for artificial permaweather from weather-setting abilities like Drought, Sand Stream, Drizzle, and Snow Warning; one counter for each weather type in enum weather_id (except WEATHER_RANDOM). Any nonzero value triggers that weather condition (it’s usually set to 1 or 0). If the weather’s source is removed, this value becomes the normal number of turns left for that weather condition. Priority in the event of multiple nonzero counters is the same as with weather_turns.

source

pub fn get_weather_damage_counter(&self) -> u8

For damaging weather conditions like sandstorm. Counts down from 9-0, damage on 9.

source

pub fn set_weather_damage_counter(&mut self, counter: u8)

Sets the weather damage counter.

source

pub fn get_mud_sport_turns(&self) -> u8

Number of turns left for the Mud Sport condition.

source

pub fn set_mud_sport_turns(&mut self, counter: u8)

Sets the number of turns left for the Mud Sport condition.

source

pub fn get_water_sport_turns(&self) -> u8

Number of turns left for the Water Sport condition.

source

pub fn set_water_sport_turns(&mut self, counter: u8)

Sets the number of turns left for the Water Sport condition.

source

pub fn is_weather_nullified(&self) -> bool

Whether or not current weather is nullified by Cloud Nine or Air Lock.

source

pub fn set_weather_nullified(&mut self, nullified: bool)

Sets whether or not current weather is nullified by Cloud Nine or Air Lock.

source

pub fn is_gravity_in_effect(&self) -> bool

Whether or not Gravity is in effect.

source

pub fn set_gravity_in_effect(&mut self, gravity: bool)

Sets whether or not Gravity is in effect.

source

pub fn get_current_active_entity(&self) -> Option<&DungeonEntity>

Entity that is taking its turn at this moment.

source

pub fn get_current_active_entity_mut(&self) -> Option<&mut DungeonEntity>

Entity that is taking its turn at this moment.

source

pub fn get_new_leader(&self) -> Option<&DungeonEntity>

Monster that will become the leader of the team after changing leaders.

source

pub fn get_new_leader_mut(&self) -> Option<&mut DungeonEntity>

Monster that will become the leader of the team after changing leaders.

source

pub fn get_end_floor_flag(&self) -> bool

Get whether the floor will be advanced at the end of the turn (unless the leader fainted).

source

pub fn set_end_floor_flag(&mut self, flag: bool)

Set whether the floor will be advanced at the end of the turn (unless the leader fainted).

source

pub fn get_end_floor_flag_force(&self) -> bool

Get whether the floor will be advanced at the end of the turn (even if the leader fainted).

source

pub fn set_end_floor_flag_force(&mut self, flag: bool)

Set whether the floor will be advanced at the end of the turn (even if the leader fainted).

source

pub fn get_leader_action_flag(&self) -> bool

False if the leader isn’t doing anything right now. True if it’s currently performing an action (such as walking or attacking)

source

pub fn get_entities(&self) -> EntityTableRef<'_>

Gets the table of all entities.

source

pub fn get_entities_mut(&mut self) -> EntityTableMut<'_>

Gets the table of all entities, mutably.

source

pub fn get_tiles(&self) -> DungeonTileGridRef<'_, 56, 32>

Gets the tile grid.

source

pub fn get_tiles_mut(&mut self) -> DungeonTileGridMut<'_, 56, 32>

Gets the tile grid, mutably.

source

pub fn get_floor_properties(&self) -> &floor_properties

Dungeon floor properties.

source

pub fn get_floor_properties_mut(&mut self) -> &mut floor_properties

Dungeon floor properties.

source

pub fn get_color_table(&self) -> &[rgb; 256]

Color table. Used to apply a tint to the colors shown on screen. Changes depending on the current weather.

source

pub fn get_color_table_mut(&mut self) -> &mut [rgb; 256]

Color table, mutably. Used to apply a tint to the colors shown on screen. Changes depending on the current weather.

source

pub fn get_floor_loop_status(&self) -> Option<FloorLoopStatus>

Whether the current floor should continue or end and why. Returns None for invalid values.

source

pub fn set_floor_loop_status(&mut self, loop_status: FloorLoopStatus)

Whether the current floor should continue or end and why.

source

pub fn is_skip_faint_animation_flag_set(&self) -> bool

If true, the message log won’t be shown and the yellow beam animation won’t appear over team members after the leader faints

source

pub fn set_skip_faint_animation_flag(&mut self, flag: bool)

If true, the message log won’t be shown and the yellow beam animation won’t appear over team members after the leader faints

source

pub fn is_leader_running(&self) -> bool

True if the leader is running. Causes the leader’s action for the next turn to be set to ffi::action::ACTION_WALK until it hits an obstacle.

source

pub fn set_leader_running(&mut self, running: bool)

True if the leader is running. Causes the leader’s action for the next turn to be set to ffi::action::ACTION_WALK until it hits an obstacle.

source

pub fn get_spawn_entries(&self) -> &[monster_spawn_entry; 16]

List of spawn entries for this floor.

source

pub fn get_spawn_entries_mut(&mut self) -> &mut [monster_spawn_entry; 16]

List of spawn entries for this floor, mutably.

source

pub fn get_spawn_table_entries_chosen(&self) -> &[u16; 16]

List of the indices in the complete monster spawn table for this floor that were spawned in this floor.

source

pub fn get_spawn_table_entries_chosen_mut(&mut self) -> &mut [u16; 16]

List of the indices in the complete monster spawn table for this floor that were spawned in this floor.

source

pub fn get_highest_enemy_level(&self) -> u16

Highest level among all the enemies that spawn on this floor

source

pub fn set_highest_enemy_level(&mut self, level: u16)

Highest level among all the enemies that spawn on this floor

source§

impl<T: AsRef<dungeon> + AsMut<dungeon>> Dungeon<T>

source

pub fn inner(&self) -> &dungeon

Access the raw struct.

source

pub fn inner_mut(&mut self) -> &mut dungeon

Access the raw struct mutably.

Trait Implementations§

source§

impl Default for Dungeon<dungeon>

Equivalent to Dungeon::new.

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Dungeon<T>where T: RefUnwindSafe,

§

impl<T> Send for Dungeon<T>where T: Send,

§

impl<T> Sync for Dungeon<T>where T: Sync,

§

impl<T> Unpin for Dungeon<T>where T: Unpin,

§

impl<T> UnwindSafe for Dungeon<T>where T: UnwindSafe,

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.