mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-09 21:27:13 +08:00
feat: 添加召唤上限功能及相关资源
添加召唤上限字段和图标,支持武器召唤数量限制 新增小丑鱼饲料资源,包含SVG图标和场景配置 更新实体状态机以支持召唤上限检查和召唤物管理
This commit is contained in:
@@ -7,6 +7,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var summon = entity.summon(ComponentManager.getSummon("HJM"))
|
||||
if !summon: return true
|
||||
summon.atk = readStore("atk")
|
||||
summon.attackTime = readStore("time") * 1000
|
||||
return true
|
||||
|
||||
@@ -11,6 +11,7 @@ func update(to: int, origin: Dictionary, _entity: EntityBase):
|
||||
return origin
|
||||
func attack(entity: EntityBase):
|
||||
var summon = entity.summon(ComponentManager.getSummon("LGBTFlag"))
|
||||
if !summon: return true
|
||||
summon.atk = readStore("atk")
|
||||
summon.maxTraceTime = readStore("trace") * 1000
|
||||
summon.tracePower = readStore("power")
|
||||
|
||||
@@ -16,6 +16,8 @@ var fields = {
|
||||
FieldStore.Entity.EXTRA_APPLE_MAX: 0,
|
||||
FieldStore.Entity.DROP_APPLE_RATE: 0,
|
||||
FieldStore.Entity.PENARATION_RESISTANCE: 0,
|
||||
"召唤": TITLE_FLAG,
|
||||
FieldStore.Entity.SUMMON_MAX: 1,
|
||||
"储能": TITLE_FLAG,
|
||||
FieldStore.Entity.MAX_ENERGY: 200,
|
||||
FieldStore.Entity.SAVE_ENERGY: 1,
|
||||
@@ -398,7 +400,15 @@ func useItem(items: Dictionary):
|
||||
func getItem(items: Dictionary):
|
||||
for item in items:
|
||||
inventory[item] = clamp(inventory[item] + items[item], 0, inventoryMax[item])
|
||||
func getMySummons() -> Array[SummonBase]:
|
||||
var result: Array[SummonBase] = []
|
||||
for entity in get_tree().get_nodes_in_group("players" if isPlayer() else "mobs"):
|
||||
if entity is SummonBase && entity.myMaster == self:
|
||||
result.append(entity)
|
||||
return result
|
||||
func summon(who: PackedScene, syncFields: bool = true, lockValue: bool = true) -> SummonBase:
|
||||
if len(getMySummons()) >= fields.get(FieldStore.Entity.SUMMON_MAX):
|
||||
return null
|
||||
var instance: SummonBase = who.instantiate()
|
||||
instance.position = position
|
||||
instance.myMaster = self
|
||||
|
||||
@@ -19,6 +19,7 @@ enum Topic {
|
||||
FEED,
|
||||
DROP,
|
||||
WEAPON,
|
||||
SUMMON,
|
||||
}
|
||||
|
||||
@export var displayName: String = "未命名饲料"
|
||||
@@ -62,6 +63,7 @@ enum Topic {
|
||||
Topic.FEED: "饲料",
|
||||
Topic.DROP: "掉落物",
|
||||
Topic.WEAPON: "武器",
|
||||
Topic.SUMMON: "召唤",
|
||||
}
|
||||
@export var topicColorMap = {
|
||||
Topic.SURVIVAL: Color(),
|
||||
@@ -73,6 +75,7 @@ enum Topic {
|
||||
Topic.FEED: Color(),
|
||||
Topic.DROP: Color(),
|
||||
Topic.WEAPON: Color(),
|
||||
Topic.SUMMON: Color(),
|
||||
}
|
||||
|
||||
@onready var qualityLabel: Label = $"%quality"
|
||||
|
||||
@@ -35,7 +35,8 @@ enum Entity {
|
||||
BULLET_REFRACTION,
|
||||
BULLET_TRACE,
|
||||
GRAVITY,
|
||||
PERFECT_MISS_WINDOW
|
||||
PERFECT_MISS_WINDOW,
|
||||
SUMMON_MAX
|
||||
}
|
||||
static var entityMap = {
|
||||
Entity.MAX_HEALTH: "生命上限",
|
||||
@@ -65,6 +66,7 @@ static var entityMap = {
|
||||
Entity.BULLET_TRACE: "追踪",
|
||||
Entity.GRAVITY: "引力",
|
||||
Entity.PERFECT_MISS_WINDOW: "闪避窗口",
|
||||
Entity.SUMMON_MAX: "召唤上限"
|
||||
}
|
||||
static var entityMapType = {
|
||||
Entity.MAX_HEALTH: DataType.VALUE,
|
||||
@@ -94,6 +96,7 @@ static var entityMapType = {
|
||||
Entity.BULLET_TRACE: DataType.PERCENT,
|
||||
Entity.GRAVITY: DataType.VALUE,
|
||||
Entity.PERFECT_MISS_WINDOW: DataType.PERCENT,
|
||||
Entity.SUMMON_MAX: DataType.INTEGER
|
||||
}
|
||||
static var entityMaxValueMap = {
|
||||
Entity.CRIT_RATE: 0.9,
|
||||
|
||||
Reference in New Issue
Block a user