mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
feat(武器系统): 添加灵魂等级机制并重构武器升级逻辑
- 在UI中添加灵魂资源显示和操作按钮 - 修改武器升级公式加入灵魂等级系数 - 实现灵魂的提取和镶嵌功能 - 为武器卡牌添加灵魂等级颜色映射 - 初始化玩家灵魂资源为10个
This commit is contained in:
@@ -3,8 +3,8 @@ extends Weapon
|
||||
class_name BigLaserWeapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 5 * to
|
||||
origin["time"] /= 1.05
|
||||
origin["atk"] += 5 * to * soulLevel
|
||||
origin["time"] /= 1.05 ** soulLevel * to
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
|
||||
@@ -3,11 +3,11 @@ extends Weapon
|
||||
class_name LGBTWeapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 5 * to
|
||||
origin["count"] += to
|
||||
origin["power"] += 0.05 * level
|
||||
origin["trace"] += 0.25 * level
|
||||
origin["angle"] /= 1.05 * level
|
||||
origin["atk"] += 5 * to * soulLevel
|
||||
origin["count"] += to * soulLevel
|
||||
origin["power"] += 0.05 * to * soulLevel
|
||||
origin["trace"] += 0.25 * to * soulLevel
|
||||
origin["angle"] /= 1.05 ** soulLevel * to
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
extends Weapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 0.5 * to
|
||||
origin["rate"] += 0.02 * to
|
||||
origin["count"] += 1 * level
|
||||
origin["atk"] += 1 * to * soulLevel
|
||||
origin["rate"] += 0.04 * to * soulLevel
|
||||
origin["count"] += 1 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
|
||||
@@ -3,7 +3,7 @@ extends Weapon
|
||||
class_name PurpleCrystalWeapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 5 * to
|
||||
origin["atk"] += 5 * to * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
|
||||
@@ -3,9 +3,9 @@ extends Weapon
|
||||
class_name VectorStarWeapon
|
||||
|
||||
func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
origin["atk"] += 5 * to
|
||||
origin["forwardtime"] /= 1.05 * to
|
||||
origin["maxcount"] += 1 * level
|
||||
origin["atk"] += 5 * to * soulLevel
|
||||
origin["forwardtime"] /= 1.05 ** soulLevel * to
|
||||
origin["maxcount"] += 1 * level * soulLevel
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var weaponPos = entity.findWeaponAnchor("normal")
|
||||
|
||||
@@ -57,7 +57,7 @@ var inventory = {
|
||||
ItemStore.ItemType.BASKETBALL: 500,
|
||||
ItemStore.ItemType.APPLE: 5,
|
||||
ItemStore.ItemType.BEACHBALL: 0,
|
||||
ItemStore.ItemType.SOUL: 0,
|
||||
ItemStore.ItemType.SOUL: 10,
|
||||
}
|
||||
var inventoryMax = {
|
||||
ItemStore.ItemType.BASEBALL: INF, # 无限
|
||||
@@ -349,6 +349,21 @@ func playSound(type: String):
|
||||
func tryKill():
|
||||
kill()
|
||||
await tryDie()
|
||||
func hasItem(items: Dictionary):
|
||||
for item in items:
|
||||
if inventory[item] < items[item]:
|
||||
return false
|
||||
return true
|
||||
func useItem(items: Dictionary):
|
||||
print(items)
|
||||
var state = hasItem(items)
|
||||
if state:
|
||||
for item in items:
|
||||
inventory[item] -= items[item]
|
||||
return state
|
||||
func getItem(items: Dictionary):
|
||||
for item in items:
|
||||
inventory[item] += items[item]
|
||||
|
||||
func getTrackingAnchor() -> Vector2:
|
||||
return hurtbox.get_node("hitbox").global_position
|
||||
|
||||
@@ -16,17 +16,17 @@ enum TypeTopic {
|
||||
MAGIC,
|
||||
}
|
||||
enum SoulLevel {
|
||||
NORMALIZE,
|
||||
ADD,
|
||||
MULTIPLY,
|
||||
EXPONENT,
|
||||
INFINITY,
|
||||
NORMALIZE = 1,
|
||||
ADD = 2,
|
||||
MULTIPLY = 3,
|
||||
EXPONENT = 4,
|
||||
INFINITY = 5,
|
||||
}
|
||||
|
||||
@export var displayName: String = "未命名武器"
|
||||
@export var quality: Quality = Quality.COMMON
|
||||
@export var typeTopic: TypeTopic = TypeTopic.IMPACT
|
||||
@export var soulLevel: SoulLevel = SoulLevel.NORMALIZE
|
||||
@export var soulLevel: int = SoulLevel.NORMALIZE
|
||||
@export var level: int = 0
|
||||
@export var qualityColorMap = {
|
||||
Quality.WASTE: Color(),
|
||||
|
||||
@@ -6,7 +6,7 @@ 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 soulLevel: WeaponName.SoulLevel = WeaponName.SoulLevel.NORMALIZE
|
||||
@export var soulLevel: int = 1
|
||||
@export var costBeachball: int = 500
|
||||
@export var store: Dictionary = {
|
||||
"atk": 10
|
||||
@@ -24,8 +24,11 @@ class_name Weapon
|
||||
@onready var nameLabel: WeaponName = $"%name"
|
||||
@onready var energyLabel: Label = $"%energy"
|
||||
@onready var beachballLabel: Label = $"%beachball"
|
||||
@onready var soulLabel: Label = $"%soul"
|
||||
@onready var descriptionLabel: RichTextLabel = $"%description"
|
||||
@onready var updateButton: Button = $"%updateBtn"
|
||||
@onready var updateBtn: Button = $"%updateBtn"
|
||||
@onready var extractBtn: Button = $"%extractBtn"
|
||||
@onready var inlayBtn: Button = $"%inlayBtn"
|
||||
@onready var sounds: Node2D = $"%sounds"
|
||||
|
||||
var cooldownTimer: CooldownTimer = null
|
||||
@@ -35,10 +38,26 @@ func _ready():
|
||||
cooldownTimer = CooldownTimer.new()
|
||||
cooldownTimer.cooldown = cooldown
|
||||
originalStore = store
|
||||
updateButton.pressed.connect(
|
||||
updateBtn.pressed.connect(
|
||||
func():
|
||||
apply(UIState.player)
|
||||
)
|
||||
extractBtn.pressed.connect(
|
||||
func():
|
||||
UIState.player.getItem({
|
||||
ItemStore.ItemType.SOUL: ceil((1 + soulLevel) * soulLevel / 2.0)
|
||||
})
|
||||
soulLevel = 1
|
||||
)
|
||||
inlayBtn.pressed.connect(
|
||||
func():
|
||||
if soulLevel < WeaponName.SoulLevel.INFINITY - 1:
|
||||
if UIState.player.useItem({
|
||||
ItemStore.ItemType.SOUL: soulLevel
|
||||
}):
|
||||
soulLevel += 1
|
||||
rebuildInfo()
|
||||
)
|
||||
for i in sounds.get_children():
|
||||
i.process_mode = ProcessMode.PROCESS_MODE_ALWAYS
|
||||
rebuildInfo()
|
||||
@@ -73,6 +92,7 @@ func rebuildInfo():
|
||||
nameLabel.level = level
|
||||
energyLabel.text = "%.1f" % needEnergy
|
||||
beachballLabel.text = str(costBeachball)
|
||||
soulLabel.text = str(soulLevel)
|
||||
descriptionLabel.text = buildDescription()
|
||||
func buildDescription() -> String:
|
||||
var result = descriptionTemplate
|
||||
|
||||
Reference in New Issue
Block a user