mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-22 03:22:30 +08:00
feat(武器系统): 优化LGBT武器和召唤物行为
- 增加LGBT武器的冷却时间从0.1到1000 - 召唤物现在会继承召唤者位置 - 优化子弹追踪逻辑和生命周期 - 修复召唤物AI行为和玩家状态检测 - 调整召唤物属性和攻击冷却时间
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_bnhy4"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2pndtow16635" path="res://resources/bullets/lgbt-bullet/造型2.svg" id="2_cnsbx"]
|
||||
[ext_resource type="Script" path="res://scripts/Contents/Bullets/LGBTBullet.gd" id="2_iakgr"]
|
||||
[ext_resource type="Script" path="res://scripts/Statemachine/LeadingMark.gd" id="3_rirwy"]
|
||||
[ext_resource type="Script" uid="uid://b1y68fg5fwdnj" path="res://scripts/Contents/Bullets/LGBTBullet.gd" id="2_iakgr"]
|
||||
[ext_resource type="Script" uid="uid://clyli5ui8nysk" path="res://scripts/Statemachine/LeadingMark.gd" id="3_rirwy"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_1e8f0"]
|
||||
radius = 12.3693
|
||||
@@ -80,7 +80,7 @@ alpha_curve = SubResource("CurveTexture_tnhr3")
|
||||
|
||||
[node name="LGBTBullet" instance=ExtResource("1_bnhy4")]
|
||||
script = ExtResource("2_iakgr")
|
||||
lifeTime = 2000.0
|
||||
lifeTime = 5000.0
|
||||
|
||||
[node name="texture" parent="." index="0"]
|
||||
rotation = 1.5708
|
||||
@@ -99,5 +99,5 @@ process_material = SubResource("ParticleProcessMaterial_4q0mc")
|
||||
[node name="particles2" type="GPUParticles2D" parent="." index="3"]
|
||||
z_index = -1
|
||||
amount = 30
|
||||
process_material = SubResource("ParticleProcessMaterial_xktft")
|
||||
texture = ExtResource("2_cnsbx")
|
||||
process_material = SubResource("ParticleProcessMaterial_xktft")
|
||||
|
||||
@@ -6,3 +6,5 @@
|
||||
[node name="LGBTFlag" instance=ExtResource("1_fktqv")]
|
||||
script = ExtResource("2_6d456")
|
||||
attraction = 0.5
|
||||
|
||||
[node name="normal" type="Node2D" parent="texture/weapons" index="0"]
|
||||
|
||||
@@ -29,7 +29,7 @@ storeType = {
|
||||
}
|
||||
descriptionTemplate = "每$angle发射1/$count条以$power效率追踪$trace秒的[b]七彩光标[/b],每条造成$atk点伤害。"
|
||||
needEnergy = 25.0
|
||||
cooldown = 0.1
|
||||
cooldown = 1000.0
|
||||
|
||||
[node name="attack" parent="sounds" index="0"]
|
||||
stream = ExtResource("4_c5xse")
|
||||
|
||||
@@ -5,18 +5,20 @@ var maxTraceTime: float = 0
|
||||
var tracePower: float = 0
|
||||
|
||||
func register():
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = 100
|
||||
attackCooldownMap[0] = 500
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = 500
|
||||
attackCooldownMap[0] = 250
|
||||
func ai():
|
||||
tryAttack(0)
|
||||
func attack(type):
|
||||
if type == 0:
|
||||
var tracer = EntityTool.findClosetEntity(position, get_tree(), false, true)
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("LGBTBullet"),
|
||||
self,
|
||||
findWeaponAnchor("normal"),
|
||||
position.angle_to_point(EntityTool.findClosetEntity(position, get_tree(), false, true).position)
|
||||
position.angle_to_point(tracer.position)
|
||||
):
|
||||
bullet.tracer = tracer
|
||||
bullet.damage = atk
|
||||
bullet.maxTraceTime = maxTraceTime
|
||||
bullet.tracePower = tracePower
|
||||
|
||||
@@ -8,7 +8,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["trace"] += 0.25 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var summon = entity.summon(ComponentManager.getSummon("LGBTFlag"))
|
||||
var summon = entity.summon(ComponentManager.getSummon("LGBTFlag"), true)
|
||||
summon.atk = readStore("atk")
|
||||
summon.maxTraceTime = readStore("trace") * 1000
|
||||
summon.tracePower = readStore("power")
|
||||
|
||||
@@ -118,9 +118,10 @@ func _ready():
|
||||
weapons.append(i)
|
||||
weaponBag.append(i.displayName)
|
||||
statebar.levelLabels.hide()
|
||||
UIState.player = self
|
||||
if !is_instance_valid(UIState.player): UIState.player = self
|
||||
energyChanged.connect(
|
||||
func(newEnergy, dontChangeDirection):
|
||||
if !UIState.player == self: return
|
||||
UIState.energyPercent.maxValue = fields.get(FieldStore.Entity.MAX_ENERGY)
|
||||
if dontChangeDirection:
|
||||
UIState.energyPercent.currentValue = newEnergy
|
||||
@@ -129,8 +130,6 @@ func _ready():
|
||||
)
|
||||
rebuildWeaponIcons()
|
||||
else:
|
||||
if !currentFocusedBoss:
|
||||
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
|
||||
applyLevel()
|
||||
health = fields.get(FieldStore.Entity.MAX_HEALTH)
|
||||
energy = fields.get(FieldStore.Entity.MAX_ENERGY)
|
||||
@@ -158,6 +157,8 @@ func _process(_delta):
|
||||
if is_instance_valid(statebar):
|
||||
statebar.levelLabel.text = str(level)
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if !isPlayer() && !currentFocusedBoss:
|
||||
currentFocusedBoss = MathTool.randc_from(get_tree().get_nodes_in_group("players"))
|
||||
animatree.set("parameters/blend_position", lerpf(animatree.get("parameters/blend_position"), lastDirection, 0.2))
|
||||
if sprinting:
|
||||
if sprintAi():
|
||||
@@ -166,6 +167,8 @@ func _physics_process(_delta: float) -> void:
|
||||
velocity = Vector2.ZERO
|
||||
if (isPlayer() or is_instance_valid(currentFocusedBoss)) and not charginup and canRunAi:
|
||||
ai()
|
||||
elif isSummon():
|
||||
ai()
|
||||
move_and_slide()
|
||||
storeEnergy(randf_range(0.01, 0.05 + fields.get(FieldStore.Entity.ENERGY_REGENERATION) - 1), true)
|
||||
trailParticle.emitting = trailing
|
||||
@@ -255,13 +258,13 @@ func useEnergy(value: float):
|
||||
return state
|
||||
func tryAttack(type: int, needChargeUp: bool = false):
|
||||
var weapon: Weapon
|
||||
if isPlayer():
|
||||
if isPlayer() and !isSummon():
|
||||
if len(weapons) > type:
|
||||
weapon = weapons[type]
|
||||
else:
|
||||
return
|
||||
var state
|
||||
if isPlayer():
|
||||
if isPlayer() and !isSummon():
|
||||
state = true
|
||||
else:
|
||||
var cooldownTimer: CooldownTimer
|
||||
@@ -275,7 +278,7 @@ func tryAttack(type: int, needChargeUp: bool = false):
|
||||
charginup = true
|
||||
await EffectController.create(ComponentManager.getEffect("AttackStar"), damageAnchor.global_position).shot()
|
||||
charginup = false
|
||||
if isPlayer():
|
||||
if isPlayer() and !isSummon():
|
||||
if await weapon.tryAttack(self):
|
||||
weapon.playSound("attack")
|
||||
else:
|
||||
@@ -376,6 +379,7 @@ func getItem(items: Dictionary):
|
||||
inventory[item] = clamp(inventory[item] + items[item], 0, inventoryMax[item])
|
||||
func summon(who: PackedScene, syncFields: bool = true, lockValue: bool = true) -> SummonBase:
|
||||
var instance: SummonBase = who.instantiate()
|
||||
instance.position = position
|
||||
instance.myMaster = self
|
||||
if isPlayer(): instance.add_to_group("players")
|
||||
if syncFields:
|
||||
@@ -393,6 +397,8 @@ func getTrackingAnchor() -> Vector2:
|
||||
# 关于分组
|
||||
func isPlayer():
|
||||
return is_in_group("players")
|
||||
func isSummon():
|
||||
return self is SummonBase
|
||||
|
||||
# 抽象方法,实际上是一些钩子,不需要全部实现
|
||||
func ai():
|
||||
|
||||
@@ -6,9 +6,8 @@ class_name SummonBase
|
||||
var myMaster: EntityBase = null
|
||||
|
||||
func _ready():
|
||||
super._ready()
|
||||
for entity in get_tree().get_nodes_in_group("mobs"):
|
||||
var ent = entity as EntityBase
|
||||
if MathTool.rate(attraction):
|
||||
ent.currentFocusedBoss = self
|
||||
if is_instance_valid(myMaster):
|
||||
myMaster.died.connect(tryDie)
|
||||
|
||||
Reference in New Issue
Block a user