Skip to main content

PlayerController

Struct PlayerController 

Source
pub struct PlayerController<'a, A: PlayerAgent + ?Sized> {
    pub game: &'a GameState,
    pub player: PlayerId,
    pub agent: &'a mut A,
    pub full_controls: BTreeSet<FullControlFlag>,
}

Fields§

§game: &'a GameState§player: PlayerId§agent: &'a mut A§full_controls: BTreeSet<FullControlFlag>

Implementations§

Source§

impl<'a, A: PlayerAgent + ?Sized> PlayerController<'a, A>

Source

pub fn new(game: &'a GameState, player: PlayerId, agent: &'a mut A) -> Self

Source

pub fn snapshot_state(&mut self, mana_pools: &[ManaPool])

Source

pub fn available_priority_actions( &self, playable: &[PlayOption], tappable_lands: &[CardId], untappable_lands: &[CardId], activatable: &[(CardId, usize)], ) -> Vec<PlayerAction>

Source

pub fn add_full_control(&mut self, flag: FullControlFlag)

Source

pub fn remove_full_control(&mut self, flag: FullControlFlag)

Source

pub fn has_full_control(&self, flag: FullControlFlag) -> bool

Source

pub fn notify(&mut self, event: GameNotification)

Source

pub fn reveal_cards( &mut self, cards: &[CardId], zone: ZoneType, owner: PlayerId, message_prefix: Option<&str>, )

Source

pub fn temp_show_cards(&mut self, cards: &[CardId])

Source

pub fn end_temp_show_cards(&mut self)

Source

pub fn reveal_delayed(&mut self, delayed: &DelayedReveal)

Source

pub fn choose_attackers( &mut self, available: &[CardId], possible_defenders: &[DefenderId], ) -> Vec<(CardId, DefenderId)>

Source

pub fn choose_blockers( &mut self, attackers: &[CardId], available_blockers: &[CardId], max_blockers: Option<usize>, ) -> Vec<(CardId, CardId)>

Source

pub fn choose_blocker_for( &mut self, attackers: &[CardId], blocker: CardId, ) -> Option<CardId>

Source

pub fn exert_attackers(&mut self, attackers: &[CardId]) -> Vec<CardId>

Source

pub fn enlist_attackers(&mut self, attackers: &[CardId]) -> Vec<CardId>

Source

pub fn choose_damage_assignment_order( &mut self, attacker: CardId, blockers: &[CardId], ) -> Vec<CardId>

Source

pub fn assign_combat_damage( &mut self, attacker: CardId, blockers_in_order: &[CardId], defender: Option<DefenderId>, damage_to_assign: i32, ) -> Vec<(Option<CardId>, i32)>

Source

pub fn choose_target_player( &mut self, valid: &[PlayerId], sa: Option<&SpellAbility>, ) -> Option<PlayerId>

Source

pub fn choose_target_card( &mut self, valid: &[CardId], sa: Option<&SpellAbility>, ) -> Option<CardId>

Source

pub fn choose_target_any( &mut self, valid_players: &[PlayerId], valid_cards: &[CardId], sa: Option<&SpellAbility>, ) -> TargetChoice

Source

pub fn choose_entities_for_effect( &mut self, candidates: &[GameEntity], min: usize, max: usize, ) -> Vec<GameEntity>

Source

pub fn choose_single_entity_for_effect( &mut self, candidates: &[GameEntity], ) -> Option<GameEntity>

Source

pub fn choose_cards_for_effect( &mut self, valid: &[CardId], min: usize, max: usize, ) -> Vec<CardId>

Source

pub fn choose_cards_for_zone_change( &mut self, valid: &[CardId], min: usize, max: usize, select_prompt: &str, ) -> Vec<CardId>

Source

pub fn choose_single_card_for_zone_change( &mut self, valid: &[CardId], select_prompt: &str, is_optional: bool, ) -> Option<CardId>

Source

pub fn choose_type( &mut self, type_category: &str, valid_types: &[String], ) -> Option<String>

Source

pub fn choose_some_type( &mut self, type_category: &str, valid_types: &[String], ) -> Option<String>

Source

pub fn choose_number_from_list( &mut self, choices: &[i32], message: &str, source_card_id: Option<CardId>, ) -> Option<i32>

Source

pub fn choose_binary( &mut self, question: &str, kind: BinaryChoiceKind, default_choice: Option<bool>, source: Option<CardId>, api: Option<ApiType>, ) -> bool

Source

pub fn confirm_action( &mut self, mode: Option<&str>, message: &str, options: &[String], source: Option<CardId>, api: Option<ApiType>, ) -> bool

Source

pub fn confirm_payment( &mut self, cost_kind: &str, message: &str, source: Option<CardId>, api: Option<ApiType>, ) -> bool

Source

pub fn pay_cost_to_prevent_effect( &mut self, cost_kind: &str, message: &str, source: Option<CardId>, api: Option<ApiType>, can_pay: bool, targets: &[GameEntity], effect_text: &str, ) -> bool

Source

pub fn confirm_bid_action( &mut self, mode: Option<&str>, message: &str, bid: i32, winner: Option<PlayerId>, ) -> bool

Source

pub fn confirm_replacement_effect( &mut self, description: &str, source: Option<CardId>, ) -> bool

Source

pub fn confirm_static_application( &mut self, message: &str, logic: Option<&str>, source: Option<CardId>, ) -> bool

Source

pub fn choose_optional_trigger( &mut self, description: &str, source: Option<CardId>, api: Option<ApiType>, ) -> bool

Source

pub fn choose_target_spell( &mut self, valid_entries: &[u32], source: Option<CardId>, ) -> Option<u32>

Source

pub fn choose_mode( &mut self, descriptions: &[String], min: usize, max: usize, source_card_id: Option<CardId>, ) -> Vec<usize>

Source

pub fn pay_mana_cost( &mut self, card_id: CardId, card_name: &str, mana_cost: &str, mana_cost_display: &str, mana_cost_checkpoint: &str, can_confirm_from_pool: bool, allow_reserved_source_reuse: bool, reserved_sacrifices: &[CardId], mana_ability_options: &[ManaAbilityOption], tappable_lands: &[CardId], untappable_lands: &[CardId], mana_pool: &ManaPool, ) -> ManaCostAction

Source

pub fn pay_combat_cost( &mut self, attacker: CardId, cost: i32, description: &str, mana_ability_options: &[ManaAbilityOption], tappable_lands: &[CardId], untappable_lands: &[CardId], mana_pool_total: i32, ) -> CombatCostAction

Source

pub fn decide_cost_part( &mut self, source: CardId, cost_part: &CostPart, ) -> Option<PaymentDecision>

Source

pub fn order_cost_parts(&mut self, parts: Vec<CostPart>) -> Vec<CostPart>

Source

pub fn choose_color(&mut self, valid_colors: &[String]) -> Option<String>

Source

pub fn choose_card_name(&mut self, valid_names: &[String]) -> Option<String>

Source

pub fn choose_scry( &mut self, source: Option<CardId>, cards: &[CardId], ) -> Vec<Vec<CardId>>

Source

pub fn choose_surveil( &mut self, source: Option<CardId>, cards: &[CardId], ) -> Vec<Vec<CardId>>

Source

pub fn choose_reorder_library(&mut self, cards: &[CardId]) -> Vec<CardId>

Source

pub fn choose_discard(&mut self, hand: &[CardId], num: usize) -> Vec<CardId>

Source

pub fn choose_random_discard( &mut self, hand: &[CardId], num: usize, ) -> Vec<CardId>

Source

pub fn choose_delve( &mut self, valid: &[CardId], max: usize, source: Option<CardId>, ) -> Vec<CardId>

Source

pub fn choose_improvise( &mut self, untapped_artifacts: &[CardId], remaining_cost: &ManaCost, source: Option<CardId>, ) -> Vec<CardId>

Source

pub fn choose_convoke( &mut self, untapped_creatures: &[CardId], remaining_cost: &ManaCost, source: Option<CardId>, ) -> Vec<CardId>

Source

pub fn specify_mana_combo( &mut self, available_colors: &[String], amount: usize, source: Option<CardId>, express_choice: Option<u16>, ) -> Vec<String>

Source

pub fn choose_roll_swap_value( &mut self, current_result: i32, power: i32, toughness: i32, source: Option<CardId>, ) -> Option<RollSwapChoice>

Source

pub fn reveal( &mut self, cards: &[CardId], zone: ZoneType, owner: PlayerId, message_prefix: Option<&str>, )

Source

pub fn notify_of_value(&mut self, label: &str, value: &str)

Source

pub fn choose_single_replacement_effect( &mut self, descriptions: &[String], ) -> usize

Source

pub fn choose_land_or_spell(&mut self) -> Option<bool>

Source

pub fn choose_sector(&mut self, sectors: &[String]) -> Option<String>

Source

pub fn add_keyword_cost(&mut self, prompt: &str) -> bool

Source

pub fn cheat_shuffle(&mut self)

Source

pub fn reset_inputs(&mut self)

Source

pub fn can_play_unlimited_lands(&self) -> bool

Auto Trait Implementations§

§

impl<'a, A> !RefUnwindSafe for PlayerController<'a, A>

§

impl<'a, A> !UnwindSafe for PlayerController<'a, A>

§

impl<'a, A> Freeze for PlayerController<'a, A>
where A: ?Sized,

§

impl<'a, A> Send for PlayerController<'a, A>
where A: Send + ?Sized,

§

impl<'a, A> Sync for PlayerController<'a, A>
where A: Sync + ?Sized,

§

impl<'a, A> Unpin for PlayerController<'a, A>
where A: ?Sized,

§

impl<'a, A> UnsafeUnpin for PlayerController<'a, A>
where A: ?Sized,

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<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> 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, 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