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:
@@ -0,0 +1,5 @@
|
||||
extends BulletBase
|
||||
class_name CursorKnifeBullet
|
||||
|
||||
func ai():
|
||||
PresetBulletAI.forward(self , rotation)
|
||||
@@ -0,0 +1 @@
|
||||
uid://c337id4kvvj58
|
||||
@@ -0,0 +1,18 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 2 * to * soulLevel
|
||||
origin["speed"] += 0.004 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
attackSpeed = 1 + readStore("speed")
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("CursorKnife"),
|
||||
entity,
|
||||
get_global_mouse_position(),
|
||||
entity.position.angle_to_point(get_global_mouse_position())
|
||||
):
|
||||
if bullet is CursorKnifeBullet:
|
||||
bullet.baseDamage = readStore("atk")
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://jyalew2bgcnk
|
||||
@@ -16,6 +16,7 @@ class_name BulletBase
|
||||
@export var autoLoopAnimation: bool = false
|
||||
@export var autoDestroyAnimation: bool = false
|
||||
@export var autoDestroyOnHitMap: bool = true
|
||||
@export var autoPlayTexture: bool = false
|
||||
@export var freeAfterSpawn: bool = false
|
||||
@export var knockback: float = 0 # 击退力,物理引擎单位
|
||||
@export var recoil: float = 0 # 后坐力,物理引擎单位
|
||||
@@ -57,6 +58,8 @@ func _ready():
|
||||
tryDestroy()
|
||||
if autoLoopAnimation:
|
||||
animator.play("loop")
|
||||
if autoPlayTexture:
|
||||
texture.play("default")
|
||||
body_entered.connect(
|
||||
func(body):
|
||||
if body.is_in_group("map"):
|
||||
@@ -82,7 +85,7 @@ func _physics_process(_delta: float) -> void:
|
||||
[launcher])
|
||||
if is_instance_valid(targetEntity):
|
||||
PresetBulletAI.trace(
|
||||
self,
|
||||
self ,
|
||||
targetEntity.getTrackingAnchor(),
|
||||
launcher.fields.get(FieldStore.Entity.BULLET_TRACE) / 10
|
||||
)
|
||||
@@ -116,8 +119,8 @@ func determineCrit():
|
||||
return MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE) + GameRule.critRateInfluenceByLuckValue * launcher.fields[FieldStore.Entity.LUCK_VALUE])
|
||||
func hitEntity(target: Node):
|
||||
var entity: EntityBase = EntityTool.fromHurtbox(target)
|
||||
if !BulletTool.canDamage(self, entity): return
|
||||
var resultDamage = entity.bulletHit(self, determineCrit())
|
||||
if !BulletTool.canDamage(self , entity): return
|
||||
var resultDamage = entity.bulletHit(self , determineCrit())
|
||||
succeedToHit(resultDamage, entity)
|
||||
if MathTool.rate(fullPenerate() - entity.fields[FieldStore.Entity.PENARATION_RESISTANCE]):
|
||||
baseDamage *= 1.0 - penerateDamageReduction
|
||||
@@ -127,7 +130,7 @@ func hitObstacle(target: Node):
|
||||
if target is ObstacleBase:
|
||||
var obstacle = target as ObstacleBase
|
||||
if is_instance_valid(obstacle.launcher):
|
||||
if not BulletTool.canDamage(self, obstacle.launcher): return
|
||||
if not BulletTool.canDamage(self , obstacle.launcher): return
|
||||
obstacle.takeDamage(calculateDamage(determineCrit()))
|
||||
if MathTool.rate(fullPenerate() - obstacle.penerateResistance):
|
||||
baseDamage *= 1.0 - penerateDamageReduction
|
||||
|
||||
@@ -37,6 +37,7 @@ class_name Weapon
|
||||
var cooldownTimer: CooldownTimer = null
|
||||
var originalStore: Dictionary = {}
|
||||
var chargedTime: float = 0
|
||||
var attackSpeed: float = 1
|
||||
|
||||
func _ready():
|
||||
cooldownTimer = CooldownTimer.new()
|
||||
@@ -71,7 +72,7 @@ func _ready():
|
||||
if get_parent():
|
||||
var myIndex = get_index()
|
||||
var leftIndex = max(myIndex - 1, 0)
|
||||
get_parent().move_child(self, leftIndex)
|
||||
get_parent().move_child(self , leftIndex)
|
||||
ArrayTool.swap(UIState.player.weapons, myIndex, leftIndex)
|
||||
UIState.player.rebuildWeaponIcons()
|
||||
)
|
||||
@@ -80,7 +81,7 @@ func _ready():
|
||||
if get_parent():
|
||||
var myIndex = get_index()
|
||||
var rightIndex = min(myIndex + 1, get_parent().get_child_count() - 1)
|
||||
get_parent().move_child(self, rightIndex)
|
||||
get_parent().move_child(self , rightIndex)
|
||||
ArrayTool.swap(UIState.player.weapons, myIndex, rightIndex)
|
||||
UIState.player.rebuildWeaponIcons()
|
||||
)
|
||||
@@ -167,7 +168,7 @@ func playSound(sound: String):
|
||||
await cloned.finished
|
||||
cloned.queue_free()
|
||||
func canAttackBy(entity: EntityBase):
|
||||
cooldownTimer.speedScale = entity.fields.get(FieldStore.Entity.ATTACK_SPEED)
|
||||
cooldownTimer.speedScale = entity.fields.get(FieldStore.Entity.ATTACK_SPEED) * attackSpeed
|
||||
return cooldownTimer.isCooldowned() and entity.isEnergyEnough(needEnergy)
|
||||
func tryAttack(entity: EntityBase):
|
||||
if canAttackBy(entity):
|
||||
|
||||
Reference in New Issue
Block a user