锁定优化

master
chendian 1 year ago
parent ff96123068
commit 3c57d1ad39

@ -5,13 +5,15 @@
[resource]
script = ExtResource("1_egjnk")
damage_rate = 1.0
break_level = 2
break_level = 1
stun_attack = 10.0
damage_type = 1
is_floating = false
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 3.0
hit_up_speed = 3.0
hit_back_duration = 0.05

@ -12,6 +12,8 @@ is_floating = true
is_hit_down = false
is_rebound = false
is_stop_self = true
is_throw_check = false
is_throw_end = false
hit_back_speed = 3.5
hit_up_speed = 3.0
hit_back_duration = 0.05

@ -3,7 +3,7 @@
[ext_resource type="Resource" uid="uid://dx54fjf5t0uu8" path="res://config/character_move/normal.tres" id="1_ol2gy"]
[ext_resource type="Resource" uid="uid://dpajmgrlaytah" path="res://config/character_mp/normal.tres" id="2_kkpsf"]
[ext_resource type="Script" path="res://script/config/character_cfg.gd" id="3_0gem5"]
[ext_resource type="Resource" uid="uid://h1curvk64vm3" path="res://config/character_shield/none.tres" id="4_tuve4"]
[ext_resource type="Resource" uid="uid://dlaekoamystx3" path="res://config/character_shield/normal.tres" id="4_3daai"]
[ext_resource type="SpriteFrames" uid="uid://bvcrc6bbufwqv" path="res://resource/animation/character/monster03_move.aseprite" id="5_4dnud"]
[ext_resource type="Resource" uid="uid://cac6mk6g078vn" path="res://config/character_stun/normal.tres" id="6_ar00t"]
@ -15,7 +15,7 @@ sprite_frames = ExtResource("5_4dnud")
sprite_harf_height = 26
sprite_width = 16
move = ExtResource("1_ol2gy")
shield = ExtResource("4_tuve4")
shield = ExtResource("4_3daai")
stun = ExtResource("6_ar00t")
mp = ExtResource("2_kkpsf")
hp_max = 100.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 242 B

@ -6,6 +6,7 @@ func execute(character: Character, target: Character, blackboard: Blackboard) ->
var status: Status = character.status
var dir: Vector2 = target.pos2D() - character.pos2D()
if status.is_skill_running:
if int(status.break_level) < Enum.EBreakLevel.Break:
character.move_to(dir)
return RUNNING
var dist: float = dir.length()

@ -112,6 +112,7 @@ func add_attack(from: int, to: int, dir: Vector2, attack: AttackCfg) -> HitResul
var is_block: bool = false
var is_kill: bool = false
var is_break_skill: bool = false
var is_break_skill_real: bool = false
var pause_time: float = attack.pause_time
var is_remote: bool = character_from != character_from.get_character_owner()
@ -122,12 +123,16 @@ func add_attack(from: int, to: int, dir: Vector2, attack: AttackCfg) -> HitResul
var break_level_def: int = cfg_to.shield.break_level_on if has_shield else cfg_to.shield.break_level_off
break_level_def += character_to.get_status("skill_break_level_add")
var break_level_sub: int = clampi(attack.break_level - break_level_def, 0, 3)
is_break_skill = break_level_sub > 0
is_break_skill_real = break_level_sub > 0
is_break_skill = is_break_skill_real or not character_to.get_status("is_on_floor")
if break_level_sub < 0:
damage = 0
elif break_level_sub == 0:
damage *= 0.5
is_floating = is_break_skill and is_floating
is_hit_down = is_break_skill and is_hit_down
#造成伤害
if has_shield:
damage = min(shield, damage)
@ -215,6 +220,8 @@ func add_attack(from: int, to: int, dir: Vector2, attack: AttackCfg) -> HitResul
hit_back_speed = max(hit_back_limit_curve.sample(dist), hit_back_speed)
if is_hit_down:
character_to.add_buff("hit_down", -1)
elif not is_break_skill_real:
hit_up_speed *= 0.75
character_to.set_hit_move(dir, hit_back_speed, hit_up_speed)
character_to.add_buff("hit_back", attack.hit_back_duration)

@ -28,15 +28,12 @@ func init(id: int, cfg: CharacterCfg, team: Enum.ETeam, owner_id: int):
func init_after():
var cfg: CharacterCfg = status.cfg as CharacterCfg
set_status("hp_max", cfg.hp_max)
set_status("hp", cfg.hp_max)
set_status("shield_max", cfg.shield.shield_max)
set_status("shield", cfg.shield.shield_max)
set_status("stun_max", cfg.stun.stun_max)
set_status("stun", 0)
set_status("mp_max", cfg.mp.mp_max)
set_status("mp", 0)
set_status("mp_sub_max", cfg.mp.mp_sub_max)
set_status("mp_sub", 0)
set_status("hp", cfg.hp_max)
set_shield(cfg.shield.shield_max)
add_mp_sub(0, true)

@ -7,17 +7,33 @@ class_name PlayerAction
@onready var combo: Combo = (%Combo as Combo)
var is_lock_pressed: bool
var lock_cd_dict: Dictionary = {}
func _process(delta) -> void:
var has_target: bool = status.target != 0
for key in lock_cd_dict:
if lock_cd_dict[key] > 0:
lock_cd_dict[key] -= delta
else:
lock_cd_dict.erase(key)
if is_lock_pressed == has_target:
return
if is_lock_pressed:
var enemy_list: Array[Character] = Global.character_mgr.get_enemy_list(character.id())
var pos_player: Vector2 = character.pos2D()
enemy_list.sort_custom(
func(a: Character, b: Character):
var a_lock_cd: bool = a.id() in lock_cd_dict
var b_lock_cd: bool = b.id() in lock_cd_dict
if a_lock_cd != b_lock_cd:
return b_lock_cd
return a.pos2D().distance_squared_to(pos_player) < b.pos2D().distance_squared_to(pos_player)
)
if enemy_list:
character.set_target(enemy_list[0].id())
else:
lock_cd_dict[character.target()] = 1 #1秒内无法再次锁定
character.set_target(0)

Loading…
Cancel
Save