buff优化、反弹取消aoe

master
chendian 8 months ago
parent 047f4eb9b3
commit fd1688efa0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://dabkv6mk63mx8"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://dabkv6mk63mx8"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_q10v1"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_q10v1"]
[resource] [resource]
script = ExtResource("1_q10v1") script = ExtResource("1_q10v1")
@ -9,8 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_stop_self = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 6.0 hit_back_speed = 6.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bgqotp7ayrjc1"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bgqotp7ayrjc1"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_a550s"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_a550s"]
[resource] [resource]
script = ExtResource("1_a550s") script = ExtResource("1_a550s")
@ -9,8 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_stop_self = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 10.0 hit_back_speed = 10.0

@ -9,7 +9,6 @@ break_level = 3
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 8.0 hit_back_speed = 8.0

@ -9,7 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.0 hit_back_speed = 3.0

@ -9,7 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -9,7 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = -6.0 hit_back_speed = -6.0

@ -9,7 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 7.0 hit_back_speed = 7.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 2.0 hit_back_speed = 2.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.0 hit_back_speed = 3.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 2.0 hit_back_speed = 2.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = -2.5 hit_back_speed = -2.5

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://by6jd5xqjml2m"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://by6jd5xqjml2m"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_gadv7"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_gadv7"]
[resource] [resource]
script = ExtResource("1_gadv7") script = ExtResource("1_gadv7")
@ -9,8 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_stop_self = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 2.0 hit_back_speed = 2.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.0 hit_back_speed = 3.0

@ -9,7 +9,7 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://fjjpp1wuesoq"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://fjjpp1wuesoq"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_7y38s"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_7y38s"]
[resource] [resource]
script = ExtResource("1_7y38s") script = ExtResource("1_7y38s")
@ -9,8 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_stop_self = true
is_throw_check = true is_throw_check = true
is_throw_end = false is_throw_end = false
hit_back_speed = 2.0 hit_back_speed = 2.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = true is_throw_end = true
hit_back_speed = 7.0 hit_back_speed = 7.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bwbr746sj06er"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bwbr746sj06er"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_2fwsa"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_2fwsa"]
[resource] [resource]
script = ExtResource("1_2fwsa") script = ExtResource("1_2fwsa")
@ -9,13 +9,9 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 1 damage_type = 1
is_floating = true is_floating = true
is_rebound = true
is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.0 hit_back_speed = 3.0
hit_up_speed = 4.0 hit_up_speed = 4.0
hit_back_duration = 0.05 hit_back_duration = 0.05
hit_up_duration = 0.05 hit_up_duration = 0.05
pause_time = 0.05

@ -9,7 +9,6 @@ break_level = 3
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 15.0 hit_back_speed = 15.0

@ -9,7 +9,6 @@ break_level = 3
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 15.0 hit_back_speed = 15.0

@ -10,7 +10,7 @@ stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = false is_floating = false
is_hit_down = false is_hit_down = false
is_rebound = false
is_stop_self = true is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://qmivx7ntfrki"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://qmivx7ntfrki"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_ijso0"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_ijso0"]
[resource] [resource]
script = ExtResource("1_ijso0") script = ExtResource("1_ijso0")
@ -9,12 +9,9 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = false is_floating = false
is_rebound = false
is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.0 hit_back_speed = 3.0
hit_up_speed = 1.0 hit_up_speed = 1.0
hit_back_duration = 0.05 hit_back_duration = 0.05
hit_up_duration = 0.05 hit_up_duration = 0.05

@ -9,7 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.5 hit_back_speed = 3.5

@ -9,7 +9,7 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bvtpba01td04l"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bvtpba01td04l"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_rvnvx"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_rvnvx"]
[resource] [resource]
script = ExtResource("1_rvnvx") script = ExtResource("1_rvnvx")
@ -9,8 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 2.0 hit_back_speed = 2.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://btg40rn2f36c2"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://btg40rn2f36c2"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_4245c"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_4245c"]
[resource] [resource]
script = ExtResource("1_4245c") script = ExtResource("1_4245c")
@ -9,12 +9,9 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = false is_floating = false
is_rebound = false
is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 3.0 hit_back_speed = 3.0
hit_up_speed = 1.5 hit_up_speed = 1.5
hit_back_duration = 0.05 hit_back_duration = 0.05
hit_up_duration = 0.05 hit_up_duration = 0.05

@ -9,7 +9,6 @@ break_level = 2
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 4.5 hit_back_speed = 4.5

@ -10,7 +10,7 @@ stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_hit_down = false is_hit_down = false
is_rebound = false
is_stop_self = true is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://ckbf40c75bfqf"] [gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://ckbf40c75bfqf"]
[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_iuifx"] [ext_resource type="Script" uid="uid://bm8fn2yciam1g" path="res://script/config/attack_cfg.gd" id="1_iuifx"]
[resource] [resource]
script = ExtResource("1_iuifx") script = ExtResource("1_iuifx")
@ -9,8 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = true is_floating = true
is_rebound = false
is_stop_self = true
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -9,7 +9,6 @@ break_level = 1
stun_attack = 10.0 stun_attack = 10.0
damage_type = 0 damage_type = 0
is_floating = false is_floating = false
is_rebound = false
is_throw_check = false is_throw_check = false
is_throw_end = false is_throw_end = false
hit_back_speed = 0.0 hit_back_speed = 0.0

@ -1,15 +1,11 @@
[gd_resource type="Resource" script_class="AttackBoxCfg" load_steps=3 format=3 uid="uid://df807k1y1vequ"] [gd_resource type="Resource" script_class="AttackBoxCfg" load_steps=2 format=3 uid="uid://df807k1y1vequ"]
[ext_resource type="Script" uid="uid://dekrsow0vntqs" path="res://script/config/attack_box_cfg.gd" id="1_fstin"] [ext_resource type="Script" uid="uid://dekrsow0vntqs" path="res://script/config/attack_box_cfg.gd" id="1_fstin"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_pmh6g"]
height = 0.8
radius = 0.25
[resource] [resource]
script = ExtResource("1_fstin") script = ExtResource("1_fstin")
shape = SubResource("CylinderShape3D_pmh6g")
offset = Vector2(0, 0) offset = Vector2(0, 0)
is_throw = false is_throw = false
is_direct = false is_direct = false
is_hit_self = true is_hit_self = true
is_rebound = true

@ -8,6 +8,7 @@ class AttackInfo:
var with_stop: bool = false var with_stop: bool = false
var ignore_push: bool = false var ignore_push: bool = false
class AttackHitInfo: class AttackHitInfo:
var attack_info: AttackInfo var attack_info: AttackInfo
var hit_target: Character var hit_target: Character

@ -20,8 +20,8 @@ func init() -> void:
is_init = true is_init = true
var behavior_tree_res: BehaviorTree = status.cfg.get_ai() var behavior_tree_res: BehaviorTree = status.cfg.get_ai()
if not behavior_tree_res: if not behavior_tree_res:
print("未配置AI", character.cfg().get_res_name()) print("未配置AI:", character.cfg().get_res_name())
Global.character_mgr.destroy_character(character.id()) btPlayer.queue_free()
return return
btPlayer.behavior_tree = behavior_tree_res btPlayer.behavior_tree = behavior_tree_res
on_init() on_init()
@ -53,6 +53,7 @@ func process(delta) -> void:
status.ai_is_alert = true status.ai_is_alert = true
status.emit_status("ai_is_alert") status.emit_status("ai_is_alert")
on_process(delta) on_process(delta)
if btPlayer:
btPlayer.update(delta) btPlayer.update(delta)
func on_init() -> void: pass func on_init() -> void: pass

@ -54,8 +54,6 @@ func character_attack2() -> void:
func add_attack(attack_info: Struct.AttackInfo) -> void: func add_attack(attack_info: Struct.AttackInfo) -> void:
if not attack_info.attack or not attack_info.attack_box: if not attack_info.attack or not attack_info.attack_box:
return return
if character.has_buff("hit_ground_cd") and attack_info.attack == ResourceManager.cfg_attack_rebound:
return
var result: Character var result: Character
if attack_info.attack_box.is_throw: if attack_info.attack_box.is_throw:
var target: Character = Global.character_mgr.get_character(status.throw_target) var target: Character = Global.character_mgr.get_character(status.throw_target)
@ -65,6 +63,10 @@ func add_attack(attack_info: Struct.AttackInfo) -> void:
var target: Character = Global.character_mgr.get_character(status.target) var target: Character = Global.character_mgr.get_character(status.target)
if target: if target:
result = target result = target
elif attack_info.attack_box.is_rebound:
var target: Character = Global.character_mgr.get_character(status.id)
if target:
result = target
else: else:
battle_attack_area.refresh_attack_area(attack_info) battle_attack_area.refresh_attack_area(attack_info)
var offset_xz: Vector2 = attack_info.attack_dir * attack_info.attack_box.offset.x var offset_xz: Vector2 = attack_info.attack_dir * attack_info.attack_box.offset.x
@ -103,6 +105,7 @@ func settle(from: int, to: int, attack_info: Struct.AttackInfo) -> Struct.HitRes
var attack_dir: Vector2 = attack_info.attack_dir var attack_dir: Vector2 = attack_info.attack_dir
var with_stop: bool = attack_info.with_stop var with_stop: bool = attack_info.with_stop
var ignore_push: bool = attack_info.ignore_push var ignore_push: bool = attack_info.ignore_push
var is_rebound: bool = attack_info.attack_box.is_rebound
var hit_result: Struct.HitResultInfo = Struct.HitResultInfo.new() var hit_result: Struct.HitResultInfo = Struct.HitResultInfo.new()
var character_from: Character = Global.character_mgr.get_character(from) as Character var character_from: Character = Global.character_mgr.get_character(from) as Character
@ -123,7 +126,6 @@ func settle(from: int, to: int, attack_info: Struct.AttackInfo) -> Struct.HitRes
var is_self_on_floor: bool = character_from.get_status("is_on_floor") var is_self_on_floor: bool = character_from.get_status("is_on_floor")
var is_floating: bool = attack.is_floating or not is_on_floor var is_floating: bool = attack.is_floating or not is_on_floor
var is_rebound: bool = attack.is_rebound and (character_from == character_to)
var is_bullet: bool = int(character_from.cfg().type) == Enum.ECharacterType.Bullet var is_bullet: bool = int(character_from.cfg().type) == Enum.ECharacterType.Bullet
var is_break_shield: bool = false var is_break_shield: bool = false

@ -63,9 +63,6 @@ func on_body_entereddeferred(body: Node3D):
var character_to: Character = body as Character var character_to: Character = body as Character
if attack_id_set.has(character_to.id): if attack_id_set.has(character_to.id):
return return
if attack_info.attack.is_rebound:
if character_to != character and character_to.get_status("is_floating"):
return
var attack_hit_info: Struct.AttackHitInfo = Struct.AttackHitInfo.new() var attack_hit_info: Struct.AttackHitInfo = Struct.AttackHitInfo.new()
attack_hit_info.attack_info = attack_info attack_hit_info.attack_info = attack_info
attack_hit_info.hit_target = character_to attack_hit_info.hit_target = character_to

@ -14,48 +14,52 @@ class BuffInfo:
var ignore_pause: bool var ignore_pause: bool
var buff_map: Dictionary = {} # buff信息 var buff_map: Dictionary = {} # buff信息
var buff_tick_frame_max = 1 var delta_cache_max = 0.05
var buff_tick_frame = 0
var delta_cache: float = 0 var delta_cache: float = 0
func _ready():
buff_tick_frame_max = 1
func _process(delta): func _process(delta):
tick(delta)
delta_cache += delta delta_cache += delta
buff_tick_frame += 1 if delta_cache < delta_cache_max:
if buff_tick_frame < buff_tick_frame_max:
return return
tick(delta_cache) tick_update(delta_cache)
buff_tick_frame = 0
delta_cache = 0 delta_cache = 0
func tick(delta) -> void: func tick(delta) -> void:
for buff_name in buff_map: for buff_name in buff_map:
var buff_info = buff_map[buff_name] var buff_info = buff_map[buff_name]
if has_buff("pause") and buff_name != "pause" and !buff_info.ignore_pause:
continue
if buff_info.duration_max == -1: if buff_info.duration_max == -1:
trigger_buff_effect(buff_info, "update") continue
else:
if buff_info.duration == 0: if buff_info.duration == 0:
trigger_buff_effect(buff_info, "second") trigger_buff_effect(buff_info, "second")
buff_info.duration += delta buff_info.duration += delta
if buff_info.duration >= buff_info.duration_max: if buff_info.duration >= buff_info.duration_max:
buff_info.duration = buff_info.duration_max buff_info.duration = buff_info.duration_max
trigger_buff_effect(buff_info, "update") trigger_buff_effect_update(buff_info, delta)
remove_buff(buff_name) remove_buff(buff_name)
else:
trigger_buff_effect(buff_info, "update") func tick_update(delta) -> void:
for buff_name in buff_map:
var buff_info = buff_map[buff_name]
if has_buff("pause") and buff_name != "pause" and !buff_info.ignore_pause:
continue
trigger_buff_effect_update(buff_info, delta)
func trigger_buff_effect(buff: BuffInfo, trigger_name: String): func trigger_buff_effect(buff: BuffInfo, trigger_name: String):
var buff_name: String = buff.name var buff_name: String = buff.name
var function_name: String = "on_%s_%s" % [trigger_name, buff_name] var function_name: String = "on_%s_%s" % [trigger_name, buff_name]
if has_method(function_name): if has_method(function_name):
var rate: float = buff.duration / buff.duration_max call(function_name)
call(function_name, rate)
func trigger_buff_effect_update(buff: BuffInfo, delta: float):
var buff_name: String = buff.name
var function_name: String = "on_update_%s" % [buff_name]
if has_method(function_name):
var rate: float = 0
if buff.duration_max > 0:
rate = buff.duration / buff.duration_max
call(function_name, delta, rate)
func has_buff(buff_name: String) -> bool: func has_buff(buff_name: String) -> bool:
return buff_name in buff_map return buff_name in buff_map
@ -84,95 +88,107 @@ func remove_buff(buff_name: String):
#==具体实现== #==具体实现==
#位移 #位移
func on_end_hit_back(_rate) -> void: status.set_status("hit_back_speed", 0) func on_end_hit_back() -> void:
status.set_status("hit_back_speed", 0)
func on_end_hit_up(_rate) -> void: status.set_status("hit_up_speed", 0) func on_end_hit_up() -> void:
status.set_status("hit_up_speed", 0)
func on_start_jumping(_rate) -> void: status.set_status("is_jumping", true) func on_start_jumping() -> void:
status.set_status("is_jumping", true)
func on_end_jumping(_rate) -> void: status.set_status("is_jumping", false) func on_end_jumping() -> void:
status.set_status("is_jumping", false)
func on_start_rising(_rate) -> void: status.set_status("is_rising", true) func on_start_rising() -> void:
status.set_status("is_rising", true)
func on_end_rising(_rate) -> void: status.set_status("is_rising", false) func on_end_rising() -> void:
status.set_status("is_rising", false)
func on_start_floating(_rate) -> void: func on_start_floating() -> void:
status.set_status("is_floating", true) status.set_status("is_floating", true)
add_buff("rising", 0.1) add_buff("rising", 0.1)
func on_update_floating(_rate) -> void: func on_update_floating(_delta, _rate) -> void:
if not status.is_on_floor or status.is_rising: if not status.is_on_floor or status.is_rising:
return return
remove_buff("floating") remove_buff("floating")
add_buff("stagger", 3) add_buff("stagger", 3)
func on_end_floating(_rate) -> void: status.set_status("is_floating", false) func on_end_floating() -> void:
status.set_status("is_floating", false)
#战斗状态 #战斗状态
func on_start_die(_rate) -> void: func on_start_die() -> void:
status.set_status("is_dead", true) status.set_status("is_dead", true)
SignalManager.character_die.emit(status.id) SignalManager.character_die.emit(status.id)
func on_end_die(_rate) -> void: add_buff("die2", -1) func on_end_die() -> void:
add_buff("die2", -1)
func on_update_die2(_rate) -> void: if status.is_on_floor and not status.is_rising: remove_buff("die2") func on_update_die2(_delta, _rate) -> void:
if status.is_on_floor and not status.is_rising: remove_buff("die2")
func on_end_die2(_rate) -> void: func on_end_die2() -> void:
effect.cast_corpse() effect.cast_corpse()
Global.character_mgr.destroy_character(status.id) Global.character_mgr.destroy_character(status.id)
func on_start_stagger(_rate) -> void: func on_start_stagger() -> void:
status.set_status("is_stagger", true) status.set_status("is_stagger", true)
status.set_skill_break_level_add(-1) status.set_skill_break_level_add(-1)
func on_end_stagger(_rate) -> void: func on_end_stagger() -> void:
status.set_status("is_stagger", false) status.set_status("is_stagger", false)
status.set_skill_break_level_add(0) status.set_skill_break_level_add(0)
func on_end_shield_recover_cd(_rate) -> void: add_buff("shield_recover", -1) func on_end_shield_recover_cd() -> void:
add_buff("shield_recover", -1)
func on_update_shield_recover(_rate) -> void: func on_update_shield_recover(delta, _rate) -> void:
var shield_add: float = get_process_delta_time() * status.cfg.shield.recover_speed var shield_add: float = delta * status.cfg.shield.recover_speed
shield_add = min(status.shield_max - status.shield, shield_add) shield_add = min(status.shield_max - status.shield, shield_add)
if shield_add == status.shield_max - status.shield: if shield_add == status.shield_max - status.shield:
remove_buff("shield_recover") remove_buff("shield_recover")
character.set_shield(status.shield + shield_add) character.set_shield(status.shield + shield_add)
func on_end_mp_recover_cd(_rate) -> void: add_buff("mp_recover", 0.1) func on_end_mp_recover_cd() -> void:
add_buff("mp_recover", 0.1)
func on_update_mp_recover(_rate) -> void: func on_update_mp_recover(delta, _rate) -> void:
var mp_add: float = get_process_delta_time() * status.cfg.mp.recover_speed var mp_add: float = delta * status.cfg.mp.recover_speed
character.add_mp_sub(mp_add, false) character.add_mp_sub(mp_add, false)
func on_update_charging(_rate) -> void: func on_update_charging(delta, _rate) -> void:
var mp_add: float = get_process_delta_time() * status.cfg.mp.charging_speed var mp_add: float = delta * status.cfg.mp.charging_speed
character.add_mp_sub(mp_add, true) character.add_mp_sub(mp_add, true)
func on_end_stun_recover_break_cd(_rate) -> void: add_buff("stun_recover_break", -1) func on_end_stun_recover_break_cd() -> void:
add_buff("stun_recover_break", -1)
func on_update_stun_recover_break(_rate) -> void: func on_update_stun_recover_break(delta, _rate) -> void:
var stun_sub: float = get_process_delta_time() * status.cfg.stun.recover_break_speed var stun_sub: float = delta * status.cfg.stun.recover_break_speed
stun_sub = min(status.stun, stun_sub) stun_sub = min(status.stun, stun_sub)
status.set_status("stun", status.stun - stun_sub) status.set_status("stun", status.stun - stun_sub)
if status.stun == 0: if status.stun == 0:
@ -180,21 +196,23 @@ func on_update_stun_recover_break(_rate) -> void:
status.set_status("is_stun", false) status.set_status("is_stun", false)
func on_end_stun_recover_cd(_rate) -> void: add_buff("stun_recover", -1) func on_end_stun_recover_cd() -> void:
add_buff("stun_recover", -1)
func on_update_stun_recover(_rate) -> void: func on_update_stun_recover(delta, _rate) -> void:
var stun_sub: float = get_process_delta_time() * status.cfg.stun.recover_speed var stun_sub: float = delta * status.cfg.stun.recover_speed
stun_sub = min(status.stun, stun_sub) stun_sub = min(status.stun, stun_sub)
status.set_status("stun", status.stun - stun_sub) status.set_status("stun", status.stun - stun_sub)
if status.stun == 0: if status.stun == 0:
remove_buff("stun_recover") remove_buff("stun_recover")
func on_update_weapon_index_change(rate) -> void: status.set_status("weapon_index_change_rate", rate) func on_update_weapon_index_change(_delta, rate) -> void:
status.set_status("weapon_index_change", rate)
func on_end_weapon_index_change(_rate) -> void: func on_end_weapon_index_change() -> void:
var weapon_index: int = status.weapon_index + status.weapon_index_change_dir var weapon_index: int = status.weapon_index + status.weapon_index_change_dir
var weapon_len: int = len(status.weapon_list) var weapon_len: int = len(status.weapon_list)
weapon_index = (weapon_index % weapon_len + weapon_len) % weapon_len weapon_index = (weapon_index % weapon_len + weapon_len) % weapon_len
@ -203,43 +221,50 @@ func on_end_weapon_index_change(_rate) -> void:
#表现 #表现
func on_start_freeze(_rate) -> void: func on_start_freeze() -> void:
status.set_status("is_pause", true) status.set_status("is_pause", true)
func on_end_freeze(_rate) -> void: func on_end_freeze() -> void:
status.set_status("is_pause", false) status.set_status("is_pause", false)
func on_second_pause(_rate) -> void: func on_second_pause() -> void:
status.set_status("is_pause", true) status.set_status("is_pause", true)
func on_end_pause(_rate) -> void: func on_end_pause() -> void:
status.set_status("is_pause", false) status.set_status("is_pause", false)
func on_start_flash_white(_rate) -> void: status.set_status("flash_white_rate", 1) func on_start_flash_white() -> void:
status.set_status("flash_white", 1)
func on_update_flash_white(rate) -> void: status.set_status("flash_white_rate", 1 - rate) func on_update_flash_white(_delta, rate) -> void:
status.set_status("flash_white", 1 - rate)
func on_end_flash_white(_rate) -> void: status.set_status("flash_white_rate", 0) func on_end_flash_white() -> void:
status.set_status("flash_white", 0)
func on_update_shake_x(rate) -> void: func on_update_shake_x(_delta, rate) -> void:
var shake_rate: float = 0.5 * status.pause_time var shake: float = 0.5 * status.pause_time
status.set_status("shake_offset", Vector3((sin(rate * PI * 6) - 0.5) * shake_rate, 0, 0)) status.set_status("shake_offset", Vector3((sin(rate * PI * 6) - 0.5) * shake, 0, 0))
func on_end_shake_x(_rate) -> void: status.set_status("shake_offset", Vector3.ZERO) func on_end_shake_x() -> void:
status.set_status("shake_offset", Vector3.ZERO)
func on_start_deformation(_rate) -> void: status.set_status("deformation_rate", 1) func on_start_deformation() -> void:
status.set_status("deformation", 1)
func on_update_deformation(rate) -> void: status.set_status("deformation_rate", 1 - rate) func on_update_deformation(_delta, rate) -> void:
status.set_status("deformation", 1 - rate)
func on_end_deformation(_rate) -> void: status.set_status("deformation_rate", 0) func on_end_deformation() -> void:
status.set_status("deformation", 0)

@ -6,3 +6,4 @@ class_name AttackBoxCfg
@export var is_throw: bool #是否投技(只命中投技目标) @export var is_throw: bool #是否投技(只命中投技目标)
@export var is_direct: bool #是否直接命中 @export var is_direct: bool #是否直接命中
@export var is_hit_self: bool #是否命中自己 @export var is_hit_self: bool #是否命中自己
@export var is_rebound: bool #是否地面反弹技能

@ -8,7 +8,6 @@ class_name AttackCfg
@export_group("类型标记") @export_group("类型标记")
@export var damage_type: Enum.EDamageType = Enum.EDamageType.Sharp # 伤害类型 @export var damage_type: Enum.EDamageType = Enum.EDamageType.Sharp # 伤害类型
@export var is_floating: bool #是否浮空技 @export var is_floating: bool #是否浮空技
@export var is_rebound: bool #是否地面反弹技能
@export var is_throw_check: bool #是否投技检测 @export var is_throw_check: bool #是否投技检测
@export var is_throw_end: bool #是否投技最后一段(释放投技目标) @export var is_throw_end: bool #是否投技最后一段(释放投技目标)
@export_group("强制位移") @export_group("强制位移")

Loading…
Cancel
Save