mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(武器): 为弓武器添加生命汲取和升华选项
添加生命汲取效果,使箭矢命中时回复生命值 实现弓武器的升华系统,包含5种不同品质的强化选项 调整攻击逻辑以支持升华效果和生命值相关的伤害加成
This commit is contained in:
@@ -6,6 +6,7 @@ class_name Arrow
|
|||||||
var atk: float = 0
|
var atk: float = 0
|
||||||
var waitTime: float = 0
|
var waitTime: float = 0
|
||||||
var offsetRotation: float = 0
|
var offsetRotation: float = 0
|
||||||
|
var lifesteal: float = 0.2
|
||||||
|
|
||||||
func register():
|
func register():
|
||||||
trail.emitting = false
|
trail.emitting = false
|
||||||
@@ -23,6 +24,7 @@ func ai():
|
|||||||
PresetBulletAI.forward(self , rotation)
|
PresetBulletAI.forward(self , rotation)
|
||||||
if speed < 1:
|
if speed < 1:
|
||||||
tryDestroy()
|
tryDestroy()
|
||||||
func succeedToHit(_dmg: float, _entity: EntityBase):
|
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||||
var effect = EffectController.create(ComponentManager.getEffect("ShootBlood"), position)
|
var effect = EffectController.create(ComponentManager.getEffect("ShootBlood"), position)
|
||||||
effect.shot()
|
effect.shot()
|
||||||
|
entity.heal(lifesteal)
|
||||||
|
|||||||
@@ -4,20 +4,22 @@ class_name Bow
|
|||||||
var count: int = 0
|
var count: int = 0
|
||||||
var atk: float = 0
|
var atk: float = 0
|
||||||
var waitTime: float = 2000
|
var waitTime: float = 2000
|
||||||
|
var lifesteal: float = 0.2
|
||||||
|
|
||||||
func spawn():
|
func spawn():
|
||||||
var startAngle = rotation - deg_to_rad(count * 10.0 / 2)
|
var startAngle = rotation - deg_to_rad(count * 10.0 / 2)
|
||||||
for c in count:
|
for c in count:
|
||||||
for i in BulletBase.generate(
|
for bullet in BulletBase.generate(
|
||||||
ComponentManager.getBullet("Arrow"),
|
ComponentManager.getBullet("Arrow"),
|
||||||
launcher,
|
launcher,
|
||||||
position,
|
position,
|
||||||
startAngle
|
startAngle
|
||||||
):
|
):
|
||||||
var bullet: Arrow = i
|
if bullet is Arrow:
|
||||||
bullet.atk = atk
|
bullet.atk = atk
|
||||||
bullet.waitTime = waitTime
|
bullet.waitTime = waitTime
|
||||||
bullet.offsetRotation = deg_to_rad(c * 10.0)
|
bullet.offsetRotation = deg_to_rad(c * 10.0)
|
||||||
|
bullet.lifesteal = lifesteal
|
||||||
await TickTool.millseconds(waitTime)
|
await TickTool.millseconds(waitTime)
|
||||||
tryDestroy()
|
tryDestroy()
|
||||||
func ai():
|
func ai():
|
||||||
|
|||||||
@@ -1,6 +1,50 @@
|
|||||||
@tool
|
@tool
|
||||||
extends Weapon
|
extends Weapon
|
||||||
|
|
||||||
|
func sublimateOptions() -> Array[SublimateOption]:
|
||||||
|
return [
|
||||||
|
SublimateOption.new(
|
||||||
|
"破风之翎",
|
||||||
|
"伤害+15%",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("atk", 0.15),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.COMMON
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"嗜血",
|
||||||
|
"伤害倍率+40%,但额外消耗1点生命值",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("atk", 0.4)
|
||||||
|
w.addStoreExtra("self", 1),
|
||||||
|
2,
|
||||||
|
CategoryStore.Quality.LEGENDARY
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"风行者",
|
||||||
|
"鸡毛箭出手速度+5%",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("initSpeed", 0.05),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.RARE
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"破釜沉舟",
|
||||||
|
"每失去5%生命值,伤害+6%",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("missAtk", 0.06),
|
||||||
|
2,
|
||||||
|
CategoryStore.Quality.EPIC
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"生命汲取",
|
||||||
|
"鸡毛箭命中时回复0.2点生命值",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("lifesteal", 0.2),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.COMMON
|
||||||
|
),
|
||||||
|
]
|
||||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||||
origin["atk"] += 0.1 * to * soulLevel
|
origin["atk"] += 0.1 * to * soulLevel
|
||||||
origin["count"] = 1 * soulLevel
|
origin["count"] = 1 * soulLevel
|
||||||
@@ -9,13 +53,15 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
entity.takeDamage(readStore("self"))
|
entity.takeDamage(readStore("self"))
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
for i in BulletBase.generate(
|
for bullet in BulletBase.generate(
|
||||||
ComponentManager.getBullet("Bow"),
|
ComponentManager.getBullet("Bow"),
|
||||||
entity,
|
entity,
|
||||||
weaponPos,
|
weaponPos,
|
||||||
weaponPos.angle_to_point(get_global_mouse_position())
|
weaponPos.angle_to_point(get_global_mouse_position())
|
||||||
):
|
):
|
||||||
var bullet: Bow = i
|
if bullet is Bow:
|
||||||
bullet.count = readStore("count")
|
bullet.count = readStore("count")
|
||||||
bullet.atk = readStore("atk")
|
bullet.atk = readStore("atk") * (1 + (1 - entity.getHealthPercent()) * readStoreExtra("missAtk"))
|
||||||
|
bullet.speed *= 1 + readStoreExtra("initSpeed")
|
||||||
|
bullet.lifesteal = readStoreExtra("lifesteal")
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user