Skip to main content

PlayerState

Struct PlayerState 

Source
pub struct PlayerState {
Show 113 fields pub id: PlayerId, pub name: String, pub life: i32, pub starting_life: i32, pub life_started_this_turn_with: i32, pub life_gained_this_turn: i32, pub life_gained_by_team_this_turn: i32, pub life_gained_times_this_turn: i32, pub life_lost_this_turn: i32, pub life_lost_last_turn: i32, pub poison_counters: i32, pub lands_played_this_turn: i32, pub lands_played_last_turn: i32, pub max_land_plays_per_turn: i32, pub spells_cast_this_turn: i32, pub spells_cast_last_turn: i32, pub spells_cast_this_game: i32, pub cards_cast_this_turn: Vec<CardId>, pub max_hand_size: i32, pub starting_hand_size: i32, pub unlimited_hand_size: bool, pub drawn_this_turn: i32, pub drawn_last_turn: i32, pub drawn_this_draw_step: i32, pub tried_to_draw_from_empty_library: bool, pub num_cards_in_hand_started_this_turn_with: i32, pub has_lost: bool, pub has_won: bool, pub has_conceded: bool, pub left_game: bool, pub outcome: Option<PlayerOutcome>, pub commander_damage_received: HashMap<u32, i32>, pub commanders: Vec<CardId>, pub commander_casts: HashMap<u32, u32>, pub commander_damage_enabled: bool, pub skip_turns: i32, pub skip_next_draw: bool, pub skip_next_combat: bool, pub skip_next_untap: bool, pub damage_prevention: i32, pub energy_counters: i32, pub mana_shards: i32, pub mana_expended_this_turn: i32, pub surveilled_this_turn: i32, pub tokens_created_this_turn: i32, pub foretold_this_turn: i32, pub investigated_this_turn: i32, pub ventured_this_turn: i32, pub sacrificed_this_turn: i32, pub library_searched_this_turn: i32, pub controlled_by: Option<PlayerId>, pub team_number: i32, pub unlimited_land_plays: bool, pub has_city_blessing: bool, pub ring_level: i32, pub speed: i32, pub speed_effect_card: Option<CardId>, pub commander_effect_card: Option<CardId>, pub monarch_effect_card: Option<CardId>, pub initiative_effect_card: Option<CardId>, pub blessing_effect_card: Option<CardId>, pub radiation_effect_card: Option<CardId>, pub ring_effect_card: Option<CardId>, pub contraption_sprocket_effect_card: Option<CardId>, pub keyword_effect_card: Option<CardId>, pub planar_dice_effect_card: Option<CardId>, pub companion_effect_card: Option<CardId>, pub discarded_this_turn: i32, pub explored_this_turn: i32, pub assigned_damage_this_turn: i32, pub assigned_combat_damage_this_turn: i32, pub opponents_assigned_damage_this_turn: i32, pub attacked_players_this_turn: Vec<PlayerId>, pub attacked_players_last_turn: Vec<PlayerId>, pub attacked_players_this_combat: Vec<PlayerId>, pub been_dealt_combat_damage_since_last_turn: bool, pub attractions_visited_this_turn: i32, pub num_flips_this_turn: i32, pub num_rolls_this_turn: i32, pub dice_rolls_this_turn: Vec<i32>, pub ring_bearer: Option<CardId>, pub radiation_counters: i32, pub permanents_left_battlefield_this_turn: i32, pub lands_entered_battlefield_this_turn: i32, pub permanents_put_into_graveyard_this_turn: i32, pub completed_dungeons: Vec<CardId>, pub notes: HashMap<String, Vec<String>>, pub noted_num: HashMap<String, i32>, pub tapped_land_for_mana_this_turn: bool, pub committed_crime_this_turn: i32, pub changed_keywords: Vec<String>, pub keywords_until_my_next_turn: Vec<String>, pub keywords_until_end_of_turn: Vec<String>, pub maingame_card_mapping: HashMap<CardId, CardId>, pub controlled_while_searching: BTreeSet<PlayerId>, pub avatar_index: i32, pub sleeve_index: i32, pub crank_counter: i32, pub additional_votes: HashMap<i64, i32>, pub additional_optional_votes: HashMap<i64, i32>, pub control_votes: BTreeSet<i64>, pub additional_villainous_choices: HashMap<i64, i32>, pub declares_attackers: BTreeSet<PlayerId>, pub declares_blockers: BTreeSet<PlayerId>, pub elemental_bend_triggers: BTreeSet<String>, pub inbound_tokens: Vec<CardId>, pub planeswalked_to_this_turn: Vec<CardId>, pub lost_ownership: Vec<CardId>, pub gained_ownership: Vec<CardId>, pub paid_for_stack: Vec<SpellAbility>, pub devotion_mod: i32, pub draft_notes: HashMap<String, String>, pub statistics: PlayerStatistics,
}
Expand description

Mutable game-state for a single player.

Fields§

§id: PlayerId§name: String§life: i32§starting_life: i32§life_started_this_turn_with: i32§life_gained_this_turn: i32§life_gained_by_team_this_turn: i32§life_gained_times_this_turn: i32§life_lost_this_turn: i32§life_lost_last_turn: i32§poison_counters: i32§lands_played_this_turn: i32§lands_played_last_turn: i32§max_land_plays_per_turn: i32§spells_cast_this_turn: i32§spells_cast_last_turn: i32§spells_cast_this_game: i32§cards_cast_this_turn: Vec<CardId>§max_hand_size: i32§starting_hand_size: i32§unlimited_hand_size: bool§drawn_this_turn: i32§drawn_last_turn: i32§drawn_this_draw_step: i32§tried_to_draw_from_empty_library: bool§num_cards_in_hand_started_this_turn_with: i32§has_lost: bool§has_won: bool§has_conceded: bool§left_game: bool

CR 800.4 processed: on_player_lost ran for this seat (Java’s ingamePlayers removal).

§outcome: Option<PlayerOutcome>§commander_damage_received: HashMap<u32, i32>§commanders: Vec<CardId>§commander_casts: HashMap<u32, u32>§commander_damage_enabled: bool§skip_turns: i32§skip_next_draw: bool§skip_next_combat: bool§skip_next_untap: bool§damage_prevention: i32§energy_counters: i32§mana_shards: i32§mana_expended_this_turn: i32§surveilled_this_turn: i32§tokens_created_this_turn: i32§foretold_this_turn: i32§investigated_this_turn: i32§ventured_this_turn: i32§sacrificed_this_turn: i32§library_searched_this_turn: i32§controlled_by: Option<PlayerId>§team_number: i32§unlimited_land_plays: bool§has_city_blessing: bool§ring_level: i32§speed: i32§speed_effect_card: Option<CardId>§commander_effect_card: Option<CardId>§monarch_effect_card: Option<CardId>§initiative_effect_card: Option<CardId>§blessing_effect_card: Option<CardId>§radiation_effect_card: Option<CardId>§ring_effect_card: Option<CardId>§contraption_sprocket_effect_card: Option<CardId>§keyword_effect_card: Option<CardId>§planar_dice_effect_card: Option<CardId>§companion_effect_card: Option<CardId>§discarded_this_turn: i32§explored_this_turn: i32§assigned_damage_this_turn: i32§assigned_combat_damage_this_turn: i32§opponents_assigned_damage_this_turn: i32§attacked_players_this_turn: Vec<PlayerId>§attacked_players_last_turn: Vec<PlayerId>§attacked_players_this_combat: Vec<PlayerId>§been_dealt_combat_damage_since_last_turn: bool§attractions_visited_this_turn: i32§num_flips_this_turn: i32§num_rolls_this_turn: i32§dice_rolls_this_turn: Vec<i32>§ring_bearer: Option<CardId>§radiation_counters: i32§permanents_left_battlefield_this_turn: i32§lands_entered_battlefield_this_turn: i32§permanents_put_into_graveyard_this_turn: i32§completed_dungeons: Vec<CardId>§notes: HashMap<String, Vec<String>>§noted_num: HashMap<String, i32>§tapped_land_for_mana_this_turn: bool§committed_crime_this_turn: i32§changed_keywords: Vec<String>§keywords_until_my_next_turn: Vec<String>§keywords_until_end_of_turn: Vec<String>§maingame_card_mapping: HashMap<CardId, CardId>§controlled_while_searching: BTreeSet<PlayerId>§avatar_index: i32§sleeve_index: i32§crank_counter: i32§additional_votes: HashMap<i64, i32>§additional_optional_votes: HashMap<i64, i32>§control_votes: BTreeSet<i64>§additional_villainous_choices: HashMap<i64, i32>§declares_attackers: BTreeSet<PlayerId>§declares_blockers: BTreeSet<PlayerId>§elemental_bend_triggers: BTreeSet<String>§inbound_tokens: Vec<CardId>§planeswalked_to_this_turn: Vec<CardId>§lost_ownership: Vec<CardId>§gained_ownership: Vec<CardId>§paid_for_stack: Vec<SpellAbility>§devotion_mod: i32§draft_notes: HashMap<String, String>§statistics: PlayerStatistics

Implementations§

Source§

impl PlayerState

Source

pub fn new(id: PlayerId, name: String, starting_life: i32) -> Self

Source

pub fn gain_life(&mut self, amount: i32)

Source

pub fn lose_life(&mut self, amount: i32)

Source

pub fn set_life(&mut self, amount: i32) -> i32

Source

pub fn deal_damage(&mut self, amount: i32)

Source

pub fn can_play_land(&self) -> bool

Source

pub fn is_alive(&self) -> bool

Source

pub fn has_outcome(&self) -> bool

Source

pub fn mark_lost(&mut self, outcome: PlayerOutcome)

Source

pub fn mark_won(&mut self, outcome: PlayerOutcome)

Source

pub fn clear_outcome(&mut self)

Source

pub fn reset_for_restart(&mut self)

Source

pub fn new_turn(&mut self)

Trait Implementations§

Source§

impl Clone for PlayerState

Source§

fn clone(&self) -> PlayerState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlayerState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PlayerState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&PlayerState> for PlayerStatistics

Source§

fn from(player: &PlayerState) -> Self

Converts to this type from the input type.
Source§

impl Serialize for PlayerState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V