1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat: 添加新武器彩虹旗和紫水晶簇,调整饲料属性和数值

refactor: 重构子弹生成逻辑,支持分裂和折射效果

fix: 修复掉落物拾取范围和碰撞检测问题

style: 优化UI显示,添加武器品质和类型标签

docs: 更新字段描述,调整部分饲料名称和分类

perf: 优化数学工具函数,添加随机数处理工具

test: 调整波次生成逻辑,添加新敌人类型

build: 添加新资源文件和相关导入配置
This commit is contained in:
2025-09-05 22:23:41 +08:00
parent bb279c99b0
commit d4501ae45d
54 changed files with 974 additions and 109 deletions
+94
View File
@@ -0,0 +1,94 @@
[gd_scene load_steps=7 format=3 uid="uid://ckq2cq6m23hq3"]
[ext_resource type="Script" path="res://scripts/Structs/Weapon.gd" id="1_g802t"]
[ext_resource type="Theme" uid="uid://dhvs6urgf6jr5" path="res://themes/main.tres" id="2_fwkd3"]
[ext_resource type="PackedScene" uid="uid://ch81vd3awkmhk" path="res://components/UI/WeaponName.tscn" id="3_qv0b1"]
[ext_resource type="Texture2D" uid="uid://dwwpkn4q07ja2" path="res://icon.svg" id="3_vtucy"]
[ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="4_6gohw"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"]
content_margin_left = 30.0
content_margin_top = 20.0
content_margin_right = 30.0
content_margin_bottom = 20.0
bg_color = Color(0, 0, 0, 0.5)
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color(0, 0, 0, 0.75)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[node name="WeaponCard" type="PanelContainer"]
offset_right = 300.0
offset_bottom = 304.0
theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr")
script = ExtResource("1_g802t")
metadata/_edit_lock_ = true
[node name="container" type="VBoxContainer" parent="."]
layout_mode = 2
theme_override_constants/separation = 10
[node name="selectBtn" type="Button" parent="container"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_fwkd3")
text = "升级"
[node name="info" type="VBoxContainer" parent="container"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="avatar" type="TextureRect" parent="container/info"]
unique_name_in_owner = true
custom_minimum_size = Vector2(75, 75)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
texture = ExtResource("3_vtucy")
expand_mode = 1
stretch_mode = 5
[node name="energyInfo" type="HBoxContainer" parent="container/info"]
layout_mode = 2
alignment = 1
[node name="icon" type="TextureRect" parent="container/info/energyInfo"]
custom_minimum_size = Vector2(15, 15)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("4_6gohw")
expand_mode = 1
stretch_mode = 5
[node name="energy" type="Label" parent="container/info/energyInfo"]
unique_name_in_owner = true
layout_mode = 2
text = "0.0"
[node name="name" parent="container/info" instance=ExtResource("3_qv0b1")]
unique_name_in_owner = true
layout_mode = 2
displayName = "未命名饲料"
quality = 1
[node name="description" type="RichTextLabel" parent="container"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
bbcode_enabled = true
text = "造成[color=cyan]10.0[/color]点伤害。"
fit_content = true
[node name="costs" type="GridContainer" parent="container"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 10
theme_override_constants/h_separation = 10
theme_override_constants/v_separation = 10
columns = 2
+110
View File
@@ -0,0 +1,110 @@
[gd_scene load_steps=20 format=3 uid="uid://nys5bp6hogls"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_bnhy4"]
[ext_resource type="Texture2D" uid="uid://d2pndtow16635" path="res://resources/bullets/lgbt-bullet/造型2.svg" id="2_cnsbx"]
[ext_resource type="Script" path="res://scripts/Contents/Bullets/LGBTBullet.gd" id="2_iakgr"]
[sub_resource type="SpriteFrames" id="SpriteFrames_rdak6"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_cnsbx")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_4pjb3"]
radius = 32.249
[sub_resource type="Curve" id="Curve_6bq7i"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_303mb"]
curve = SubResource("Curve_6bq7i")
[sub_resource type="Curve" id="Curve_6iu81"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_3uomf"]
curve = SubResource("Curve_6iu81")
[sub_resource type="Gradient" id="Gradient_0tq38"]
offsets = PackedFloat32Array(0, 0.16, 0.32, 0.48, 0.64, 0.8, 1)
colors = PackedColorArray(1, 0, 0, 1, 1, 0.447059, 0, 1, 1, 0.890625, 0, 1, 0, 0.820313, 0.128174, 1, 0, 1, 0.859375, 1, 0, 0.53125, 1, 1, 0.429688, 0, 1, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_bd4id"]
gradient = SubResource("Gradient_0tq38")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_4q0mc"]
particle_flag_disable_z = true
angle_min = 1.07288e-05
angle_max = 360.0
angle_curve = SubResource("CurveTexture_3uomf")
direction = Vector3(-1, 0, 0)
spread = 180.0
initial_velocity_min = 10.0
initial_velocity_max = 30.0
gravity = Vector3(0, 0, 0)
scale_min = 5.0
scale_max = 10.0
color_ramp = SubResource("GradientTexture1D_bd4id")
alpha_curve = SubResource("CurveTexture_303mb")
[sub_resource type="Curve" id="Curve_7mfgg"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_tnhr3"]
curve = SubResource("Curve_7mfgg")
[sub_resource type="Curve" id="Curve_ha3m1"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_snnuj"]
curve = SubResource("Curve_ha3m1")
[sub_resource type="Curve" id="Curve_p75kb"]
_data = [Vector2(0, 0.25), 0.0, 0.0, 0, 0, Vector2(0.5, 0.75), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_cytp5"]
curve = SubResource("Curve_p75kb")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xktft"]
particle_flag_disable_z = true
angle_min = 1.07288e-05
angle_max = 360.0
angle_curve = SubResource("CurveTexture_snnuj")
direction = Vector3(-1, 0, 0)
spread = 0.0
initial_velocity_min = 50.0
initial_velocity_max = 100.0
gravity = Vector3(0, 0, 0)
scale_curve = SubResource("CurveTexture_cytp5")
alpha_curve = SubResource("CurveTexture_tnhr3")
[node name="LGBTBullet" instance=ExtResource("1_bnhy4")]
script = ExtResource("2_iakgr")
lifeTime = 2000.0
[node name="texture" parent="." index="0"]
sprite_frames = SubResource("SpriteFrames_rdak6")
[node name="hitbox" parent="." index="1"]
shape = SubResource("CircleShape2D_4pjb3")
[node name="particles" type="GPUParticles2D" parent="." index="2"]
z_index = -1
amount = 500
process_material = SubResource("ParticleProcessMaterial_4q0mc")
[node name="particles2" type="GPUParticles2D" parent="." index="3"]
z_index = -1
amount = 30
process_material = SubResource("ParticleProcessMaterial_xktft")
texture = ExtResource("2_cnsbx")
+1 -1
View File
@@ -5,5 +5,5 @@
[node name="FeedHasField" type="HBoxContainer"]
theme_override_constants/separation = 0
script = ExtResource("1_7leag")
targetFields = Array[int]([1])
targetFields = Array[int]([7])
clickToRefresh = true
+4 -3
View File
@@ -6,10 +6,11 @@
[node name="Banana" instance=ExtResource("1_vapev")]
avatarTexture = ExtResource("2_2mlfi")
displayName = "香蕉"
fields = Array[int]([0, 3])
fieldValues = Array[float]([15.0, 0.07])
topic = 3
fields = Array[int]([3])
fieldValues = Array[float]([0.04])
costs = Array[int]([0, 1])
costCounts = Array[int]([100, 55])
costCounts = Array[int]([100, 25])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_2mlfi")
+7 -4
View File
@@ -7,13 +7,16 @@
avatarTexture = ExtResource("2_ijk6h")
displayName = "生日蛋糕"
quality = 2
fields = Array[int]([4, 8, 15])
fieldValues = Array[float]([0.06, 0.075, 1.0])
costs = Array[int]([1])
costCounts = Array[int]([125])
topic = 4
fields = Array[int]([4, 1])
fieldValues = Array[float]([0.03, 0.04])
costs = Array[int]([0, 1])
costCounts = Array[int]([300, 200])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_ijk6h")
[node name="name" parent="container/info" index="1"]
displayName = "生日蛋糕"
quality = 2
topic = 4
+5 -4
View File
@@ -6,10 +6,11 @@
[node name="Cupcake" instance=ExtResource("1_x5oju")]
avatarTexture = ExtResource("2_qojf3")
displayName = "烘焙松糕"
fields = Array[int]([12, 2, 5])
fieldValues = Array[float]([0.15, 0.1, 0.05])
costs = Array[int]([0])
costCounts = Array[int]([125])
topic = 6
fields = Array[int]([15, 12])
fieldValues = Array[float]([1.0, 0.02])
costs = Array[int]([0, 1])
costCounts = Array[int]([125, 50])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_qojf3")
+1 -1
View File
@@ -8,7 +8,7 @@ avatarTexture = ExtResource("2_ckr7l")
displayName = "团子"
quality = 4
fields = Array[int]([0, 8, 9])
fieldValues = Array[float]([30.0, 0.1, 2.0])
fieldValues = Array[float]([15.0, 0.05, 1.0])
costs = Array[int]([0, 1])
costCounts = Array[int]([500, 150])
+2 -1
View File
@@ -7,8 +7,9 @@
avatarTexture = ExtResource("2_lxrba")
displayName = "团子猫"
quality = 3
topic = 1
fields = Array[int]([17, 19, 10, 20])
fieldValues = Array[float]([20.0, 0.05, 0.12, 0.1])
fieldValues = Array[float]([20.0, 0.07, 0.04, 0.08])
costs = Array[int]([0, 1])
costCounts = Array[int]([600, 400])
+3 -2
View File
@@ -7,8 +7,9 @@
avatarTexture = ExtResource("2_bv6j5")
displayName = "甜甜圈"
quality = 2
fields = Array[int]([9, 7, 16])
fieldValues = Array[float]([1.0, -3.0, 1.0])
topic = 2
fields = Array[int]([7, 22, 6])
fieldValues = Array[float]([-1.0, 0.1, 0.04])
costs = Array[int]([0, 1])
costCounts = Array[int]([500, 450])
+3 -2
View File
@@ -6,8 +6,9 @@
[node name="FruitPlatter" instance=ExtResource("1_rejfg")]
avatarTexture = ExtResource("2_6i6sp")
displayName = "水果拼盘"
fields = Array[int]([2, 12])
fieldValues = Array[float]([0.05, 0.1])
topic = 7
fields = Array[int]([21])
fieldValues = Array[float]([2.0])
costs = Array[int]([0, 1])
costCounts = Array[int]([150, 200])
+3 -2
View File
@@ -7,8 +7,9 @@
avatarTexture = ExtResource("2_2oxe7")
displayName = "水果沙拉"
quality = 0
fields = Array[int]([1])
fieldValues = Array[float]([0.1])
topic = 5
fields = Array[int]([4, 14])
fieldValues = Array[float]([0.04, 0.02])
costs = Array[int]([1])
costCounts = Array[int]([200])
+2 -2
View File
@@ -8,9 +8,9 @@ avatarTexture = ExtResource("2_or0st")
displayName = "幸运签语饼"
quality = 2
fields = Array[int]([14, 4, 6, 18])
fieldValues = Array[float]([0.04, 0.07, 0.06, 2.0])
fieldValues = Array[float]([0.02, 0.03, 0.06, 1.5])
costs = Array[int]([0, 1])
costCounts = Array[int]([165, 50])
costCounts = Array[int]([400, 375])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_or0st")
+2 -2
View File
@@ -7,8 +7,8 @@
avatarTexture = ExtResource("2_15plv")
displayName = "牛奶"
quality = 2
fields = Array[int]([13, 11, 8, 19])
fieldValues = Array[float]([0.1, 0.24, 0.07, 0.02])
fields = Array[int]([13, 11, 19, 4])
fieldValues = Array[float]([0.1, 0.08, 0.02, 0.02])
costs = Array[int]([0, 1])
costCounts = Array[int]([355, 200])
+1 -1
View File
@@ -8,7 +8,7 @@ avatarTexture = ExtResource("2_l6jnq")
displayName = "橘子"
quality = 3
fields = Array[int]([10, 3])
fieldValues = Array[float]([0.15, 0.05])
fieldValues = Array[float]([0.07, 0.05])
costs = Array[int]([1])
costCounts = Array[int]([275])
+1 -1
View File
@@ -7,7 +7,7 @@
avatarTexture = ExtResource("2_o2o56")
displayName = "草莓果酱"
fields = Array[int]([3, 1])
fieldValues = Array[float]([-0.08, 0.11])
fieldValues = Array[float]([-0.05, 0.08])
costs = Array[int]([0, 1])
costCounts = Array[int]([100, 50])
+3 -3
View File
@@ -7,8 +7,8 @@
avatarTexture = ExtResource("2_eed3c")
displayName = "塔克"
quality = 4
fields = Array[int]([13])
fieldValues = Array[float]([0.36])
fields = Array[int]([13, 3])
fieldValues = Array[float]([0.18, 0.02])
costs = Array[int]([1])
costCounts = Array[int]([400])
@@ -17,4 +17,4 @@ texture = ExtResource("2_eed3c")
[node name="name" parent="container/info" index="1"]
displayName = "塔克"
quality = 3
quality = 4
+1 -1
View File
@@ -8,7 +8,7 @@ avatarTexture = ExtResource("2_gsfud")
displayName = "水杯"
quality = 4
fields = Array[int]([3, 7])
fieldValues = Array[float]([0.25, 3.0])
fieldValues = Array[float]([0.09, 3.0])
costs = Array[int]([1])
costCounts = Array[int]([400])
+3 -2
View File
@@ -6,10 +6,11 @@
[node name="Xigua-Full" instance=ExtResource("1_sw8vc")]
avatarTexture = ExtResource("2_j4m35")
displayName = "西瓜"
quality = 3
fields = Array[int]([2, 0, 11])
fieldValues = Array[float]([-0.15, 30.0, 0.1])
fieldValues = Array[float]([-0.15, 20.0, 0.1])
costs = Array[int]([0, 1])
costCounts = Array[int]([100, 125])
costCounts = Array[int]([300, 260])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_j4m35")
+3 -3
View File
@@ -8,9 +8,9 @@ avatarTexture = ExtResource("2_htt7g")
displayName = "一片西瓜"
quality = 0
fields = Array[int]([0])
fieldValues = Array[float]([10.0])
costs = Array[int]([0])
costCounts = Array[int]([50])
fieldValues = Array[float]([5.0])
costs = Array[int]([0, 1])
costCounts = Array[int]([100, 20])
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_htt7g")
+2 -1
View File
@@ -6,8 +6,9 @@
[node name="YellowJam" instance=ExtResource("1_evi6p")]
avatarTexture = ExtResource("2_bea7w")
displayName = "蜂蜜果酱"
quality = 2
fields = Array[int]([3, 1, 12])
fieldValues = Array[float]([-0.11, 0.16, 0.03])
fieldValues = Array[float]([-0.08, 0.15, 0.03])
costs = Array[int]([0, 1])
costCounts = Array[int]([200, 125])
@@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=3 uid="uid://dekcqdhrjs07u"]
[ext_resource type="PackedScene" uid="uid://d3qojeqa3difn" path="res://components/Abstracts/FullscreenPanelBase.tscn" id="1_yodmq"]
[ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="2_5r0we"]
[ext_resource type="PackedScene" uid="uid://cxabqjo7skxev" path="res://components/Weapons/BigLaser.tscn" id="3_6xf37"]
[ext_resource type="PackedScene" uid="uid://wl8u5m52708w" path="res://components/Weapons/LGBT.tscn" id="4_s13oq"]
[node name="Weapon" instance=ExtResource("1_yodmq")]
[node name="wrapper" parent="content" index="0"]
theme_override_constants/separation = 50
[node name="box" type="HBoxContainer" parent="content/wrapper" index="0"]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 1
[node name="PurpleCrystal" parent="content/wrapper/box" index="0" instance=ExtResource("2_5r0we")]
layout_mode = 2
[node name="BigLaser" parent="content/wrapper/box" index="1" instance=ExtResource("3_6xf37")]
layout_mode = 2
[node name="???" parent="content/wrapper/box" index="2" instance=ExtResource("4_s13oq")]
layout_mode = 2
+3 -5
View File
@@ -213,9 +213,9 @@ anchors_preset = -1
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -100.0
offset_top = -30.0
offset_right = -40.0
offset_bottom = 30.0
offset_top = -82.5
offset_right = 48.0
offset_bottom = 82.5
grow_vertical = 2
theme_override_styles/panel = ExtResource("11_67ghp")
@@ -263,9 +263,7 @@ visible = false
layout_mode = 1
[node name="GameOver" parent="root/panels" instance=ExtResource("6_10ay6")]
visible = false
layout_mode = 1
[node name="Pause" parent="root/panels" instance=ExtResource("12_jkm6o")]
visible = false
layout_mode = 1
+7 -13
View File
@@ -1,9 +1,9 @@
[gd_scene load_steps=11 format=3 uid="uid://dmxi1ikn6avig"]
[gd_scene load_steps=10 format=3 uid="uid://dmxi1ikn6avig"]
[ext_resource type="Script" path="res://scripts/Tools/WorldManager.gd" id="1_lxsxj"]
[ext_resource type="PackedScene" uid="uid://dfwg750a47ggx" path="res://components/Scenes/UI.tscn" id="2_04cdd"]
[ext_resource type="PackedScene" uid="uid://bm7ymrri6pykb" path="res://components/Characters/Rooster.tscn" id="3_5ui6q"]
[ext_resource type="Texture2D" uid="uid://dk7u1x1e8ptj7" path="res://resources/maps/Desert.png" id="4_04do5"]
[ext_resource type="Texture2D" uid="uid://c33c8mtm4x3e3" path="res://resources/maps/Galaxy.png" id="4_oy4jj"]
[ext_resource type="Script" path="res://scripts/Tools/CameraManager.gd" id="5_mk7bv"]
[sub_resource type="Animation" id="Animation_ykpvi"]
@@ -65,10 +65,7 @@ _data = {
}
[sub_resource type="CircleShape2D" id="CircleShape2D_4hkht"]
radius = 126.89
[sub_resource type="CircleShape2D" id="CircleShape2D_4y8st"]
radius = 46.1736
radius = 57.3149
[node name="world" type="Node2D"]
y_sort_enabled = true
@@ -91,20 +88,17 @@ libraries = {
}
[node name="map" type="StaticBody2D" parent="." groups=["map"]]
metadata/_edit_lock_ = true
[node name="background" type="Sprite2D" parent="map"]
z_index = -100
scale = Vector2(5, 5)
texture = ExtResource("4_04do5")
texture = ExtResource("4_oy4jj")
[node name="xrz1" type="CollisionShape2D" parent="map"]
position = Vector2(-1827, 575)
[node name="star1" type="CollisionShape2D" parent="map"]
position = Vector2(-2057, 1298)
shape = SubResource("CircleShape2D_4hkht")
[node name="xrz2" type="CollisionShape2D" parent="map"]
position = Vector2(251, 118)
shape = SubResource("CircleShape2D_4y8st")
[node name="shan2" type="CollisionPolygon2D" parent="map"]
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)
+24 -3
View File
@@ -1,12 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://bt370a1djjg5p"]
[gd_scene load_steps=5 format=3 uid="uid://bt370a1djjg5p"]
[ext_resource type="Script" path="res://scripts/Statemachine/FeedName.gd" id="1_wfxme"]
[ext_resource type="Theme" uid="uid://bje5cd08dyok7" path="res://themes/bigTextAndBold.tres" id="2_k71he"]
[sub_resource type="LabelSettings" id="LabelSettings_sby55"]
[sub_resource type="LabelSettings" id="LabelSettings_whetw"]
font_size = 12
font_color = Color(1, 0.442751, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_wse1t"]
font_size = 12
font_color = Color(1, 0, 0.585938, 1)
[node name="FeedName" type="HBoxContainer"]
offset_right = 205.0
offset_bottom = 25.0
@@ -20,6 +24,16 @@ qualityColorMap = {
3: Color(0.507763, 0, 1, 1),
4: Color(1, 0.442751, 0, 1)
}
topicColorMap = {
0: Color(1, 0, 0.585938, 1),
1: Color(0, 0.414063, 1, 1),
2: Color(0.757813, 0.497314, 0, 1),
3: Color(0.40625, 1, 0, 1),
4: Color(1, 0, 0, 1),
5: Color(1, 0.421875, 0, 1),
6: Color(1, 1, 1, 1),
7: Color(0.449219, 0.449219, 0.449219, 1)
}
metadata/_edit_horizontal_guides_ = [25.0]
[node name="quality" type="Label" parent="."]
@@ -27,7 +41,7 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
text = "[传说]"
label_settings = SubResource("LabelSettings_sby55")
label_settings = SubResource("LabelSettings_whetw")
[node name="label" type="RichTextLabel" parent="."]
unique_name_in_owner = true
@@ -37,3 +51,10 @@ bbcode_enabled = true
text = "[b]未命名饲料[/b]"
fit_content = true
autowrap_mode = 0
[node name="topic" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 8
text = "[生存]"
label_settings = SubResource("LabelSettings_wse1t")
+8 -2
View File
@@ -1,8 +1,11 @@
[gd_scene load_steps=16 format=3 uid="uid://cxcvc1rjvm8i2"]
[gd_scene load_steps=17 format=3 uid="uid://cxcvc1rjvm8i2"]
[ext_resource type="Script" path="res://scripts/Statemachine/ItemDropped.gd" id="1_v2djl"]
[ext_resource type="Texture2D" uid="uid://bks8jmctleina" path="res://resources/items/baseball.svg" id="2_4hl42"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_1ishj"]
bounce = 0.5
[sub_resource type="Animation" id="Animation_5i70v"]
length = 0.001
tracks/0/type = "bezier"
@@ -83,7 +86,7 @@ _data = {
}
[sub_resource type="CircleShape2D" id="CircleShape2D_7lt1c"]
radius = 2.0
radius = 14.0357
[sub_resource type="Curve" id="Curve_11h7l"]
_data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
@@ -130,6 +133,9 @@ alpha_curve = SubResource("CurveTexture_u4ger")
[node name="ItemDropped" type="RigidBody2D"]
collision_layer = 2
collision_mask = 2
physics_material_override = SubResource("PhysicsMaterial_1ishj")
contact_monitor = true
max_contacts_reported = 1
script = ExtResource("1_v2djl")
metadata/_edit_vertical_guides_ = [15.0, -15.0]
+54
View File
@@ -0,0 +1,54 @@
[gd_scene load_steps=5 format=3 uid="uid://ch81vd3awkmhk"]
[ext_resource type="Theme" uid="uid://bje5cd08dyok7" path="res://themes/bigTextAndBold.tres" id="2_y8dft"]
[ext_resource type="Script" path="res://scripts/Statemachine/WeaponName.gd" id="3_g750e"]
[sub_resource type="LabelSettings" id="LabelSettings_r88ap"]
font_size = 12
font_color = Color(1, 0.442751, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_wsanh"]
font_size = 12
[node name="WeaponName" type="HBoxContainer"]
offset_right = 205.0
offset_bottom = 25.0
alignment = 1
script = ExtResource("3_g750e")
quality = 4
qualityColorMap = {
0: Color(0.5, 0.5, 0.5, 1),
1: Color(1, 1, 1, 1),
2: Color(0, 0.493446, 1, 1),
3: Color(0.507763, 0, 1, 1),
4: Color(1, 0.442751, 0, 1)
}
typeTopicColorMap = {
0: Color(1, 1, 1, 1),
1: Color(1, 0, 0, 1),
2: Color(0, 1, 1, 1)
}
metadata/_edit_horizontal_guides_ = [25.0]
[node name="quality" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 0
text = "[传说]"
label_settings = SubResource("LabelSettings_r88ap")
[node name="label" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_y8dft")
bbcode_enabled = true
text = "[b]未命名武器[/b]"
fit_content = true
autowrap_mode = 0
[node name="typeTopic" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 8
text = "[冲击]"
label_settings = SubResource("LabelSettings_wsanh")
+32
View File
@@ -0,0 +1,32 @@
[gd_scene load_steps=3 format=3 uid="uid://cxabqjo7skxev"]
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_wrvv5"]
[ext_resource type="Texture2D" uid="uid://dy4op6n6vxef3" path="res://resources/bullets/laser-circle/circle.svg" id="2_qe8gb"]
[node name="BigLaser" instance=ExtResource("1_wrvv5")]
avatarTexture = ExtResource("2_qe8gb")
displayName = "湮灭激光"
quality = 2
typeTopic = 1
costs = Array[int]([0, 1])
costCounts = Array[int]([100, 50])
store = {
"atk": 35,
"time": 0.1
}
descriptionTemplate = "每$time秒造成$atk点伤害。"
needEnergy = 100.0
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_qe8gb")
[node name="energy" parent="container/info/energyInfo" index="1"]
text = "50.0"
[node name="name" parent="container/info" index="2"]
displayName = "湮灭激光"
quality = 2
typeTopic = 1
[node name="description" parent="container" index="2"]
text = "每[color=cyan]0.1[/color]秒造成[color=cyan]35.0[/color]点伤害。"
+36
View File
@@ -0,0 +1,36 @@
[gd_scene load_steps=3 format=3 uid="uid://wl8u5m52708w"]
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_jwtmd"]
[ext_resource type="Texture2D" uid="uid://cwfyi61xkt4bt" path="res://resources/weapons/lgbt.jpeg" id="2_ou6jo"]
[node name="LGBT" instance=ExtResource("1_jwtmd")]
offset_right = 190.0
offset_bottom = 324.0
avatarTexture = ExtResource("2_ou6jo")
displayName = "彩虹旗"
quality = 4
costs = Array[int]([0, 1])
costCounts = Array[int]([200, 100])
store = {
"atk": 20,
"count": 7.0,
"power": 0.3,
"trace": 2.0
}
descriptionTemplate = "发射$count条可追踪$trace秒,效率为$power的带状彩虹,每条造成$atk点伤害。"
needEnergy = 150.0
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_ou6jo")
[node name="energy" parent="container/info/energyInfo" index="1"]
text = "150.0"
[node name="name" parent="container/info" index="2"]
displayName = "彩虹旗"
quality = 4
[node name="description" parent="container" index="2"]
size_flags_vertical = 3
text = "发射[color=cyan]7.0[/color]条可追踪[color=cyan]2.0[/color]秒,效率为[color=cyan]0.3[/color]的带状彩虹,每条造成[color=cyan]20.0[/color]点伤害。"
autowrap_mode = 2
+22
View File
@@ -0,0 +1,22 @@
[gd_scene load_steps=3 format=3 uid="uid://c0n3igy4hucrg"]
[ext_resource type="PackedScene" uid="uid://ckq2cq6m23hq3" path="res://components/Abstracts/WeaponCardBase.tscn" id="1_hyubh"]
[ext_resource type="Texture2D" uid="uid://16yhngg3jpun" path="res://resources/weapons/purple-crystal.svg" id="2_wgtcw"]
[node name="PurpleCrystal" instance=ExtResource("1_hyubh")]
offset_right = 208.0
offset_bottom = 280.0
avatarTexture = ExtResource("2_wgtcw")
displayName = "紫水晶簇"
costs = Array[int]([0, 1])
costCounts = Array[int]([50, 10])
descriptionTemplate = "撞击造成$atk点伤害。"
[node name="avatar" parent="container/info" index="0"]
texture = ExtResource("2_wgtcw")
[node name="name" parent="container/info" index="2"]
displayName = "紫水晶簇"
[node name="description" parent="container" index="2"]
text = "撞击造成[color=cyan]10.0[/color]点伤害。"
@@ -0,0 +1 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="39.96872" height="39.96872" viewBox="0,0,39.96872,39.96872"><g transform="translate(-220.01564,-160.01564)"><g fill="#ffffff" stroke="none" stroke-width="0" stroke-linecap="round" stroke-miterlimit="10"><g><g><path d="M245.88013,180.14782l-5.90839,-20.13218l-5.86641,19.98913h11.78934"/><path d="M245.88013,179.85218l-5.90839,20.13218l-5.86641,-19.98913h11.78934"/></g><g><path d="M240.14782,174.11987l-20.13218,5.90839l19.98913,5.86641v-11.78934"/><path d="M239.85218,174.11987l20.13218,5.90839l-19.98913,5.86641v-11.78934"/></g></g></g></g></svg><!--rotationCenter:19.984360513549035:19.9843606777562-->

After

Width:  |  Height:  |  Size: 709 B

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2pndtow16635"
path="res://.godot/imported/造型2.svg-fd78205cfea32d2ac8192132eff19a6a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/bullets/lgbt-bullet/造型2.svg"
dest_files=["res://.godot/imported/造型2.svg-fd78205cfea32d2ac8192132eff19a6a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c33c8mtm4x3e3"
path="res://.godot/imported/Galaxy.png-53abaf9941e5b52f9a5ace0a0284acb0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/maps/Galaxy.png"
dest_files=["res://.godot/imported/Galaxy.png-53abaf9941e5b52f9a5ace0a0284acb0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cwfyi61xkt4bt"
path="res://.godot/imported/lgbt.jpeg-e71f0b7ee634ed531914d1feb0fe71dd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/weapons/lgbt.jpeg"
dest_files=["res://.godot/imported/lgbt.jpeg-e71f0b7ee634ed531914d1feb0fe71dd.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://16yhngg3jpun"
path="res://.godot/imported/purple-crystal.svg-d9f71af85cb48c8e1d36f33c1d701f1b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://resources/weapons/purple-crystal.svg"
dest_files=["res://.godot/imported/purple-crystal.svg-d9f71af85cb48c8e1d36f33c1d701f1b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
+21
View File
@@ -0,0 +1,21 @@
extends BulletBase
class_name LGBTBullet
var myTracer: EntityBase = null
func spawn():
findTracer()
func register():
speed = 1
damage = 5
func ai():
texture.rotation_degrees += speed
speed *= 1.05
speed = clamp(speed, 0, 20)
if is_instance_valid(myTracer):
PresetAIs.trace(self, myTracer.position, clamp(speed / 150, 0, 1))
else:
findTracer()
PresetAIs.forward(self, rotation)
func findTracer():
myTracer = EntityTool.findClosetEntity(position, get_tree(), false, true)
+17
View File
@@ -5,3 +5,20 @@ func ai():
PresetAIs.forward(self, rotation)
func destroy(_beacuseMap: bool):
EffectController.create(preload("res://components/Effects/PurpleCrystalExplosion.tscn"), global_position).shot()
func split(index, total, _last):
BulletBase.generate(
preload("res://components/Bullets/PurpleCrystal.tscn"),
launcher,
position,
deg_to_rad(360 / total * index),
true
)
func refract(entity, _index, _total, _last):
BulletBase.generate(
preload("res://components/Bullets/PurpleCrystal.tscn"),
launcher,
position,
position.angle_to_point(entity.position) if is_instance_valid(entity) else randf_range(0, deg_to_rad(360)),
false,
true
)
+1 -1
View File
@@ -24,7 +24,7 @@ func ai():
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
return BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle())
BulletBase.generate(preload("res://components/Bullets/LGBTBullet.tscn"), self, weaponPos, deg_to_rad(randf_range(0, 360)))
elif type == 1:
var weaponPos = findWeaponAnchor("normal")
return BulletBase.generate(preload("res://components/Bullets/BigLaser.tscn"), self, weaponPos, (get_global_mouse_position() - weaponPos).angle())
+1 -1
View File
@@ -13,7 +13,7 @@ static var data: Array[Wave] = [
# entity, minCount, maxCount, isBoss, from, to, per
create(preload("res://components/Characters/Hen.tscn"), 1, 5, false, 0, INF, 1),
create(preload("res://components/Characters/Chick.tscn"), 0, 0, true, 8, INF, 6),
# create(preload("res://components/Characters/Chick.tscn"), 1, 1, true, 0, INF, 1),
create(preload("res://components/Characters/Chick.tscn"), 1, 1, true, 0, INF, 1),
]
static func create(
@@ -0,0 +1,9 @@
extends Weapon
class_name PurpleCrystalWeapon
func update(to: int, origin: Dictionary, _entity: EntityBase):
origin["atk"] += 5 * to
return origin
func attack(entity: EntityBase):
var weaponPos = entity.findWeaponAnchor("normal")
BulletBase.generate(preload("res://components/Bullets/PurpleCrystal.tscn"), entity, weaponPos, (get_global_mouse_position() - weaponPos).angle())
+27 -2
View File
@@ -25,6 +25,8 @@ var launcher: EntityBase = null
var spawnInWhen: float = 0
var spawnInWhere: Vector2 = Vector2.ZERO
var destroying: bool = false
var isChildSplit: bool = false
var isChildRefract: bool = false
func _ready():
register()
@@ -59,6 +61,8 @@ func _physics_process(_delta: float) -> void:
if is_instance_valid(launcher) and (launcher.isPlayer() or is_instance_valid(launcher.currentFocusedBoss)):
launcher.position -= Vector2.from_angle(rotation) * recoil
ai()
else:
tryDestroy()
func hit(target: Node):
var entity: EntityBase = EntityTool.fromHurtbox(target)
@@ -84,11 +88,24 @@ func dotLoop():
func tryDestroy(becauseMap: bool = false):
if destroying: return
destroying = true
trySplit()
tryRefract()
await destroy(becauseMap)
if autoDestroyAnimation:
animator.play("destroy")
await animator.animation_finished
queue_free()
func trySplit():
if is_instance_valid(launcher) and !isChildSplit:
var launcherSplit = launcher.fields.get(FieldStore.Entity.BULLET_SPLIT)
for i in range(MathTool.shrimpRate(launcherSplit)):
split(i, launcherSplit, launcherSplit - floor(launcherSplit))
func tryRefract():
if is_instance_valid(launcher) and !isChildRefract:
var value = launcher.fields.get(FieldStore.Entity.BULLET_REFRACTION)
var entity = EntityTool.findClosetEntity(position, get_tree(), !launcher.isPlayer(), launcher.isPlayer())
for i in range(MathTool.shrimpRate(value)):
refract(entity, i, value, value - floor(value))
# 抽象方法
func ai():
@@ -103,24 +120,32 @@ func succeedToHit(_dmg: float):
pass
func register():
pass
func split(_index: int, _total: int, _lastBullet: float):
pass
func refract(_entity: EntityBase, _index: int, _total: int, _lastBullet: float):
pass
static func generate(
bullet: PackedScene,
launchBy: EntityBase,
spawnPosition: Vector2,
spawnRotation: float,
asChildSplit: bool = false,
asChildRefract: bool = false,
addToWorld: bool = true
):
var extraCount = launchBy.fields.get(FieldStore.Entity.EXTRA_BULLET_COUNT)
var count = 1 + floor(extraCount) + int(MathTool.rate(extraCount - floor(extraCount)))
var count = 1 + MathTool.shrimpRate(extraCount)
var instances = []
for i in range(count):
var instance: BulletBase = bullet.instantiate()
if launchBy.useEnergy(instance.needEnergy):
instance.isChildSplit = asChildSplit
instance.isChildRefract = asChildRefract
instance.launcher = launchBy
instance.position = spawnPosition
instance.rotation = spawnRotation + deg_to_rad(randf_range(-launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT), launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT)))
if addToWorld:
WorldManager.rootNode.add_child(instance)
WorldManager.rootNode.call_deferred("add_child", instance)
instances.append(instance)
return len(instances)
+27 -23
View File
@@ -7,37 +7,39 @@ signal healthChanged(health: float)
signal energyChanged(energy: float)
const TITLE_FLAG = INF
var fields = {
# 数值上限
"生存": TITLE_FLAG,
FieldStore.Entity.HEAL_ABILITY: 1,
FieldStore.Entity.MAX_HEALTH: 100,
FieldStore.Entity.MAX_ENERGY: 200,
FieldStore.Entity.EXTRA_APPLE_MAX: 0,
FieldStore.Entity.EXTRA_BULLET_COUNT: 0,
# 速度
FieldStore.Entity.MOVEMENT_SPEED: 1,
FieldStore.Entity.ATTACK_SPEED: 1,
# 伤害
FieldStore.Entity.DAMAGE_MULTIPILER: 1,
FieldStore.Entity.CRIT_DAMAGE: 1,
# 概率相关
FieldStore.Entity.CRIT_RATE: 0.05,
FieldStore.Entity.PENERATE: 0,
FieldStore.Entity.OFFSET_SHOOT: 3,
FieldStore.Entity.DROP_APPLE_RATE: 0,
FieldStore.Entity.PENARATION_RESISTANCE: 0,
FieldStore.Entity.LUCK_VALUE: 1,
# 治疗
FieldStore.Entity.HEAL_ABILITY: 1,
# 价格减免
FieldStore.Entity.PRICE_REDUCTION: 0,
# 饲料
FieldStore.Entity.FEED_COUNT_SHOW: 3,
FieldStore.Entity.FEED_COUNT_CAN_MADE: 1,
# 储能
"储能": TITLE_FLAG,
FieldStore.Entity.ENERGY_MULTIPILER: 1,
FieldStore.Entity.SAVE_ENERGY: 1,
FieldStore.Entity.ENERGY_REGENERATION: 1,
# 掉落物
FieldStore.Entity.MAX_ENERGY: 200,
"子弹": TITLE_FLAG,
FieldStore.Entity.PENERATE: 0,
FieldStore.Entity.OFFSET_SHOOT: 3,
FieldStore.Entity.EXTRA_BULLET_COUNT: 0,
FieldStore.Entity.BULLET_SPLIT: 0,
FieldStore.Entity.BULLET_REFRACTION: 0,
"速度": TITLE_FLAG,
FieldStore.Entity.MOVEMENT_SPEED: 1,
FieldStore.Entity.ATTACK_SPEED: 1,
"伤害": TITLE_FLAG,
FieldStore.Entity.DAMAGE_MULTIPILER: 1,
FieldStore.Entity.CRIT_RATE: 0.05,
FieldStore.Entity.CRIT_DAMAGE: 1,
"概率": TITLE_FLAG,
FieldStore.Entity.LUCK_VALUE: 1,
"饲料": TITLE_FLAG,
FieldStore.Entity.PRICE_REDUCTION: 0,
FieldStore.Entity.FEED_COUNT_SHOW: 3,
FieldStore.Entity.FEED_COUNT_CAN_MADE: 1,
"掉落物": TITLE_FLAG,
FieldStore.Entity.DROPPED_ITEM_COLLECT_RADIUS: 60,
}
var attackCooldownMap = {
@@ -211,6 +213,7 @@ func trySprint():
await TickTool.until(func(): return !sprinting)
trailing = false
func tryDie(by: BulletBase):
if is_queued_for_deletion(): return
for drop in range(min(len(drops), len(dropCounts))):
var item = drops[drop]
var count = ceil(randf_range(dropCounts[drop].x, dropCounts[drop].y))
@@ -233,6 +236,7 @@ func tryHeal(count: float):
playSound("heal")
healed.emit(heal(count * fields.get(FieldStore.Entity.HEAL_ABILITY)))
healthChanged.emit(health)
func findWeaponAnchor(weaponName: String):
var anchor = $"%weapons".get_node(weaponName)
if anchor is Node2D:
+40 -3
View File
@@ -9,9 +9,20 @@ enum Quality {
EPIC,
LEGENDARY,
}
enum Topic {
SURVIVAL,
ENERGY,
BULLET,
SPEED,
DAMAGE,
PROBABILITY,
FEED,
DROP,
}
@export var displayName: String = "未命名饲料"
@export var quality: Quality = Quality.COMMON
@export var topic: Topic = Topic.SURVIVAL
@export var qualityColorMap = {
Quality.WASTE: Color(),
Quality.COMMON: Color(),
@@ -38,19 +49,45 @@ enum Quality {
Quality.COMMON: - 1,
Quality.RARE: 0,
Quality.EPIC: 1,
Quality.LEGENDARY: 2
Quality.LEGENDARY: 2,
}
@export var topicNameMap = {
Topic.SURVIVAL: "生存",
Topic.ENERGY: "储能",
Topic.BULLET: "子弹",
Topic.SPEED: "速度",
Topic.DAMAGE: "伤害",
Topic.PROBABILITY: "概率",
Topic.FEED: "饲料",
Topic.DROP: "掉落物",
}
@export var topicColorMap = {
Topic.SURVIVAL: Color(),
Topic.ENERGY: Color(),
Topic.BULLET: Color(),
Topic.SPEED: Color(),
Topic.DAMAGE: Color(),
Topic.PROBABILITY: Color(),
Topic.FEED: Color(),
Topic.DROP: Color(),
}
@onready var qualityLabel: Label = $"%quality"
@onready var topicLabel: Label = $"%topic"
@onready var nameLabel: RichTextLabel = $"%label"
func _ready():
qualityLabel.label_settings = qualityLabel.label_settings.duplicate()
topicLabel.label_settings = topicLabel.label_settings.duplicate()
func _physics_process(_delta):
qualityLabel.text = "[%s]" % qualityNameMap[quality]
qualityLabel.label_settings.font_color = color()
qualityLabel.label_settings.font_color = qualityColor()
topicLabel.text = "[%s]" % topicNameMap[topic]
topicLabel.label_settings.font_color = topicColor()
nameLabel.text = "[b]%s[/b]" % displayName
func color():
func qualityColor():
return qualityColorMap[quality] as Color
func topicColor():
return topicColorMap[topic] as Color
func weight(player: EntityBase) -> int:
return floor(clamp(qualityRandomWeight[quality] + luckInfluence[quality] * player.fields[FieldStore.Entity.LUCK_VALUE], 1, INF))
+16 -14
View File
@@ -10,32 +10,34 @@ var collecting: bool = false
@onready var animator: AnimationPlayer = $"%animator"
func _ready():
apply_force(MathTool.randv2_range(30000), MathTool.randv2_range(10))
await TickTool.millseconds(100)
body_entered.connect(
func(body):
if body is ItemDropped and !body.collecting:
if body.item == item:
body.stackCount += stackCount
collect()
)
func _process(_delta):
texture.texture = ItemStore.getTexture(item)
func _physics_process(_delta):
if !is_instance_valid(targetPlayer):
targetPlayer = findPlayer()
targetPlayer = EntityTool.findClosetPlayer(position, WorldManager.tree)
if is_instance_valid(targetPlayer):
if collecting:
linear_velocity = Vector2.ZERO
else:
var direction = (targetPlayer.position - position).normalized()
var speed = 5000.0 / ((targetPlayer.position - position).length() ** (1 / 3.0))
var speed = 10000.0 / ((targetPlayer.position - position).length() ** (1 / 3.0))
apply_central_force(direction * speed)
angular_velocity = linear_velocity.length() ** (1.0 / 2.25) # 角速度=线速度的2.25次根号
if position.distance_to(targetPlayer.position) < targetPlayer.fields.get(FieldStore.Entity.DROPPED_ITEM_COLLECT_RADIUS):
targetPlayer.collectItem(item, stackCount)
collect()
if targetPlayer.sprinting:
apply_central_force((position - targetPlayer.texture.global_position).normalized() * targetPlayer.velocity.length() * 10)
else:
targetPlayer.collectItem(item, stackCount)
collect()
func findPlayer() -> EntityBase:
var result = null
var lastDistance = INF
for player in get_tree().get_nodes_in_group("players"):
if player is EntityBase:
if position.distance_to(player.position) < lastDistance:
lastDistance = position.distance_to(player.position)
result = player
return result
func collect():
collecting = true
animator.play("collect")
+4 -1
View File
@@ -39,7 +39,10 @@ func _physics_process(_delta):
for i in fields.get_children():
fields.remove_child(i)
for i in player.fields:
fields.add_child(FieldShow.create(i, player.fields[i], false, player, true))
if player.fields[i] == EntityBase.TITLE_FLAG:
fields.add_child(QuickUI.graySmallText(i))
else:
fields.add_child(FieldShow.create(i, player.fields[i], false, player, true))
fieldsAnimator.play("show")
if Input.is_action_just_released("showFields"):
fieldsAnimator.play("hide")
+78
View File
@@ -0,0 +1,78 @@
@tool
extends HBoxContainer
class_name WeaponName
enum Quality {
WASTE,
COMMON,
RARE,
EPIC,
LEGENDARY,
}
enum TypeTopic {
IMPACT,
ENERGY,
TEMPERATURE,
}
@export var displayName: String = "未命名武器"
@export var quality: Quality = Quality.COMMON
@export var typeTopic: TypeTopic = TypeTopic.IMPACT
@export var qualityColorMap = {
Quality.WASTE: Color(),
Quality.COMMON: Color(),
Quality.RARE: Color(),
Quality.EPIC: Color(),
Quality.LEGENDARY: Color()
}
@export var qualityNameMap = {
Quality.WASTE: "常见",
Quality.COMMON: "普通",
Quality.RARE: "稀有",
Quality.EPIC: "史诗",
Quality.LEGENDARY: "传说"
}
@export var qualityRandomWeight = {
Quality.WASTE: 20,
Quality.COMMON: 100,
Quality.RARE: 30,
Quality.EPIC: 10,
Quality.LEGENDARY: 5
}
@export var luckInfluence = {
Quality.WASTE: - 0.5,
Quality.COMMON: - 1,
Quality.RARE: 0,
Quality.EPIC: 1,
Quality.LEGENDARY: 2,
}
@export var typeTopicNameMap = {
TypeTopic.IMPACT: "冲击",
TypeTopic.ENERGY: "能量",
TypeTopic.TEMPERATURE: "熔融",
}
@export var typeTopicColorMap = {
TypeTopic.IMPACT: Color(),
TypeTopic.ENERGY: Color(),
TypeTopic.TEMPERATURE: Color(),
}
@onready var qualityLabel: Label = $"%quality"
@onready var typeTopicLabel: Label = $"%typeTopic"
@onready var nameLabel: RichTextLabel = $"%label"
func _ready():
qualityLabel.label_settings = qualityLabel.label_settings.duplicate()
typeTopicLabel.label_settings = typeTopicLabel.label_settings.duplicate()
func _physics_process(_delta):
qualityLabel.text = "[%s]" % qualityNameMap[quality]
qualityLabel.label_settings.font_color = qualityColor()
typeTopicLabel.text = "[%s]" % typeTopicNameMap[typeTopic]
typeTopicLabel.label_settings.font_color = typeTopicColor()
nameLabel.text = "[b]%s[/b]" % displayName
func qualityColor():
return qualityColorMap[quality] as Color
func typeTopicColor():
return typeTopicColorMap[typeTopic] as Color
func weight(player: EntityBase) -> int:
return floor(clamp(qualityRandomWeight[quality] + luckInfluence[quality] * player.fields[FieldStore.Entity.LUCK_VALUE], 1, INF))
+2
View File
@@ -7,6 +7,7 @@ signal selected(applied: bool)
@export var avatarTexture: Texture2D = preload("res://icon.svg")
@export var displayName: String = "未命名饲料"
@export var quality: FeedName.Quality = FeedName.Quality.COMMON
@export var topic: FeedName.Topic = FeedName.Topic.SURVIVAL
@export var fields: Array[FieldStore.Entity] = []
@export var fieldValues: Array[float] = []
@export var costs: Array[ItemStore.ItemType] = []
@@ -60,6 +61,7 @@ func rebuildInfo():
avatarRect.texture = avatarTexture
nameLabel.displayName = displayName
nameLabel.quality = quality
nameLabel.topic = topic
for i in fieldsBox.get_children():
i.queue_free()
var noField = true
+87
View File
@@ -0,0 +1,87 @@
@tool
extends PanelContainer
class_name Weapon
signal selected(applied: bool)
@export var avatarTexture: Texture2D = preload("res://icon.svg")
@export var displayName: String = "未命名饲料"
@export var quality: WeaponName.Quality = WeaponName.Quality.COMMON
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
@export var costs: Array[ItemStore.ItemType] = []
@export var costCounts: Array[int] = []
@export var store: Dictionary = {
"atk": 10
}
@export var descriptionTemplate: String = "造成$atk点伤害。"
@export var needEnergy: float = 0
@export var cooldown: float = 100
@onready var avatarRect: TextureRect = $"%avatar"
@onready var nameLabel: WeaponName = $"%name"
@onready var energyLabel: Label = $"%energy"
@onready var descriptionLabel: RichTextLabel = $"%description"
@onready var costsBox: GridContainer = $"%costs"
@onready var selectButton: Button = $"%selectBtn"
func _ready():
selectButton.pressed.connect(
func():
apply(UIState.player)
)
rebuildInfo()
func _physics_process(_delta: float):
descriptionLabel.text = buildDescription()
func allHad(entity: EntityBase) -> bool:
var allHave = true
for i in range(min(costs.size(), costCounts.size())):
var item = costs[i]
var count = costCounts[i] * multipiler()
if entity.inventory[item] < count:
allHave = false
break
return allHave
func apply(entity: EntityBase):
var allHave = allHad(entity)
if allHave:
for i in range(min(costs.size(), costCounts.size())):
var item = costs[i]
var count = costCounts[i] * multipiler()
entity.inventory[item] -= count
hide()
selected.emit(allHave)
return allHave
func multipiler() -> float:
if is_instance_valid(UIState.player):
return 1 - UIState.player.fields.get(FieldStore.Entity.PRICE_REDUCTION)
else:
return 1
func rebuildInfo():
avatarRect.texture = avatarTexture
nameLabel.displayName = displayName
nameLabel.quality = quality
nameLabel.typeTopic = typeTopic
energyLabel.text = "%.1f" % needEnergy
for i in costsBox.get_children():
i.queue_free()
for i in range(min(costs.size(), costCounts.size())):
var cost = costs[i]
var count = costCounts[i]
var costShow: ItemShow = preload("res://components/UI/ItemShow.tscn").instantiate()
costShow.type = cost
costShow.count = int(count * multipiler())
costsBox.add_child(costShow)
func buildDescription():
var result = descriptionTemplate
for key in store.keys():
result = result.replace("$" + key, "[color=cyan]%.1f[/color]" % readStore(key))
return result
func readStore(key: String, default: Variant = null):
return store.get(key, default)
# 抽象
func update(_to: int, _origin: Dictionary, _entity: EntityBase):
pass
func attack(_entity: EntityBase):
pass
+16
View File
@@ -8,3 +8,19 @@ static func fromHurtbox(node: Node) -> EntityBase:
if entity is EntityBase:
return entity as EntityBase
return null
static func findClosetEntity(to: Vector2, fromTree: SceneTree, player: bool = false, mob: bool = false, excludes: Array[EntityBase] = []) -> EntityBase:
var result = null
var lastDistance = INF
var nodes = []
if player:
nodes += fromTree.get_nodes_in_group("players")
if mob:
nodes += fromTree.get_nodes_in_group("mobs")
for entity in nodes:
if entity is EntityBase and entity not in excludes:
if to.distance_to(entity.position) < lastDistance:
lastDistance = to.distance_to(entity.position)
result = entity
return result
static func findClosetPlayer(to: Vector2, fromTree: SceneTree, excludes: Array[EntityBase] = []) -> EntityBase:
return findClosetEntity(to, fromTree, true, false, excludes)
+9 -3
View File
@@ -28,7 +28,9 @@ enum Entity {
LUCK_VALUE,
SAVE_ENERGY,
ENERGY_REGENERATION,
DROPPED_ITEM_COLLECT_RADIUS
DROPPED_ITEM_COLLECT_RADIUS,
BULLET_SPLIT,
BULLET_REFRACTION
}
static var entityMap = {
Entity.MAX_HEALTH: "生命上限",
@@ -44,7 +46,7 @@ static var entityMap = {
Entity.ENERGY_MULTIPILER: "储能倍率",
Entity.PENARATION_RESISTANCE: "穿透抗性",
Entity.PRICE_REDUCTION: "饲料降价",
Entity.EXTRA_BULLET_COUNT: "额外子弹",
Entity.EXTRA_BULLET_COUNT: "多重射击",
Entity.DROP_APPLE_RATE: "苹果掉落率",
Entity.FEED_COUNT_SHOW: "饲料列表",
Entity.FEED_COUNT_CAN_MADE: "可制作饲料",
@@ -53,6 +55,8 @@ static var entityMap = {
Entity.SAVE_ENERGY: "节能",
Entity.ENERGY_REGENERATION: "能量再生效率",
Entity.DROPPED_ITEM_COLLECT_RADIUS: "掉落物拾取距离",
Entity.BULLET_SPLIT: "分裂",
Entity.BULLET_REFRACTION: "折射",
}
static var entityMapType = {
Entity.MAX_HEALTH: DataType.VALUE,
@@ -77,6 +81,8 @@ static var entityMapType = {
Entity.SAVE_ENERGY: DataType.PERCENT,
Entity.ENERGY_REGENERATION: DataType.PERCENT,
Entity.DROPPED_ITEM_COLLECT_RADIUS: DataType.VALUE,
Entity.BULLET_SPLIT: DataType.VALUE,
Entity.BULLET_REFRACTION: DataType.VALUE,
}
static var entityMaxValueMap = {
Entity.CRIT_RATE: 0.8,
@@ -96,7 +102,7 @@ static var entityApplier = {
return true
,
Entity.EXTRA_BULLET_COUNT: func(entity, value):
entity.fields[Entity.OFFSET_SHOOT] += value * 5
entity.fields[Entity.OFFSET_SHOOT] += value * 3
return true
,
}
+3 -1
View File
@@ -1,6 +1,6 @@
class_name MathTool
static func rate(value: float):
static func rate(value: float) -> bool:
return randf() < value
static func randv2_range(offset: float):
return Vector2(
@@ -13,3 +13,5 @@ static func signBeforeStr(value: float):
return ("+" if value > 0 else "-" if value < 0 else "") + str(abs(value))
static func percent(value: float):
return value / 100
static func shrimpRate(value: float):
return floor(value) + int(rate(value - floor(value)))
+9
View File
@@ -7,3 +7,12 @@ static func smallText(text: String, center: bool = true):
if center:
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
return label
static func graySmallText(text: String, center: bool = true):
var label = Label.new()
label.text = text
label.label_settings = LabelSettings.new()
label.label_settings.font_size = 12
label.label_settings.font_color = Color(0.6, 0.6, 0.6, 1)
if center:
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
return label