mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 08:21:54 +08:00
feat(角色): 添加Gobo角色及相关资源
添加Gobo角色,包括武器、召唤物和治疗导弹功能 - 新增Gobo角色模型和动画资源 - 实现Gobo武器系统,可召唤Gobo单位 - 添加治疗导弹功能,Gobo受伤时会发射治疗友军 - 优化实体基础类,添加生命值初始化方法 - 修改子弹伤害判定逻辑,支持友军伤害设置
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
extends BulletBase
|
||||
class_name HealingMissleBullet
|
||||
|
||||
func ai():
|
||||
PresetBulletAI.forward(self, rotation)
|
||||
@@ -0,0 +1 @@
|
||||
uid://d2ubbdwexom6t
|
||||
@@ -0,0 +1,32 @@
|
||||
extends SummonBase
|
||||
class_name GoboSummon
|
||||
|
||||
var percent: float = 0.0
|
||||
var healthSinceLastLaunch: float = 0
|
||||
|
||||
func initHealth(maxHealth: float):
|
||||
super.initHealth(maxHealth)
|
||||
healthSinceLastLaunch = maxHealth
|
||||
|
||||
func register():
|
||||
fields[FieldStore.Entity.MOVEMENT_SPEED] = 1.5
|
||||
healthChanged.connect(
|
||||
func(newHealth):
|
||||
if healthSinceLastLaunch - newHealth >= 1:
|
||||
launch()
|
||||
healthSinceLastLaunch = newHealth
|
||||
)
|
||||
func ai():
|
||||
var target = BulletTool.findClosetBulletCanDamage(position, get_tree(), self)
|
||||
if is_instance_valid(target):
|
||||
move(target.position - position)
|
||||
|
||||
func launch():
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("HealingMissle"),
|
||||
self,
|
||||
position,
|
||||
position.angle_to_point(EntityTool.findClosetEntity(myMaster.position, get_tree(), isPlayer(), !isPlayer(), [self]).position)
|
||||
):
|
||||
if bullet is HealingMissleBullet:
|
||||
bullet.baseDamage = health * percent * -1
|
||||
@@ -0,0 +1 @@
|
||||
uid://cqax27sw0wlme
|
||||
@@ -0,0 +1,13 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["health"] += 5 * to * soulLevel
|
||||
origin["percent"] += 0.02 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var gobo = entity.summon(ComponentManager.getSummon("Gobo"))
|
||||
if gobo is GoboSummon:
|
||||
gobo.percent = readStore("percent")
|
||||
gobo.initHealth(readStore("health"))
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://cbg3xkg1giv35
|
||||
@@ -7,7 +7,6 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var summon = entity.summon(ComponentManager.getSummon("Shield"))
|
||||
if !summon: return true
|
||||
summon.fields[FieldStore.Entity.MAX_HEALTH] = readStore("atk")
|
||||
summon.health = summon.fields[FieldStore.Entity.MAX_HEALTH]
|
||||
if summon:
|
||||
summon.initHealth(readStore("atk"))
|
||||
return true
|
||||
|
||||
@@ -10,7 +10,7 @@ class_name BulletBase
|
||||
@export var penerateDamageReduction: float = 0.0
|
||||
@export var lifeDistance: float = -1 # -1表示无限距离
|
||||
@export var lifeTime: float = -1 # -1表示无限时间
|
||||
@export var indisDamage: bool = false # 是否无差别伤害(不区分敌我)
|
||||
@export var allowFriendlyDamage: bool = false # 是否无差别伤害(不区分敌我)
|
||||
@export var canDamageSelf: bool = false # 是否可以伤害发射者
|
||||
@export var autoSpawnAnimation: bool = false
|
||||
@export var autoLoopAnimation: bool = false
|
||||
|
||||
@@ -200,6 +200,10 @@ func _physics_process(_delta: float) -> void:
|
||||
trailParticle.emitting = trailing
|
||||
|
||||
# 通用方法
|
||||
func initHealth(maxHealth: float):
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = maxHealth
|
||||
health = maxHealth
|
||||
statebar.forceSync()
|
||||
func rebuildWeaponIcons():
|
||||
if isPlayer():
|
||||
for i in UIState.skillIconContainer.get_children():
|
||||
|
||||
@@ -8,9 +8,12 @@ static func fromArea(area: Area2D) -> BulletBase:
|
||||
static func canDamage(bullet: BulletBase, target: EntityBase) -> bool:
|
||||
if !bullet or !target or !bullet.launcher: return false
|
||||
if target.currentInvinsible: return false
|
||||
if !bullet.canDamageSelf && target == bullet.launcher: return false
|
||||
if !GameRule.allowFriendlyFire:
|
||||
if target.isPlayer() == bullet.launcher.isPlayer() and bullet.launcher.currentFocusedBoss != target: return false
|
||||
if target.isPlayer() == bullet.launcher.isPlayer() and bullet.launcher.currentFocusedBoss != target and !bullet.allowFriendlyDamage:
|
||||
return false
|
||||
if !bullet.canDamageSelf:
|
||||
if target == bullet.launcher:
|
||||
return false
|
||||
return true
|
||||
static func findClosetBullet(to: Vector2, fromTree: SceneTree) -> BulletBase:
|
||||
var result: BulletBase = null
|
||||
|
||||
Reference in New Issue
Block a user