You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.0 KiB
GDScript

2 years ago
@tool
extends AnimationSelectCfg
class_name SkillCfg
2 years ago
@export var name: String
@export var sub_character: CharacterCfg
2 years ago
@export var skill_animation: Animation
@export_tool_button("刷新技能动画", "Callable")
var refresh_animation: Callable = check_animation
@export_group("Combo参数")
@export var stance_from: Enum.EStance = Enum.EStance.GroundAny
@export var stance_to: Enum.EStance
@export var break_level: Enum.EBreakLevel = Enum.EBreakLevel.Break
@export var is_charging: bool
@export_group("攻击参数")
2 years ago
@export var attack1: AttackCfg
@export var attack1_box: AttackBoxCfg
@export var attack1_with_stop: bool
2 years ago
@export var attack2: AttackCfg
@export var attack2_box: AttackBoxCfg
@export var attack2_with_stop: bool
@export_group("数值和标记")
@export var mp_cost: int
10 months ago
@export var mp_sub_cost: bool
@export var free_lock: bool
@export var ignore_push: bool
@export var with_stop: bool = false
10 months ago
@export var is_lock_x: bool = true
@export var is_lock_x_move: bool = false
@export_group("辅助参数")
@export var range: float
@export var warn_type: Enum.ESkillWarnType = Enum.ESkillWarnType.None
2 years ago
1 year ago
var attack_particle: Dictionary = {}
var owner: CharacterCfg
1 year ago
2 years ago
func check_animation() -> bool:
var res_name: String = get_res_name()
var path: String = "res://resource/skill_animation/%s.tres" % res_name
if sprite_frames == null:
print("未设置技能动画资源:", res_name)
return false
if animation_name == "":
print("未设置技能动画名")
return false
if !sprite_frames.has_animation(animation_name):
print("技能动画名不存在")
return false
var animation: Animation = ResourceLoader.load(path) as Animation
if not animation:
animation = Animation.new()
animation.resource_name = res_name
Util.refresh_animation_by_sprite_frames(path, sprite_frames, animation_name, animation)
Util.refresh_animation_lib()
skill_animation = load(path)
return true
2 years ago
func get_attack1()->AttackCfg: return attack1 if attack1 else ResourceManager.cfg_attack_normal
func get_attack1_box()->AttackBoxCfg: return attack1_box if attack1_box else ResourceManager.cfg_attack_box_normal
func get_attack2()->AttackCfg: return attack2 if attack2 else ResourceManager.cfg_attack_normal
func get_attack2_box()->AttackBoxCfg: return attack2_box if attack2_box else ResourceManager.cfg_attack_box_normal
2 years ago
func get_attack_particle(index: int)->Resource:
var res_name: String = get_res_name()
var path_index: String = "res://scene/effect/particle/%s_%d.tscn" % [res_name, index]
if ResourceLoader.exists(path_index):
attack_particle[index] = load(path_index)
else:
var path_default: String = "res://scene/effect/particle/%s.tscn" % res_name
if ResourceLoader.exists(path_default):
attack_particle[index] = load(path_default)
if index in attack_particle:
return attack_particle[index]
return null
func get_owner() -> CharacterCfg:
if not owner:
var owner_name: String = get_res_name().split("_")[0]
var path: String = "res://config/character/%s.tres" % owner_name
if ResourceLoader.exists(path):
owner = load(path) as CharacterCfg
return owner