Ability
Ability is one of the basic elements within the project and needs to be hooked up to a unit and released by the unit to produce a subsequent effect.
Functions
enable
Enable abilitys.
ability:enable()
disable
Disable the ability.
ability:disable()
restart_cd
Enter cooldown.
ability:restart_cd()
remove
Finish cooling.
ability:remove()
complete_cd
Complete cooling.
ability:complete_cd()
set_level
Set ability level.
Parameter
Value | Type | Desctiption |
---|---|---|
level | number | Level. |
ability:set_level(level)
increase_cd
Increase cooldown.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Time. |
ability:increase_cd(value)
set_stack_count
Set the number of energized layers.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Number of layers. |
ability:set_stack_count(value)
set_float_attr
Set the real number attribute.
Parameters
Variable | Type | Desctiption |
---|---|---|
key | str | Name of the ability real number attribute. |
value | number | Value of the attribute. |
ability:set_float_attr(key, value)
set_int_attr
Set the integer attribute.
Parameters
Variable | Type | Desctiption |
---|---|---|
key | str | Ability integer attribute name. |
value | number | Value of the attribute. |
ability:set_int_attr(key, value)
set_remaining_cd
Set the remaining cooldown time.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Cooling time. |
ability:set_remaining_cd(value)
add_level
Add an ability level.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Ability level. |
ability:add_level(value)
add_stack_count
Add a ability charge level.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Number of levels. |
ability:add_stack_count(value)
add_remaining_cd
Add the remaining cooldown of the ability.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Time. |
ability:add_remaining_cd(value)
add_float_attr
Add a real number attribute
Parameters
Variable | Type | Desctiption |
---|---|---|
key | Name of the real number attribute. | |
value | number | Value of the attribute. |
ability:add_float_attr(key, value)
add_int_attr
Add an integer attribute
Parameters
Variable | Type | Desctiption |
---|---|---|
key | integer | Name of the attribute. |
value | number | Value of the attribute. |
ability:add_int_attr(key, value)
set_name
Set the ability name.
Parameter
Variable | Type | Desctiption |
---|---|---|
name | Name of the ability. |
ability:set_name(name)
set_description
Set the ability description
Parameter
Variable | Type | Desctiption |
---|---|---|
des | Description. |
ability:set_description(des)
learn_ability
Learn abilitys.
ability:learn_ability()
set_remaining_charge_time
Set the remaining charge time of the ability.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Time. |
ability:set_remaining_charge_time(value)
set_cast_range
Set the casting range of the ability.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Casting range. |
ability:set_cast_range(value)
set_player_attr_cost
Set ability player attribute cost.
Parameters
Variable | Type | Desctiption |
---|---|---|
key | Player attribute name. | |
value | number | Value of the attribute. |
ability:set_player_attr_cost(key, value)
add_player_attr_cost
Increase ability player attribute cost.
Parameters
Variable | Type | Desctiption |
---|---|---|
key | Player attribute name. | |
value | number | Value of the attribute. |
ability:add_player_attr_cost(key, value)
set_is_impacted_by_cd_reduce
Set whether the ability is affected by the cooldown reduction.
Parameter
Variable | Type | Desctiption |
---|---|---|
is_influenced | Whether the ability is affected by cooldown reduction. |
ability:set_is_impacted_by_cd_reduce(is_influenced)
set_is_cost_hp_can_die
Set whether consuming life will kill.
Parameter
Variable | Type | Desctiption |
---|---|---|
is_can_die | Whether consumed lives will die. |
ability:set_is_cost_hp_can_die(is_can_die)
set_can_cast_when_hp_insufficient
Set whether the ability can be released when life is low.
Parameter
Variable | Type | Desctiption |
---|---|---|
is_can_cast | Whether the ability can be released when life is low. |
ability:set_can_cast_when_hp_insufficient(is_can_cast)
set_sector_indicator_radius
Set the sector indicator radius.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Radius. |
ability:set_sector_indicator_radius(value)
set_sector_indicator_angle
Set the sector indicator angle.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Angle. |
ability:set_sector_indicator_angle(value)
set_arrow_or_multistage_indicator_length
Set the length of the arrow/multistage indicator.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Length. |
ability:set_arrow_or_multistage_indicator_length(value)
set_arrow_or_multistage_indicator_width
Set arrow/multistage indicator width.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Width. |
ability:set_arrow_or_multistage_indicator_width(value)
set_circle_indicator_radius
Set the radius of the arrow circle indicator.
Parameter
Variable | Type | Desctiption |
---|---|---|
value | number | Radius. |
ability:set_circle_indicator_radius(value)
set_indicator_type
Set the ability indicator type.
Parameter
Variable | Type | Desctiption |
---|---|---|
type | Name of the indicator type. |
ability:set_indicator_type(type)
set_normal_attack_preview_state
Set the player's attack preview state.
Parameters
Variable | Type | Desctiption |
---|---|---|
player | player | Player. |
state | boolean | State on/off. |
ability.set_normal_attack_preview_state(player, state)
set_smart_cast_with_indicator
Set whether the player's indicator is displayed when smart casting.
Parameters
Variable | Type | Desctiption |
---|---|---|
state | boolean | State on/off. |
player | player | Player. |
ability.set_smart_cast_with_indicator(player, state)
show_ability_indicator
Show the ability indicator.
Parameters
Variable | Type | Desctiption |
---|---|---|
player | player | Player. |
ability | ability | Ability. |
ability.show_ability_indicator(player, ability)
hide_ability_indicator
Disable the ability indicator.
Parameter
Variable | Type | Desctiption |
---|---|---|
player | player | Player. |
ability.hide_ability_indicator(player)
is_influenced_by_cd_reduce
Whether it is influenced by cooldown reduction or not.
Return value
Type | Desctiption |
---|---|
boolean | Whether it is influenced by cooldown reduction. |
ability:is_influenced_by_cd_reduce()
is_cost_hp_can_die
Whether costing life will kill or not.
Return value
Type | Desctiption |
---|---|
boolean | Whether costing life can die. |
ability:is_cost_hp_can_die()
is_can_cast_when_hp_insufficient
Whether insufficient life can be released or not.
Return value
Type | Desctiption |
---|---|
boolean | Whether under life can be released. |
ability:is_can_cast_when_hp_insufficient()
has_tag
Whether it has a tag or not.
Parameter
Variable | Type | Desctiption |
---|---|---|
tag | str | Name of the tag. |
Return value
Type | Desctiption |
---|---|
string | Type of ability. |
ability:has_tag(tag)
api_get_stack_cd_left_time
Get the current remaining charge time of the ability.
Return value
Type | Desctiption |
---|---|
float | Remaining charge time. |
ability:api_get_stack_cd_left_time()
get_type
Gets the ability classification.
Return value
Type | Desctiption |
---|---|
string | Name of the ability category. |
ability:get_type()
get_ability_type_id
Get the ability type ID (object code ID).
Return value
Type | Desctiption |
---|---|
number | Ability type ID (object ID). |
ability:get_ability_type_id()
get_ability_index
Get the ability bit where the ability is located.
Return value
Type | Desctiption |
---|---|
number | Ability position of the ability. |
ability:get_ability_index()
get_player_attr_cost
Get the value of the player attribute consumed by the ability.
Parameter
Variable | Type | Desctiption |
---|---|---|
key | str | Player attribute. |
Return value
Type | Desctiption |
---|---|
number | Attribute value. |
ability:get_player_attr_cost(key)
get_cast_type
Get the ability release type.
Return value
Type | Desctiption |
---|---|
string | Name of the ability release type. |
ability:get_cast_type()
check_ability_key_precondition
Check ability type precondition.
Parameters
Variable | Type | Desctiption |
---|---|---|
player | player | Player. |
type_id | number | Ability type ID (object ID). |
Return value
Type | Desctiption |
---|---|
boolean | Whether the ability type precondition is met. |
ability.check_ability_key_precondition(player, type_id)
is_ability_type_influenced_by_cd_reduce
Whether the ability type is influenced by cooldown reduction.
Parameter
Variable | Type | Desctiption |
---|---|---|
type_id | number | Ability type ID (item ID). |
Return value
Type | Desctiption |
---|---|
boolean | Whether the ability is affected by cooldown reduction. |
ability.is_ability_type_influenced_by_cd_reduce(type_id)
get_icon_id_by_ability_type
Get the image ID of the icon for the ability type.
Return value
Type | Desctiption |
---|---|
number | Image ID. |
ability.get_icon_id_by_ability_type(type_id)
get_related_ability
Get related abilitys.
Parameter
Variable | Type | Desctiption |
---|---|---|
object | table | Projectile or magic effect (projectile or modifier). |
Return value
Type | Desctiption |
---|---|
ability | Associated ability of the projectile or magic effect. |
ability.get_related_ability(object)
get_formula_kv
Get the KV of the ability formula type.
Parameter
Variable | Type | Desctiption |
---|---|---|
key | str | Key of the ability formula type. |
Return value
Type | Desctiption |
---|---|
number | Value of the formula. |
ability:get_formula_kv(key)
get_float_attr
Get the real number attribute.
Parameter
Variable | Type | Desctiption |
---|---|---|
key | str | Name of an attribute of ability real type. |
Return value
Type | Desctiption |
---|---|
number | Value of the real number attribute . |
ability:get_float_attr(key)
get_string_attr
Get a string attribute.
Parameter
Variable | Type | Desctiption |
---|---|---|
key | str | Name of the attribute of the ability string type. |
Return value
Type | Desctiption |
---|---|
str | Value of the string attribute. |
ability:get_string_attr(key)
get_ability_owner
Get the owner of the ability.
Return value
Type | Desctiption |
---|---|
unit | Owner of the ability. |
ability:get_ability_owner()
get_cd_left_time
Get the current cooldown time.
Return value
Type | Desctiption |
---|---|
number | Current cooldown time of the ability. |
ability:get_cd_left_time()
is_exist
Get whether the ability exists or not.
Return value
Type | Desctiption |
---|---|
bool | Whether the ability exists. |
ability:is_exist()
ability_selected_target_item
The target item selected by the ability.
Parameter
Variable | Type | Desctiption |
---|---|---|
data | table | Data in the event. |
Return value
Type | Desctiption |
---|---|
item | Selected target item. |
ability:ability_selected_target_item(data)
ability_selected_target_unit
The target unit selected by the ability.
Parameter
Variable | Type | Desctiption |
---|---|---|
data | table | Data in the event. |
Return value
Type | Desctiption |
---|---|
unit | Target unit selected. |
ability:ability_selected_target_unit(data)
ability_selected_destructible
Ability selected target destructible.
Parameter
Variable | Type | Desctiption |
---|---|---|
data | table | Data in the event. |
Return value
Type | Desctiption |
---|---|
destructible | Target destructible. |
ability:ability_selected_destructible(data)
selected_location_by_ability
Ability selected points.
Parameter
Variable | Type | Desctiption |
---|---|---|
data | table | Data in the event. |
Return value
Type | Desctiption |
---|---|
point | Point selected. |
ability:selected_location_by_ability(data)
get_ability_cast_direction
Get the direction of the ability release -- waiting for data to be processed.
Parameter
Variable | Type | Desctiption |
---|---|---|
data | table | Data in the event. |
Return value
Type | Desctiption |
---|---|
number | Ability release direction. |
ability:get_ability_cast_direction(data)
get_ability_by_unit_and_seq
Get the ability in the event.
Parameter
Variable | Type | Desctiption |
---|---|---|
data | table | Data in the event. |
Return value
Type | Desctiption |
---|---|
ability | Ability in the event. |
ability.get_ability_by_unit_and_seq(data)
Events
Ability triggers need to be included in a group to use group variables.
Ability gained
Get ability event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability gained", function(data)
print("acquire abilitys")
end)
Ability lost
Loss of ability event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability lost", function(data)
print("lost ability")
end)
Learn ability (ability point consumed)
Upgrade ability event
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Learn ability (ability point consumed)", function(data)
print("upgrade abilitys")
end)
About to castability
Upcoming spell event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("About to cast ability", function(data)
print("lost ability")
end)
Ability anticipation starts
Cast start event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability anticipation starts", function(data)
print("lost ability")
end)
Ability anticipation ends
Spellcasting event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability anticipation ends", function(data)
print("lost ability")
end)
Ability continuous casting ends
Spell completion event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability continuous casting ends", function(data)
print("lost ability")
end)
Ability continuous casting starts
Spellcasting event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability continuous casting starts", function(data)
print("lost ability")
end)
Ability CD ends
Ability Cooldown Completion Event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability CD ends", function(data)
print("lost ability")
end)
Casting stops
Cast stop event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Casting stops", function(data)
print("lost ability")
end)
Ability continuous casting starting interrupted
Spellcasting shot was interrupted event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability continuous casting starting interrupted", function(data)
print("lost ability")
end)
Ability anticipation starting interrupted
Casting start is interrupted event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability anticipation starting interrupted", function(data)
print("lost ability")
end)
Ability anticipation ending interrupted
Casting channel is interrupted event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability anticipation ending interrupted", function(data)
print("lost ability")
end)
Ability level changed (including being changed by triggers)
Ability level change event.
local ability_group = cli.ability.create_ability_trigger_group(100001)
ability_group.add_trigger("Ability level changed (including being changed by triggers)", function(data)
print("lost ability")
end)