mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat: 添加蘑菇矿挖爪武器及其相关功能
添加新的武器蘑菇矿挖爪,包括武器脚本、子弹脚本和场景文件。修改BulletBase.gd以支持新武器的功能,并在Rooster角色中添加该武器。同时设置rooster节点为初始不可见状态。 - 新增MushroomPickaxe武器,具有概率掉落物品的特性 - 修改BulletBase的succeedToHit方法以支持实体参数 - 在Rooster场景中添加新武器 - 设置rooster节点的currentInvinsible属性为true
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dyo1ysooo1l4x"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_2jrlq"]
|
||||
[ext_resource type="Script" path="res://scripts/Contents/Bullets/MushroomPickaxe.gd" id="2_iyw38"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqg0aluvegqfe" path="res://resources/bullets/MushroomPickaxe/frames/Shroomite_Digging_Claw.webp" id="2_symlj"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_j8qom"]
|
||||
length = 0.001
|
||||
|
||||
[sub_resource type="Animation" id="Animation_oinqg"]
|
||||
resource_name = "destroy"
|
||||
length = 0.5
|
||||
step = 0.1
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ynxlt"]
|
||||
resource_name = "loop"
|
||||
loop_mode = 1
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 6.28319]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_kmogx"]
|
||||
resource_name = "spawn"
|
||||
length = 0.2
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [-0.785398, 0.785]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qrtcj"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_j8qom"),
|
||||
"destroy": SubResource("Animation_oinqg"),
|
||||
"loop": SubResource("Animation_ynxlt"),
|
||||
"spawn": SubResource("Animation_kmogx")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lp71g"]
|
||||
size = Vector2(80, 170)
|
||||
|
||||
[node name="MushroomPickaxe" instance=ExtResource("1_2jrlq")]
|
||||
script = ExtResource("2_iyw38")
|
||||
displayName = "蘑菇矿挖爪"
|
||||
speed = 0.0
|
||||
damage = 1.0
|
||||
penerate = 1.0
|
||||
autoSpawnAnimation = true
|
||||
freeAfterSpawn = true
|
||||
|
||||
[node name="texture" parent="." index="0"]
|
||||
rotation = 0.785
|
||||
|
||||
[node name="animator" parent="texture" index="0"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_qrtcj")
|
||||
}
|
||||
|
||||
[node name="item" type="Sprite2D" parent="texture" index="1"]
|
||||
position = Vector2(200, 0)
|
||||
rotation = 0.785398
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_symlj")
|
||||
|
||||
[node name="hitbox" parent="." index="1"]
|
||||
position = Vector2(200, 0)
|
||||
shape = SubResource("RectangleShape2D_lp71g")
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=17 format=3 uid="uid://bm7ymrri6pykb"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://bm7ymrri6pykb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"]
|
||||
[ext_resource type="Script" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"]
|
||||
@@ -6,6 +6,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://dclinyhu256xi" path="res://resources/sounds/effect/Low Whoosh.mp3" id="3_4syso"]
|
||||
[ext_resource type="Texture2D" uid="uid://ci2ik43ce82uy" path="res://resources/characters/cock/rooster-b.svg" id="3_b0fgx"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="3_ms5sq"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwsyn746hr25d" path="res://components/Weapons/MushroomPickaxe.tscn" id="3_nvei0"]
|
||||
[ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"]
|
||||
[ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"]
|
||||
[ext_resource type="PackedScene" uid="uid://wl8u5m52708w" path="res://components/Weapons/LGBT.tscn" id="4_pb8qn"]
|
||||
@@ -47,16 +48,19 @@ displayName = "公鸡"
|
||||
[node name="weaponStore" parent="." index="0"]
|
||||
process_mode = 4
|
||||
|
||||
[node name="PurpleCrystal" parent="weaponStore" index="0" instance=ExtResource("3_ms5sq")]
|
||||
[node name="MushroomPickaxe" parent="weaponStore" index="0" instance=ExtResource("3_nvei0")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="VectorStar" parent="weaponStore" index="1" instance=ExtResource("6_fvy5n")]
|
||||
[node name="PurpleCrystal" parent="weaponStore" index="1" instance=ExtResource("3_ms5sq")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="LGBT" parent="weaponStore" index="2" instance=ExtResource("4_pb8qn")]
|
||||
[node name="VectorStar" parent="weaponStore" index="2" instance=ExtResource("6_fvy5n")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="BigLaser" parent="weaponStore" index="3" instance=ExtResource("4_plqwu")]
|
||||
[node name="LGBT" parent="weaponStore" index="3" instance=ExtResource("4_pb8qn")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="BigLaser" parent="weaponStore" index="4" instance=ExtResource("4_plqwu")]
|
||||
debugRebuild = false
|
||||
|
||||
[node name="sprint" parent="sounds" index="0"]
|
||||
|
||||
@@ -103,3 +103,4 @@ shape = SubResource("CircleShape2D_4hkht")
|
||||
polygon = PackedVector2Array(-2419, 1803, 2429, 1825, 2392, -366, 2867, -318, 2723, 2241, -2879, 2193, -2797, -2582, 2959, -2528, 2858, -347, 2420, -337, 2441, -1834, -2438, -1792)
|
||||
|
||||
[node name="rooster" parent="." groups=["players"] instance=ExtResource("3_5ui6q")]
|
||||
currentInvinsible = true
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dwsyn746hr25d"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_aoaad"]
|
||||
[ext_resource type="Script" path="res://scripts/Contents/Weapons/MushroomPickaxe.gd" id="2_5dp3e"]
|
||||
[ext_resource type="Texture2D" uid="uid://cqg0aluvegqfe" path="res://resources/bullets/MushroomPickaxe/frames/Shroomite_Digging_Claw.webp" id="2_u2d30"]
|
||||
|
||||
[node name="MushroomPickaxe" instance=ExtResource("1_aoaad")]
|
||||
script = ExtResource("2_5dp3e")
|
||||
avatarTexture = ExtResource("2_u2d30")
|
||||
displayName = "蘑菇矿挖爪"
|
||||
store = {
|
||||
"atk": 1,
|
||||
"count": 5.0,
|
||||
"rate": 0.15
|
||||
}
|
||||
storeType = {
|
||||
"atk": 1,
|
||||
"count": 1,
|
||||
"rate": 2
|
||||
}
|
||||
descriptionTemplate = "命中时造成$atk点伤害,有$rate概率挖出1~$count个随机物品。"
|
||||
needEnergy = 1.0
|
||||
debugRebuild = true
|
||||
|
||||
[node name="avatar" parent="container/info" index="0"]
|
||||
texture = ExtResource("2_u2d30")
|
||||
|
||||
[node name="energy" parent="container/info/infos/energyInfo" index="1"]
|
||||
text = "1.0"
|
||||
|
||||
[node name="name" parent="container/info" index="2"]
|
||||
displayName = "蘑菇矿挖爪"
|
||||
|
||||
[node name="description" parent="container" index="2"]
|
||||
text = "[center]命中时造成[color=cyan]1[/color]点伤害,有[color=cyan]15%[/color]概率挖出1~[color=cyan]5[/color]个随机物品。[/center]"
|
||||
@@ -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
|
||||
@@ -83,8 +83,8 @@ func hit(target: Node):
|
||||
if !canDamageSelf && entity == launcher: return
|
||||
if !indisDamage && !GameRule.allowFriendlyFire:
|
||||
if entity.isPlayer() == launcher.isPlayer() and launcher.currentFocusedBoss != entity: return
|
||||
var damages = entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE) + GameRule.critRateInfluenceByLuckValue * launcher.fields[FieldStore.Entity.LUCK_VALUE]))
|
||||
succeedToHit(damages)
|
||||
var resultDamage = entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE) + GameRule.critRateInfluenceByLuckValue * launcher.fields[FieldStore.Entity.LUCK_VALUE]))
|
||||
succeedToHit(resultDamage, entity)
|
||||
if MathTool.rate(fullPenerate()):
|
||||
penerate -= entity.fields[FieldStore.Entity.PENARATION_RESISTANCE]
|
||||
else:
|
||||
@@ -130,7 +130,7 @@ func spawn():
|
||||
pass
|
||||
func applyDot():
|
||||
pass
|
||||
func succeedToHit(_dmg: float):
|
||||
func succeedToHit(_dmg: float, _entity: EntityBase):
|
||||
pass
|
||||
func register():
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user