From 19e7d7691dd8010bc2af6501872b759dfc15fa83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sat, 6 Sep 2025 16:11:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=AD=A6=E5=99=A8=E7=B3=BB=E7=BB=9F):?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E6=AD=A6=E5=99=A8=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=A0=BC=E5=BC=8F=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统一武器数值显示格式,将浮点数显示为整数或保留两位小数。修改storeType从数组改为字典结构以提高可读性。调整部分武器参数平衡性,包括BigLaser的时间系数和LGBTWeapon的power增量。移除VectorStarWeapon的mincount升级逻辑。为所有武器组件添加debugRebuild标志和默认500点costBeachball值。在FieldShow.gd中新增INTEGER数据类型处理。更新武器描述模板中的数值格式化逻辑。 --- components/Abstracts/WeaponCardBase.tscn | 3 +-- components/Weapons/BigLaser.tscn | 14 +++++++++----- components/Weapons/LGBT.tscn | 14 ++++++++++++-- components/Weapons/PurpleCrystal.tscn | 9 ++++++++- components/Weapons/VectorStar.tscn | 15 ++++++++++++--- scripts/Contents/Weapons/BigLaser.gd | 2 +- scripts/Contents/Weapons/LGBTWeapon.gd | 2 +- scripts/Contents/Weapons/VectorStarWeapon.gd | 1 - scripts/Statemachine/FieldShow.gd | 2 ++ scripts/Structs/Weapon.gd | 18 +++++++++--------- scripts/Tools/FieldStore.gd | 7 ++++--- 11 files changed, 59 insertions(+), 28 deletions(-) diff --git a/components/Abstracts/WeaponCardBase.tscn b/components/Abstracts/WeaponCardBase.tscn index ea4d75f..d4906ca 100644 --- a/components/Abstracts/WeaponCardBase.tscn +++ b/components/Abstracts/WeaponCardBase.tscn @@ -28,7 +28,6 @@ offset_right = 350.0 offset_bottom = 304.0 theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr") script = ExtResource("1_g802t") -costBeachball = 100 metadata/_edit_lock_ = true [node name="sounds" type="Node2D" parent="."] @@ -112,7 +111,7 @@ displayName = "未命名饲料" unique_name_in_owner = true layout_mode = 2 bbcode_enabled = true -text = "[center]造成[color=cyan]10.0[/color]点伤害。[/center]" +text = "[center]造成[color=cyan]10.00[/color]点伤害。[/center]" fit_content = true [node name="costs" type="GridContainer" parent="container"] diff --git a/components/Weapons/BigLaser.tscn b/components/Weapons/BigLaser.tscn index 4f63ca4..582417a 100644 --- a/components/Weapons/BigLaser.tscn +++ b/components/Weapons/BigLaser.tscn @@ -11,19 +11,20 @@ avatarTexture = ExtResource("2_qe8gb") displayName = "湮灭激光" quality = 2 typeTopic = 1 -costs = Array[int]([0, 1]) -costCounts = Array[int]([100, 50]) store = { "atk": 40, "time": 0.1 } -storeType = Array[int]([0, 0]) +storeType = { +"atk": 1, +"time": 0.0 +} descriptionTemplate = "每$time秒造成$atk点伤害。" needEnergy = 100.0 cooldown = 6000.0 +debugRebuild = true [node name="attack" parent="sounds" index="0"] -process_mode = 3 stream = ExtResource("4_cb5nh") [node name="avatar" parent="container/info" index="0"] @@ -32,10 +33,13 @@ texture = ExtResource("2_qe8gb") [node name="energy" parent="container/info/infos/energyInfo" index="1"] text = "100.0" +[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] +text = "500" + [node name="name" parent="container/info" index="2"] displayName = "湮灭激光" quality = 2 typeTopic = 1 [node name="description" parent="container" index="2"] -text = "[center]每[color=cyan]0.1[/color]秒造成[color=cyan]40.0[/color]点伤害。[/center]" +text = "[center]每[color=cyan]0.10[/color]秒造成[color=cyan]40[/color]点伤害。[/center]" diff --git a/components/Weapons/LGBT.tscn b/components/Weapons/LGBT.tscn index b7a8960..cf42735 100644 --- a/components/Weapons/LGBT.tscn +++ b/components/Weapons/LGBT.tscn @@ -18,10 +18,17 @@ store = { "power": 0.15, "trace": 2.0 } -storeType = Array[int]([2, 0, 0, 1, 0]) +storeType = { +"angle": 3.0, +"atk": 1, +"count": 1.0, +"power": 2.0, +"trace": 0.0 +} descriptionTemplate = "发射$count条,每条间分隔$angle,可追踪$trace秒,效率为$power的带状彩虹,每条造成$atk点伤害。" needEnergy = 50.0 cooldown = 500.0 +debugRebuild = true [node name="attack" parent="sounds" index="0"] stream = ExtResource("4_c5xse") @@ -32,6 +39,9 @@ texture = ExtResource("2_ou6jo") [node name="energy" parent="container/info/infos/energyInfo" index="1"] text = "50.0" +[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] +text = "500" + [node name="name" parent="container/info" index="2"] displayName = "彩虹旗" quality = 4 @@ -43,5 +53,5 @@ typeTopicNameMap = { [node name="description" parent="container" index="2"] size_flags_vertical = 3 -text = "[center]发射[color=cyan]7.0[/color]条,每条间分隔[color=cyan]30.0°[/color],可追踪[color=cyan]2.0[/color]秒,效率为[color=cyan]15.0%[/color]的带状彩虹,每条造成[color=cyan]20.0[/color]点伤害。[/center]" +text = "[center]发射[color=cyan]7[/color]条,每条间分隔[color=cyan]30.0°[/color],可追踪[color=cyan]2.00[/color]秒,效率为[color=cyan]15%[/color]的带状彩虹,每条造成[color=cyan]20[/color]点伤害。[/center]" autowrap_mode = 2 diff --git a/components/Weapons/PurpleCrystal.tscn b/components/Weapons/PurpleCrystal.tscn index 585a7ef..ab28652 100644 --- a/components/Weapons/PurpleCrystal.tscn +++ b/components/Weapons/PurpleCrystal.tscn @@ -10,8 +10,12 @@ offset_bottom = 302.0 script = ExtResource("2_0xgcv") avatarTexture = ExtResource("2_wgtcw") displayName = "紫水晶簇" +storeType = { +"atk": 1 +} descriptionTemplate = "撞击造成$atk点伤害。" cooldown = 200.0 +debugRebuild = true [node name="attack" parent="sounds" index="0"] stream = ExtResource("4_16daa") @@ -19,8 +23,11 @@ stream = ExtResource("4_16daa") [node name="avatar" parent="container/info" index="0"] texture = ExtResource("2_wgtcw") +[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] +text = "500" + [node name="name" parent="container/info" index="2"] displayName = "紫水晶簇" [node name="description" parent="container" index="2"] -text = "[center]撞击造成[color=cyan]10.0[/color]点伤害。[/center]" +text = "[center]撞击造成[color=cyan]10[/color]点伤害。[/center]" diff --git a/components/Weapons/VectorStar.tscn b/components/Weapons/VectorStar.tscn index bd4f9de..0d81128 100644 --- a/components/Weapons/VectorStar.tscn +++ b/components/Weapons/VectorStar.tscn @@ -15,9 +15,15 @@ store = { "maxcount": 6, "mincount": 3 } -storeType = Array[int]([0, 0, 0, 0]) -descriptionTemplate = "发射$mincount~$maxcount个[b]无主的矢量星[/b],在$forwardtime秒后向目标冲刺并造成$atk点伤害。" +storeType = { +"atk": 1, +"forwardtime": 0.0, +"maxcount": 1.0, +"mincount": 1.0 +} +descriptionTemplate = "发射$mincount~$maxcount个[b]无主[/b]的矢量星,在$forwardtime秒后向目标冲刺并造成$atk点伤害。" needEnergy = 20.0 +debugRebuild = true [node name="avatar" parent="container/info" index="0"] texture = ExtResource("3_wfty8") @@ -25,9 +31,12 @@ texture = ExtResource("3_wfty8") [node name="energy" parent="container/info/infos/energyInfo" index="1"] text = "20.0" +[node name="beachball" parent="container/info/infos/beachballInfo" index="1"] +text = "500" + [node name="name" parent="container/info" index="2"] displayName = "星辰核心" quality = 2 [node name="description" parent="container" index="2"] -text = "[center]发射[color=cyan]3.0[/color]~[color=cyan]6.0[/color]个[b]无主的矢量星[/b],在[color=cyan]1.0[/color]秒后向目标冲刺并造成[color=cyan]5.0[/color]点伤害。[/center]" +text = "[center]发射[color=cyan]3[/color]~[color=cyan]6[/color]个[b]无主[/b]的矢量星,在[color=cyan]1.00[/color]秒后向目标冲刺并造成[color=cyan]5[/color]点伤害。[/center]" diff --git a/scripts/Contents/Weapons/BigLaser.gd b/scripts/Contents/Weapons/BigLaser.gd index 9d99151..5dd4056 100644 --- a/scripts/Contents/Weapons/BigLaser.gd +++ b/scripts/Contents/Weapons/BigLaser.gd @@ -4,7 +4,7 @@ class_name BigLaserWeapon func update(to: int, origin: Dictionary, _entity: EntityBase): origin["atk"] += 5 * to - origin["time"] /= 1.1 + origin["time"] /= 1.05 return origin func attack(entity: EntityBase): var weaponPos = entity.findWeaponAnchor("normal") diff --git a/scripts/Contents/Weapons/LGBTWeapon.gd b/scripts/Contents/Weapons/LGBTWeapon.gd index b36258b..abf3e6c 100644 --- a/scripts/Contents/Weapons/LGBTWeapon.gd +++ b/scripts/Contents/Weapons/LGBTWeapon.gd @@ -5,7 +5,7 @@ class_name LGBTWeapon func update(to: int, origin: Dictionary, _entity: EntityBase): origin["atk"] += 2 * to origin["count"] += to - origin["power"] += 0.01 * level + origin["power"] += 0.05 * level origin["trace"] += 0.25 * level origin["angle"] /= 1.05 * level return origin diff --git a/scripts/Contents/Weapons/VectorStarWeapon.gd b/scripts/Contents/Weapons/VectorStarWeapon.gd index be0434b..d88c9d1 100644 --- a/scripts/Contents/Weapons/VectorStarWeapon.gd +++ b/scripts/Contents/Weapons/VectorStarWeapon.gd @@ -5,7 +5,6 @@ class_name VectorStarWeapon func update(to: int, origin: Dictionary, _entity: EntityBase): origin["atk"] += 2 * to origin["forwardtime"] /= 1.05 * to - origin["mincount"] += 1 * level origin["maxcount"] += 1 * level return origin func attack(entity: EntityBase): diff --git a/scripts/Statemachine/FieldShow.gd b/scripts/Statemachine/FieldShow.gd index bb4c32a..2695753 100644 --- a/scripts/Statemachine/FieldShow.gd +++ b/scripts/Statemachine/FieldShow.gd @@ -21,6 +21,8 @@ func _ready(): var dataType = FieldStore.entityMapType[field] if dataType == FieldStore.DataType.VALUE: formattedValue = "%s" % (MathTool.signBeforeStr(value) if showSign else str(value)) + elif dataType == FieldStore.DataType.INTEGER: + formattedValue = "%s" % (MathTool.signBeforeStr(int(value)) if showSign else str(int(value))) elif dataType == FieldStore.DataType.ANGLE: formattedValue = "%s°" % (MathTool.signBeforeStr(value) if showSign else str(value)) elif dataType == FieldStore.DataType.PERCENT: diff --git a/scripts/Structs/Weapon.gd b/scripts/Structs/Weapon.gd index 36fbf5e..4ad80ab 100644 --- a/scripts/Structs/Weapon.gd +++ b/scripts/Structs/Weapon.gd @@ -6,13 +6,13 @@ class_name Weapon @export var displayName: String = "未命名饲料" @export var quality: WeaponName.Quality = WeaponName.Quality.COMMON @export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT -@export var costBeachball: int = 0 +@export var costBeachball: int = 500 @export var store: Dictionary = { "atk": 10 } -@export var storeType: Array[FieldStore.DataType] = [ - FieldStore.DataType.VALUE -] +@export var storeType: Dictionary = { + "atk": FieldStore.DataType.VALUE +} @export var descriptionTemplate: String = "造成$atk点伤害。" @export var needEnergy: float = 0 @export var cooldown: float = 100 @@ -73,18 +73,18 @@ func rebuildInfo(): descriptionLabel.text = buildDescription() func buildDescription() -> String: var result = descriptionTemplate - var i = 0 for key in store.keys(): var data = store[key] - var type = storeType[i] + var type = storeType.get(key, FieldStore.DataType.VALUE) if type == FieldStore.DataType.VALUE: - data = "%.1f" % data + data = "%.2f" % data + elif type == FieldStore.DataType.INTEGER: + data = "%d" % data elif type == FieldStore.DataType.PERCENT: - data = ("%.1f" % (data * 100)) + "%" + data = ("%d" % (data * 100)) + "%" elif type == FieldStore.DataType.ANGLE: data = "%.1f°" % data result = result.replace("$" + key, "[color=cyan]%s[/color]" % data) - i += 1 return "[center]%s[/center]" % result func readStore(key: String, default: Variant = null): return store.get(key, default) diff --git a/scripts/Tools/FieldStore.gd b/scripts/Tools/FieldStore.gd index 5a33f5d..351db76 100644 --- a/scripts/Tools/FieldStore.gd +++ b/scripts/Tools/FieldStore.gd @@ -3,6 +3,7 @@ class_name FieldStore enum DataType { VALUE, + INTEGER, PERCENT, ANGLE } @@ -70,14 +71,14 @@ static var entityMapType = { Entity.PENERATE: DataType.PERCENT, Entity.OFFSET_SHOOT: DataType.ANGLE, Entity.HEAL_ABILITY: DataType.PERCENT, - Entity.EXTRA_APPLE_MAX: DataType.VALUE, + Entity.EXTRA_APPLE_MAX: DataType.INTEGER, Entity.ENERGY_MULTIPILER: DataType.PERCENT, Entity.PENARATION_RESISTANCE: DataType.PERCENT, Entity.PRICE_REDUCTION: DataType.PERCENT, Entity.EXTRA_BULLET_COUNT: DataType.VALUE, Entity.DROP_APPLE_RATE: DataType.PERCENT, - Entity.FEED_COUNT_SHOW: DataType.VALUE, - Entity.FEED_COUNT_CAN_MADE: DataType.VALUE, + Entity.FEED_COUNT_SHOW: DataType.INTEGER, + Entity.FEED_COUNT_CAN_MADE: DataType.INTEGER, Entity.MAX_ENERGY: DataType.VALUE, Entity.LUCK_VALUE: DataType.VALUE, Entity.SAVE_ENERGY: DataType.PERCENT,