mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-31 00:11:54 +08:00
feat: 添加蘑菇矿挖爪武器及其相关功能
添加新的武器蘑菇矿挖爪,包括武器脚本、子弹脚本和场景文件。修改BulletBase.gd以支持新武器的功能,并在Rooster角色中添加该武器。同时设置rooster节点为初始不可见状态。 - 新增MushroomPickaxe武器,具有概率掉落物品的特性 - 修改BulletBase的succeedToHit方法以支持实体参数 - 在Rooster场景中添加新武器 - 设置rooster节点的currentInvinsible属性为true
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
extends BulletBase
|
||||
class_name MushroomPickaxe
|
||||
|
||||
var count: int = 2
|
||||
var rate: float = 0.1
|
||||
|
||||
func succeedToHit(_dmg, entity):
|
||||
if MathTool.rate(rate):
|
||||
for i in randi_range(1, count):
|
||||
ItemDropped.generate(
|
||||
MathTool.randc_from([ItemStore.ItemType.BASEBALL, ItemStore.ItemType.BASKETBALL, ItemStore.ItemType.BEACHBALL]),
|
||||
randi_range(1, count),
|
||||
entity.position + MathTool.randv2_range(GameRule.itemDroppedSpawnOffset)
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 0.5 * to
|
||||
origin["rate"] += 0.02 * to
|
||||
origin["count"] += 1 * level
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
for j in BulletBase.generate(preload("res://components/Bullets/MushroomPickaxe.tscn"), entity, entity.texture.global_position, weaponPos.angle_to_point(get_global_mouse_position())):
|
||||
var bullet: MushroomPickaxe = j
|
||||
bullet.damage = readStore("atk")
|
||||
bullet.rate = readStore("rate")
|
||||
bullet.count = readStore("count")
|
||||
return true
|
||||
Reference in New Issue
Block a user