mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-12 22:57:13 +08:00
refactor(武器系统): 优化武器升级计算和描述显示
修改武器升级计算公式,将指数运算改为线性运算以提高性能 在武器描述中显示当前值和升级后的值 调整costBeachball的默认值从500改为100
This commit is contained in:
@@ -29,6 +29,7 @@ offset_right = 350.0
|
|||||||
offset_bottom = 304.0
|
offset_bottom = 304.0
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr")
|
||||||
script = ExtResource("1_g802t")
|
script = ExtResource("1_g802t")
|
||||||
|
costBeachball = 500
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="sounds" type="Node2D" parent="."]
|
[node name="sounds" type="Node2D" parent="."]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class_name BigLaserWeapon
|
|||||||
|
|
||||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||||
origin["atk"] += 5 * to * soulLevel
|
origin["atk"] += 5 * to * soulLevel
|
||||||
origin["time"] /= 1.05 ** soulLevel * to
|
origin["time"] /= 1 + 0.05 * to * soulLevel
|
||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
|||||||
origin["count"] += to * soulLevel
|
origin["count"] += to * soulLevel
|
||||||
origin["power"] += 0.05 * to * soulLevel
|
origin["power"] += 0.05 * to * soulLevel
|
||||||
origin["trace"] += 0.25 * to * soulLevel
|
origin["trace"] += 0.25 * to * soulLevel
|
||||||
origin["angle"] /= 1.05 ** soulLevel * to
|
origin["angle"] /= 1 + 0.05 * to * soulLevel
|
||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ class_name VectorStarWeapon
|
|||||||
|
|
||||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||||
origin["atk"] += 5 * to * soulLevel
|
origin["atk"] += 5 * to * soulLevel
|
||||||
origin["forwardtime"] /= 1.05 ** soulLevel * to
|
origin["forwardtime"] /= 1 + 0.05 * to * soulLevel
|
||||||
origin["maxcount"] += 1 * level * soulLevel
|
origin["maxcount"] += 1 * to * soulLevel
|
||||||
return origin
|
return origin
|
||||||
func attack(entity: EntityBase):
|
func attack(entity: EntityBase):
|
||||||
var weaponPos = entity.findWeaponAnchor("normal")
|
var weaponPos = entity.findWeaponAnchor("normal")
|
||||||
|
|||||||
+19
-11
@@ -7,7 +7,7 @@ class_name Weapon
|
|||||||
@export var quality: WeaponName.Quality = WeaponName.Quality.COMMON
|
@export var quality: WeaponName.Quality = WeaponName.Quality.COMMON
|
||||||
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
|
@export var typeTopic: WeaponName.TypeTopic = WeaponName.TypeTopic.IMPACT
|
||||||
@export var soulLevel: int = 1
|
@export var soulLevel: int = 1
|
||||||
@export var costBeachball: int = 500
|
@export var costBeachball: int = 100
|
||||||
@export var store: Dictionary = {
|
@export var store: Dictionary = {
|
||||||
"atk": 10
|
"atk": 10
|
||||||
}
|
}
|
||||||
@@ -100,20 +100,28 @@ func rebuildInfo():
|
|||||||
beachballLabel.text = str(costBeachball)
|
beachballLabel.text = str(costBeachball)
|
||||||
soulLabel.text = str(soulLevel)
|
soulLabel.text = str(soulLevel)
|
||||||
descriptionLabel.text = buildDescription()
|
descriptionLabel.text = buildDescription()
|
||||||
|
func formatValue(value: Variant, type: FieldStore.DataType) -> String:
|
||||||
|
if type == FieldStore.DataType.VALUE:
|
||||||
|
return "%.2f" % value
|
||||||
|
elif type == FieldStore.DataType.INTEGER:
|
||||||
|
return "%d" % value
|
||||||
|
elif type == FieldStore.DataType.PERCENT:
|
||||||
|
return ("%d" % (value * 100)) + "%"
|
||||||
|
elif type == FieldStore.DataType.ANGLE:
|
||||||
|
return "%.1f°" % value
|
||||||
|
else:
|
||||||
|
return str(value)
|
||||||
func buildDescription() -> String:
|
func buildDescription() -> String:
|
||||||
|
var current = store
|
||||||
|
var next = update(level + 1, originalStore.duplicate(), UIState.player)
|
||||||
var result = descriptionTemplate
|
var result = descriptionTemplate
|
||||||
for key in store.keys():
|
for key in store.keys():
|
||||||
var data = store[key]
|
var data = current[key]
|
||||||
|
var nextData = next[key]
|
||||||
var type = storeType.get(key, FieldStore.DataType.VALUE)
|
var type = storeType.get(key, FieldStore.DataType.VALUE)
|
||||||
if type == FieldStore.DataType.VALUE:
|
data = formatValue(data, type)
|
||||||
data = "%.2f" % data
|
nextData = formatValue(nextData, type)
|
||||||
elif type == FieldStore.DataType.INTEGER:
|
result = result.replace("$" + key, "[color=cyan]%s[/color]→[color=yellow]%s[/color]" % [data, nextData])
|
||||||
data = "%d" % data
|
|
||||||
elif type == FieldStore.DataType.PERCENT:
|
|
||||||
data = ("%d" % (data * 100)) + "%"
|
|
||||||
elif type == FieldStore.DataType.ANGLE:
|
|
||||||
data = "%.1f°" % data
|
|
||||||
result = result.replace("$" + key, "[color=cyan]%s[/color]" % data)
|
|
||||||
return "[center]%s[/center]" % result
|
return "[center]%s[/center]" % result
|
||||||
func readStore(key: String, default: Variant = null):
|
func readStore(key: String, default: Variant = null):
|
||||||
return store.get(key, default)
|
return store.get(key, default)
|
||||||
|
|||||||
Reference in New Issue
Block a user