[][src]Struct sulis_state::script::ScriptAbilitySet

pub struct ScriptAbilitySet {
    pub parent: usize,
    pub abilities: Vec<ScriptAbility>,
}

Represents the set of abilities that a given Entity has access to. This will only include active abilities, not passive ones. See ScriptEntity

len() -> Int

Returns the number of abilities in this set

is_empty() -> Bool

Returns true if there are no abilities in this set, false otherwise.

to_table() -> Table

Creates and returns a Lua table which can be used to iterate over the abilities in this set.

Examples

 abilities = parent:abilities()
 table = abilities:to_table()
 for i = 1, #table do
   game:log(parent:name() .. " has ability " .. table[i]:name())
 end

can_activate() -> Bool

Returns whether or the parent entity can currently activate at least one ability in this set. See ScriptAbility#can_activate

remove_kind(kind: String) -> ScriptAbilitySet

Creates a new ScriptAbilitySet from this one, but with all abilities with the specified AI Kind kind removed. The kind is specified in the ability definition. Does not modify this set. Valid kinds are Damage, Heal, Buff, Debuff, Summon, Special

Examples

  abilities = parent:abilities()
  abilities_without_special = abilities:remove_kind("special")

only_kind(kind: String) -> ScriptAbilitySet

Creates a new ScriptAbilitySet from this one, but only including abilities with the specified AI Kind kind. Valid kinds are Damage, Heal, Buff, Debuff, Summon, Special

only_group(group: String) -> ScriptAbilitySet

Creates a new ScriptAbilitySet from this one, but only including abilities with the specified AI group group. Valid group types are Single and Multiple.

only_range(range: String) -> ScriptAbilitySet

Creates a new ScriptAbilitySet from this one, but only including abilities with the specified AI range range. Valid range types are Personal, Touch, Attack, Short, Visible

only_target(target: String) -> ScriptAbilitySet

Creates a new ScriptAbilitySet from this one, but only including abilities with the specified AI target target. Valid target types are Entity, EmptyGround, AnyGround.

sort_by_priority()

Sorts this set in place, according to the AI priority of the abilities in the set. Lower priorities are sorted first.

Examples

  abilities = parent:abilities():only_range("Touch"):only_kind("Attack")
  if abilities:is_empty() return end
  abilities:sort_by_priority()
  -- do something with the first ability

Fields

parent: usizeabilities: Vec<ScriptAbility>

Implementations

impl ScriptAbilitySet[src]

pub fn from(entity: &Rc<RefCell<EntityState>>) -> ScriptAbilitySet[src]

Trait Implementations

impl Clone for ScriptAbilitySet[src]

impl UserData for ScriptAbilitySet[src]

Auto Trait Implementations

impl RefUnwindSafe for ScriptAbilitySet

impl Send for ScriptAbilitySet

impl Sync for ScriptAbilitySet

impl Unpin for ScriptAbilitySet

impl UnwindSafe for ScriptAbilitySet

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<'lua, T> FromLua<'lua> for T where
    T: 'static + UserData + Clone
[src]

impl<'lua, T> FromLuaMulti<'lua> for T where
    T: FromLua<'lua>, 
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'lua, T> ToLua<'lua> for T where
    T: 'static + UserData + Send
[src]

impl<'lua, T> ToLuaMulti<'lua> for T where
    T: ToLua<'lua>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]