mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(蓝水晶): 添加蓝水晶子弹追踪和分裂功能
为蓝水晶子弹添加追踪开关和速度提升属性 实现命中敌人时概率分裂钻石的功能 添加武器升华选项以增强蓝水晶能力
This commit is contained in:
@@ -2,6 +2,10 @@ extends BulletBase
|
|||||||
class_name BlueCrystalBullet
|
class_name BlueCrystalBullet
|
||||||
|
|
||||||
var tracer: EntityBase = null
|
var tracer: EntityBase = null
|
||||||
|
var canTrace: bool = true
|
||||||
|
var speedBoost: float = 0
|
||||||
|
var splitRate: float = 0
|
||||||
|
|
||||||
@onready var trail: GPUParticles2D = $%trail
|
@onready var trail: GPUParticles2D = $%trail
|
||||||
|
|
||||||
func ai():
|
func ai():
|
||||||
@@ -9,12 +13,22 @@ func ai():
|
|||||||
var tracker = tracer.getTrackingAnchor()
|
var tracker = tracer.getTrackingAnchor()
|
||||||
var targetAngle = position.angle_to_point(tracker)
|
var targetAngle = position.angle_to_point(tracker)
|
||||||
trail.rotation = - Vector2.from_angle(rotation).angle_to(Vector2.from_angle(targetAngle)) / (speed / initialSpeed)
|
trail.rotation = - Vector2.from_angle(rotation).angle_to(Vector2.from_angle(targetAngle)) / (speed / initialSpeed)
|
||||||
|
if canTrace:
|
||||||
PresetBulletAI.trace(self , tracker, 0.07)
|
PresetBulletAI.trace(self , tracker, 0.07)
|
||||||
else:
|
else:
|
||||||
trail.rotation = 0
|
trail.rotation = 0
|
||||||
speed += 0.1
|
speed += 0.1 * (1 + speedBoost)
|
||||||
PresetBulletAI.forward(self , rotation)
|
PresetBulletAI.forward(self , rotation)
|
||||||
func destroy(_beacuseMap: bool):
|
func destroy(_beacuseMap: bool):
|
||||||
var eff = EffectController.create(ComponentManager.getEffect("BlueCrystalExplosion"), global_position)
|
var eff = EffectController.create(ComponentManager.getEffect("BlueCrystalExplosion"), global_position)
|
||||||
eff.rotation = rotation
|
eff.rotation = rotation
|
||||||
eff.shot()
|
eff.shot()
|
||||||
|
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||||
|
if entity == tracer:
|
||||||
|
canTrace = false
|
||||||
|
if MathTool.rate(splitRate):
|
||||||
|
for diamond in BulletBase.generate(ComponentManager.getBullet("Diamond2"), entity, position, deg_to_rad(randf_range(0, 360))):
|
||||||
|
if diamond is Diamond2Bullet:
|
||||||
|
diamond.baseDamage = baseDamage * 0.8
|
||||||
|
diamond.parent = self
|
||||||
|
diamond.penerate += penerate
|
||||||
|
|||||||
@@ -1,18 +1,64 @@
|
|||||||
@tool
|
@tool
|
||||||
extends Weapon
|
extends Weapon
|
||||||
|
|
||||||
|
func sublimateOptions() -> Array[SublimateOption]:
|
||||||
|
return [
|
||||||
|
SublimateOption.new(
|
||||||
|
"晶核提纯",
|
||||||
|
"蓝水晶与钻石伤害+1",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("atk", 1),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.COMMON
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"钻石护盾",
|
||||||
|
"环绕钻石数量+1",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("count", 1),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.RARE
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"贯穿棱镜",
|
||||||
|
"穿透+10%",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("penerate", 0.1),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.EPIC
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"碎晶裂变",
|
||||||
|
"蓝水晶命中敌人时,有8%概率分裂出1颗钻石(伤害-20%)",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("splitRate", 0.08),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.LEGENDARY
|
||||||
|
),
|
||||||
|
SublimateOption.new(
|
||||||
|
"动能贯穿",
|
||||||
|
"蓝水晶飞行速度+10%",
|
||||||
|
func(w: Weapon, _e):
|
||||||
|
w.addStoreExtra("speed", 0.1),
|
||||||
|
1,
|
||||||
|
CategoryStore.Quality.COMMON
|
||||||
|
),
|
||||||
|
]
|
||||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||||
origin["atk"] += 2 * to * soulLevel
|
origin["atk"] += 2 * to * soulLevel
|
||||||
origin["count"] = 1 + 1 * soulLevel
|
origin["count"] = 1 + 1 * soulLevel
|
||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
for i in BulletBase.generate(ComponentManager.getBullet("BlueCrystal"), entity, entity.findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
|
for crystal in BulletBase.generate(ComponentManager.getBullet("BlueCrystal"), entity, entity.findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
|
||||||
if i is BlueCrystalBullet:
|
if crystal is BlueCrystalBullet:
|
||||||
i.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
crystal.tracer = EntityTool.findClosetEntity(get_global_mouse_position(), get_tree(), !entity.isPlayer(), entity.isPlayer())
|
||||||
i.baseDamage = readStore("atk")
|
crystal.baseDamage = readStore("atk")
|
||||||
|
crystal.penerate += readStoreExtra("penerate")
|
||||||
|
crystal.speedBoost = readStoreExtra("speed")
|
||||||
for index in readStore("count"):
|
for index in readStore("count"):
|
||||||
for j in BulletBase.generate(ComponentManager.getBullet("Diamond2"), entity, i.position, deg_to_rad(360.0 / readStore("count") * index)):
|
for diamond in BulletBase.generate(ComponentManager.getBullet("Diamond2"), entity, crystal.position, deg_to_rad(360.0 / readStore("count") * index)):
|
||||||
if j is Diamond2Bullet:
|
if diamond is Diamond2Bullet:
|
||||||
j.baseDamage = readStore("atk")
|
diamond.baseDamage = readStore("atk")
|
||||||
j.parent = i
|
diamond.parent = crystal
|
||||||
|
diamond.penerate += readStoreExtra("penerate")
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user