[−][src]Struct sulis_state::script::ScriptAbilitySet
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: usize
abilities: Vec<ScriptAbility>
Implementations
impl ScriptAbilitySet
[src]
pub fn from(entity: &Rc<RefCell<EntityState>>) -> ScriptAbilitySet
[src]
Trait Implementations
impl Clone for ScriptAbilitySet
[src]
fn clone(&self) -> ScriptAbilitySet
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl UserData for ScriptAbilitySet
[src]
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M)
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<'lua, T> FromLua<'lua> for T where
T: 'static + UserData + Clone,
[src]
T: 'static + UserData + Clone,
impl<'lua, T> FromLuaMulti<'lua> for T where
T: FromLua<'lua>,
[src]
T: FromLua<'lua>,
pub fn from_lua_multi(
values: MultiValue<'lua>,
lua: Context<'lua>
) -> Result<T, Error>
[src]
values: MultiValue<'lua>,
lua: Context<'lua>
) -> Result<T, Error>
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'lua, T> ToLua<'lua> for T where
T: 'static + UserData + Send,
[src]
T: 'static + UserData + Send,
impl<'lua, T> ToLuaMulti<'lua> for T where
T: ToLua<'lua>,
[src]
T: ToLua<'lua>,
pub fn to_lua_multi(self, lua: Context<'lua>) -> Result<MultiValue<'lua>, Error>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,