4 Commits

Author SHA1 Message Date
walkpan
c275a0ee94 refactor(护盾): 移除 shield_max 属性并简化护盾逻辑
护盾系统不再需要维护最大护盾值,因为护盾层数已有明确上限(FightSet.SHIELD_MAX)。
移除 HeroAttrs 枚举、HeroAttrsComp 组件、HeroAtkSystem 和 HeroViewComp 中所有对 shield_max 的引用和操作。
现在护盾层数直接受 SHIELD_MAX 限制,视图层仅需当前护盾值即可显示。
2026-04-12 23:03:03 +08:00
walkpan
323b9a0d89 feat: 为战斗配置添加护盾最大值常量
在GameSet配置枚举中新增SHIELD_MAX常量,用于定义战斗系统中护盾的最大层数,为后续护盾机制的功能开发提供基础配置。
2026-04-12 22:58:45 +08:00
walkpan
e1c8e92bd8 feat(卡池): 新增基于波次的卡池自动升级功能
- 在 GameEvent 枚举中添加 CardPoolUpgrade 事件
- 在 MissionComp 中配置卡池升级波次并触发升级事件
- 在 MissionCardComp 中监听升级事件并更新卡池等级和UI
- 升级时通过 toast 提示玩家
2026-04-12 22:56:01 +08:00
walkpan
09f64b0855 feat: 调整游戏难度并优化UI布局
- 降低卡池等级上限和英雄等级上限以简化前期难度
- 重新平衡前四波怪物配置,使难度曲线更平缓
- 移除卡池升级功能并隐藏相关UI按钮
- 调整角色控制器UI元素的位置和尺寸
- 修改加载界面元素的缩放比例
2026-04-12 22:37:00 +08:00
15 changed files with 965 additions and 922 deletions

View File

@@ -1062,7 +1062,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 435.147, "y": 487.134,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1453,7 +1453,7 @@
"__id__": 72 "__id__": 72
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 80 "__id__": 80
@@ -1471,7 +1471,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 220.965, "y": 208.926,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1698,7 +1698,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -70, "x": -20,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -1840,7 +1840,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -47.013, "x": 0,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -2165,7 +2165,7 @@
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 435.147, "_bottom": 487.134,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@@ -2507,8 +2507,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -180, "x": 0,
"y": 154.567, "y": 442.302,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -2557,7 +2557,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -85.592, "x": -26.797,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -2716,7 +2716,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 9.236, "x": 62.916,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -2866,7 +2866,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 360, "width": 720,
"height": 45 "height": 45
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -2940,9 +2940,9 @@
"_alignFlags": 44, "_alignFlags": 44,
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 360, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 132.067, "_bottom": 419.802,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@@ -4938,7 +4938,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 180, "x": 0,
"y": 153.275, "y": 153.275,
"z": 0 "z": 0
}, },
@@ -5032,7 +5032,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 360, "width": 720,
"height": 45 "height": 45
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -5139,8 +5139,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "35dr0lJV9CO5Ld8TLk7eCZ", "fileId": "35dr0lJV9CO5Ld8TLk7eCZ",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@@ -5166,7 +5164,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -138.644, "x": -35,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -5278,8 +5276,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "e7dPNasr5IyqES0tbwxJX3", "fileId": "e7dPNasr5IyqES0tbwxJX3",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@@ -5308,7 +5304,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -114.038, "x": -15.457,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -5464,8 +5460,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "65zRY1wpZPNLTXws9hsdcE", "fileId": "65zRY1wpZPNLTXws9hsdcE",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@@ -5482,7 +5476,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 360, "width": 720,
"height": 45 "height": 45
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -5552,7 +5546,7 @@
}, },
"_alignFlags": 40, "_alignFlags": 40,
"_target": null, "_target": null,
"_left": 360, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 0, "_bottom": 0,
@@ -8775,7 +8769,7 @@
"__id__": 491 "__id__": 491
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 497 "__id__": 497
@@ -10431,7 +10425,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": -85,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -11648,7 +11642,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 240, "x": 185,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -12087,14 +12081,14 @@
"node": { "node": {
"__id__": 552 "__id__": 552
}, },
"_enabled": true, "_enabled": false,
"__prefab": { "__prefab": {
"__id__": 572 "__id__": 572
}, },
"_alignFlags": 33, "_alignFlags": 33,
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 120,
"_top": 40, "_top": 40,
"_bottom": 1078.082, "_bottom": 1078.082,
"_horizontalCenter": 0, "_horizontalCenter": 0,
@@ -12198,7 +12192,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 700, "width": 590,
"height": 150 "height": 150
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -12232,11 +12226,11 @@
"height": 40 "height": 40
}, },
"_startAxis": 0, "_startAxis": 0,
"_paddingLeft": 0, "_paddingLeft": 100,
"_paddingRight": 0, "_paddingRight": 0,
"_paddingTop": 0, "_paddingTop": 0,
"_paddingBottom": 0, "_paddingBottom": 0,
"_spacingX": 20, "_spacingX": 50,
"_spacingY": 0, "_spacingY": 0,
"_verticalDirection": 1, "_verticalDirection": 1,
"_horizontalDirection": 0, "_horizontalDirection": 0,
@@ -12264,8 +12258,8 @@
}, },
"_alignFlags": 44, "_alignFlags": 44,
"_target": null, "_target": null,
"_left": 10, "_left": 65,
"_right": 10, "_right": 65,
"_top": 1230, "_top": 1230,
"_bottom": 7.988, "_bottom": 7.988,
"_horizontalCenter": 0, "_horizontalCenter": 0,
@@ -12790,7 +12784,7 @@
"__id__": 809 "__id__": 809
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 826 "__id__": 826

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 KiB

After

Width:  |  Height:  |  Size: 242 KiB

View File

@@ -1819,8 +1819,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.5, "x": 2,
"y": 1.5, "y": 2,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@@ -1847,8 +1847,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 421, "width": 218,
"height": 132 "height": 166
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1884,12 +1884,12 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@a557f", "__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@e5c7b",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 1,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,

View File

@@ -22,8 +22,6 @@ export enum CardLV {
LV1 = 1, LV1 = 1,
LV2 = 2, LV2 = 2,
LV3 = 3, LV3 = 3,
LV4 = 4,
LV5 = 5,
} }
/** 通用卡牌配置 */ /** 通用卡牌配置 */
@@ -59,9 +57,9 @@ export const CARD_POOL_UPGRADE_DISCOUNT_PER_WAVE = 10
/** 卡池默认初始等级 */ /** 卡池默认初始等级 */
export const CARD_POOL_INIT_LEVEL = CardLV.LV1 export const CARD_POOL_INIT_LEVEL = CardLV.LV1
/** 卡池等级上限 */ /** 卡池等级上限 */
export const CARD_POOL_MAX_LEVEL = CardLV.LV5 export const CARD_POOL_MAX_LEVEL = CardLV.LV3
/** 英雄最高等级限制 */ /** 英雄最高等级限制 */
export const CARD_HERO_MAX_LEVEL = 3 export const CARD_HERO_MAX_LEVEL = 2
/** 基础卡池(英雄、技能、功能) */ /** 基础卡池(英雄、技能、功能) */
export const CardPoolList: CardConfig[] = [ export const CardPoolList: CardConfig[] = [
@@ -70,30 +68,30 @@ export const CardPoolList: CardConfig[] = [
{ uuid: 5201, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5201, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5301, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5301, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5003, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5003, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5102, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5102, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5302, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5302, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5002, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5002, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5103, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5103, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5202, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5202, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5004, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 4, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5004, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5104, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 4, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5104, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5303, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 4, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5303, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5105, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 5, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5105, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5304, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 5, kind: CKind.Hero, hero_lv: 1 }, { uuid: 5304, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 3, kind: CKind.Hero, hero_lv: 1 },
// 技能卡牌 (以增益/辅助为主,因为在备战期没有敌人) // 技能卡牌 (以增益/辅助为主,因为在备战期没有敌人)
{ uuid: 6401, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体攻击", info: "随机1个友方+5攻击", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6401, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体攻击", info: "随机1个友方+5攻击", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6402, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体生命", info: "随机1个友方+20最大生命值", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6402, type: CardType.Skill, cost: 2, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体生命", info: "随机1个友方+20最大生命值", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6403, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "单体全能", info: "随机1个友方+2攻击,+10最大生命值", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6403, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "单体全能", info: "随机1个友方+2攻击,+10最大生命值", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6404, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体攻击", info: "随机3个友方+2攻击", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6404, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 1, kind: CKind.Skill, card_lv: 1, name: "群体攻击", info: "随机3个友方+2攻击", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6405, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体生命", info: "随机3个友方+10最大生命值", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6405, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "群体生命", info: "随机3个友方+10最大生命值", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6406, type: CardType.Skill, cost: 5, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1, name: "群体全能", info: "为随机3个友方单位增加攻击力和生命上限", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6406, type: CardType.Skill, cost: 5, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "群体全能", info: "为随机3个友方单位增加攻击力和生命上限", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6304, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 2, kind: CKind.Skill, card_lv: 1, name: "神圣治疗", info: "恢复场上随机3个友方单位的生命值", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6304, type: CardType.Skill, cost: 3, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "神圣治疗", info: "恢复场上随机3个友方单位的生命值", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 6305, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 4, kind: CKind.Skill, card_lv: 1, name: "群体护盾", info: "随机3个友方获得2次伤害免疫", is_inst: true, t_times: 1, t_inv: 0 }, { uuid: 6305, type: CardType.Skill, cost: 4, weight: 20, pool_lv: 3, kind: CKind.Skill, card_lv: 1, name: "群体护盾", info: "随机3个友方获得2次伤害免疫", is_inst: true, t_times: 1, t_inv: 0 },
{ uuid: 7001, type: CardType.SpecialUpgrade, cost: 6, weight: 16, pool_lv: 1 ,kind: CKind.Card }, { uuid: 7001, type: CardType.SpecialUpgrade, cost: 6, weight: 16, pool_lv: 1 ,kind: CKind.Card },
{ uuid: 7002, type: CardType.SpecialUpgrade, cost: 6, weight: 14, pool_lv: 2 ,kind: CKind.Card }, { uuid: 7002, type: CardType.SpecialUpgrade, cost: 6, weight: 14, pool_lv: 2 ,kind: CKind.Card },

View File

@@ -73,6 +73,7 @@ export enum GameEvent {
UpdateMissionGet = "UpdateMissionGet", UpdateMissionGet = "UpdateMissionGet",
GlobalAttrChange = "GlobalAttrChange", GlobalAttrChange = "GlobalAttrChange",
CoinAdd = "CoinAdd", CoinAdd = "CoinAdd",
CardPoolUpgrade = "CardPoolUpgrade",
TriggerSkill = "TriggerSkill", // 瞬间触发施法事件 TriggerSkill = "TriggerSkill", // 瞬间触发施法事件
RemoveSkillBox = "RemoveSkillBox", // 技能盒销毁事件 RemoveSkillBox = "RemoveSkillBox", // 技能盒销毁事件
} }

View File

@@ -36,6 +36,7 @@ export enum FightSet {
SKILL_CAST_DELAY=0.15, SKILL_CAST_DELAY=0.15,
CSKILL_START_X=-340, CSKILL_START_X=-340,
CSKILL_START_Y=30, CSKILL_START_Y=30,
SHIELD_MAX=5,
} }
export enum IndexSet { export enum IndexSet {

View File

@@ -14,7 +14,6 @@ export enum Attrs {
speed = "speed", // 基础移动速度 speed = "speed", // 基础移动速度
dis = "dis", // 基础距离 dis = "dis", // 基础距离
shield = "shield", // 当前护盾 shield = "shield", // 当前护盾
shield_max = "shield_max", // 最大护盾值
// ==================== 攻击属性 ==================== // ==================== 攻击属性 ====================
a_cd = "a_cd", // 攻击计时 a_cd = "a_cd", // 攻击计时

View File

@@ -327,7 +327,6 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
TAttrsComp.shield = Math.max(0, TAttrsComp.shield - 1); TAttrsComp.shield = Math.max(0, TAttrsComp.shield - 1);
if (TAttrsComp.shield <= 0) { if (TAttrsComp.shield <= 0) {
TAttrsComp.shield = 0; TAttrsComp.shield = 0;
TAttrsComp.shield_max = 0;
} }
TAttrsComp.dirty_shield = true; TAttrsComp.dirty_shield = true;
mLogger.log(this.debugMode, 'HeroAtkSystem', ` 护盾抵挡1次伤害剩余次数 ${TAttrsComp.shield}`); mLogger.log(this.debugMode, 'HeroAtkSystem', ` 护盾抵挡1次伤害剩余次数 ${TAttrsComp.shield}`);

View File

@@ -24,7 +24,6 @@ export class HeroAttrsComp extends ecs.Comp {
speed: number = 100; // 基础移动速度 speed: number = 100; // 基础移动速度
dis: number = 100; // 基础距离 dis: number = 100; // 基础距离
shield: number = 0; // 当前护盾 shield: number = 0; // 当前护盾
shield_max: number = 0; // 最大护盾值
// ==================== 攻击属性 (补充) ==================== // ==================== 攻击属性 (补充) ====================
skills: Record<number, HSkillInfo> = {}; skills: Record<number, HSkillInfo> = {};
@@ -97,9 +96,8 @@ export class HeroAttrsComp extends ecs.Comp {
const addValue = Math.max(0, Math.floor(value)); const addValue = Math.max(0, Math.floor(value));
if (addValue <= 0) return; if (addValue <= 0) return;
this.shield += addValue; this.shield += addValue;
this.shield_max += addValue; this.shield = Math.min(this.shield, FightSet.SHIELD_MAX); // 限制护盾最大层数
if (this.shield < 0) this.shield = 0; if (this.shield < 0) this.shield = 0;
if (this.shield_max < 0) this.shield_max = 0;
this.dirty_shield = true; // 标记护盾需要更新 this.dirty_shield = true; // 标记护盾需要更新
if (this.debugMode) { if (this.debugMode) {
mLogger.log(this.debugMode, 'HeroAttrs', ` 护盾次数变更: ${this.hero_name}, 变化=${addValue}, ${Math.floor(oldShield)} -> ${Math.floor(this.shield)}`); mLogger.log(this.debugMode, 'HeroAttrs', ` 护盾次数变更: ${this.hero_name}, 变化=${addValue}, ${Math.floor(oldShield)} -> ${Math.floor(this.shield)}`);
@@ -229,7 +227,6 @@ export class HeroAttrsComp extends ecs.Comp {
this.speed = 100; this.speed = 100;
this.dis = 100; this.dis = 100;
this.shield = 0; this.shield = 0;
this.shield_max = 0;
// 重置新增属性 // 重置新增属性
this.skills = {}; this.skills = {};

View File

@@ -156,7 +156,7 @@ export class HeroViewComp extends CCComp {
if (this.model.dirty_shield) { if (this.model.dirty_shield) {
this.show_shield(this.model.shield, this.model.shield_max); this.show_shield(this.model.shield);
this.model.dirty_shield = false; this.model.dirty_shield = false;
} }
} }
@@ -166,10 +166,9 @@ export class HeroViewComp extends CCComp {
} }
/** 显示护盾 */ /** 显示护盾 */
private show_shield(shield: number = 0, shield_max: number = 0) { private show_shield(shield: number = 0) {
this.lastBarUpdateTime = Date.now() / 1000; this.lastBarUpdateTime = Date.now() / 1000;
this.node.getChildByName("shielded").active = shield > 0; this.node.getChildByName("shielded").active = shield > 0;
void shield_max;
} }
/** 显示血量 */ /** 显示血量 */
@@ -370,7 +369,7 @@ export class HeroViewComp extends CCComp {
} }
add_shield(shield:number){ add_shield(shield:number){
// 护盾数据更新由 Model 层处理,这里只负责视图表现 // 护盾数据更新由 Model 层处理,这里只负责视图表现
if(this.model && this.model.shield>0) this.show_shield(this.model.shield, this.model.shield_max); if(this.model && this.model.shield>0) this.show_shield(this.model.shield);
} }
health(hp: number = 0) { health(hp: number = 0) {

View File

@@ -201,11 +201,11 @@ export class MissionCardComp extends CCComp {
this.clearHeroInfoPanels(); this.clearHeroInfoPanels();
this.layoutCardSlots(); this.layoutCardSlots();
this.clearAllCards(); this.clearAllCards();
if (this.cards_up) { // if (this.cards_up) {
this.cards_up.active = true; // this.cards_up.active = true;
} // }
this.resetButtonScale(this.cards_chou); this.resetButtonScale(this.cards_chou);
this.resetButtonScale(this.cards_up); // this.resetButtonScale(this.cards_up);
this.updateCoinAndCostUI(); this.updateCoinAndCostUI();
this.updateHeroNumUI(false, false); this.updateHeroNumUI(false, false);
this.node.active = true; this.node.active = true;
@@ -264,14 +264,15 @@ export class MissionCardComp extends CCComp {
oops.message.on(GameEvent.HeroDead, this.onHeroDead, this); oops.message.on(GameEvent.HeroDead, this.onHeroDead, this);
oops.message.on(GameEvent.UseHeroCard, this.onUseHeroCard, this); oops.message.on(GameEvent.UseHeroCard, this.onUseHeroCard, this);
oops.message.on(GameEvent.UseSpecialCard, this.onUseSpecialCard, this); oops.message.on(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
oops.message.on(GameEvent.CardPoolUpgrade, this.onCardPoolUpgrade, this);
/** 按钮触控事件:抽卡与卡池升级 */ /** 按钮触控事件:抽卡与卡池升级 */
this.cards_chou?.on(NodeEventType.TOUCH_START, this.onDrawTouchStart, this); this.cards_chou?.on(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
this.cards_chou?.on(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this); this.cards_chou?.on(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
this.cards_chou?.on(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this); this.cards_chou?.on(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this);
this.cards_up?.on(NodeEventType.TOUCH_START, this.onUpgradeTouchStart, this); // this.cards_up?.on(NodeEventType.TOUCH_START, this.onUpgradeTouchStart, this);
this.cards_up?.on(NodeEventType.TOUCH_END, this.onUpgradeTouchEnd, this); // this.cards_up?.on(NodeEventType.TOUCH_END, this.onUpgradeTouchEnd, this);
this.cards_up?.on(NodeEventType.TOUCH_CANCEL, this.onUpgradeTouchCancel, this); // this.cards_up?.on(NodeEventType.TOUCH_CANCEL, this.onUpgradeTouchCancel, this);
} }
// ======================== 事件回调 ======================== // ======================== 事件回调 ========================
@@ -299,6 +300,33 @@ export class MissionCardComp extends CCComp {
this.enterBattlePhase(); this.enterBattlePhase();
} }
/**
* 接收卡池升级事件:
* - 更新卡池等级
* - 更新UI显示
*/
private onCardPoolUpgrade(event: string, args: any) {
const targetLv = args?.targetLv;
if (!targetLv) return;
if (targetLv > CARD_POOL_MAX_LEVEL) {
this.poolLv = CARD_POOL_MAX_LEVEL;
} else {
this.poolLv = targetLv;
}
mLogger.log(this.debugMode, "MissionCardComp", "onCardPoolUpgrade", {
targetLv,
poolLv: this.poolLv
});
// 提示卡池升级
oops.gui.toast(`卡池已升至${this.poolLv}`);
// 更新UI
this.updatePoolLvUI();
}
/** 新一波:展开面板 → 刷新费用 UI → 重新抽卡分发 */ /** 新一波:展开面板 → 刷新费用 UI → 重新抽卡分发 */
private onNewWave() { private onNewWave() {
this.enterPreparePhase(); this.enterPreparePhase();
@@ -315,12 +343,13 @@ export class MissionCardComp extends CCComp {
oops.message.off(GameEvent.HeroDead, this.onHeroDead, this); oops.message.off(GameEvent.HeroDead, this.onHeroDead, this);
oops.message.off(GameEvent.UseHeroCard, this.onUseHeroCard, this); oops.message.off(GameEvent.UseHeroCard, this.onUseHeroCard, this);
oops.message.off(GameEvent.UseSpecialCard, this.onUseSpecialCard, this); oops.message.off(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
oops.message.off(GameEvent.CardPoolUpgrade, this.onCardPoolUpgrade, this);
this.cards_chou?.off(NodeEventType.TOUCH_START, this.onDrawTouchStart, this); this.cards_chou?.off(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
this.cards_chou?.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this); this.cards_chou?.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
this.cards_chou?.off(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this); this.cards_chou?.off(NodeEventType.TOUCH_CANCEL, this.onDrawTouchCancel, this);
this.cards_up?.off(NodeEventType.TOUCH_START, this.onUpgradeTouchStart, this); // this.cards_up?.off(NodeEventType.TOUCH_START, this.onUpgradeTouchStart, this);
this.cards_up?.off(NodeEventType.TOUCH_END, this.onUpgradeTouchEnd, this); // this.cards_up?.off(NodeEventType.TOUCH_END, this.onUpgradeTouchEnd, this);
this.cards_up?.off(NodeEventType.TOUCH_CANCEL, this.onUpgradeTouchCancel, this); // this.cards_up?.off(NodeEventType.TOUCH_CANCEL, this.onUpgradeTouchCancel, this);
} }
/** /**
@@ -462,18 +491,18 @@ export class MissionCardComp extends CCComp {
private onDrawTouchCancel() { private onDrawTouchCancel() {
this.playButtonResetAnim(this.cards_chou); this.playButtonResetAnim(this.cards_chou);
} }
/** 升级按钮按下反馈 */ // /** 升级按钮按下反馈 */
private onUpgradeTouchStart() { // private onUpgradeTouchStart() {
this.playButtonPressAnim(this.cards_up); // this.playButtonPressAnim(this.cards_up);
} // }
/** 升级按钮释放 → 执行升级逻辑 */ // /** 升级按钮释放 → 执行升级逻辑 */
private onUpgradeTouchEnd() { // private onUpgradeTouchEnd() {
this.playButtonClickAnim(this.cards_up, () => this.onClickUpgrade()); // this.playButtonClickAnim(this.cards_up, () => this.onClickUpgrade());
} // }
/** 升级按钮取消 → 恢复缩放 */ // /** 升级按钮取消 → 恢复缩放 */
private onUpgradeTouchCancel() { // private onUpgradeTouchCancel() {
this.playButtonResetAnim(this.cards_up); // this.playButtonResetAnim(this.cards_up);
} // }
/** 将四个卡槽节点映射为 CardComp形成固定顺序控制数组 */ /** 将四个卡槽节点映射为 CardComp形成固定顺序控制数组 */
private cacheCardComps() { private cacheCardComps() {
@@ -516,34 +545,34 @@ export class MissionCardComp extends CCComp {
this.dispatchCardsToSlots(cards); this.dispatchCardsToSlots(cards);
} }
/** 升级按钮:仅提升卡池等级,卡槽是否更新由下一次抽卡触发 */ // /** 升级按钮:仅提升卡池等级,卡槽是否更新由下一次抽卡触发 */
private onClickUpgrade() { // private onClickUpgrade() {
if (this.poolLv >= CARD_POOL_MAX_LEVEL) { // if (this.poolLv >= CARD_POOL_MAX_LEVEL) {
mLogger.log(this.debugMode, "MissionCardComp", "pool already max", this.poolLv); // mLogger.log(this.debugMode, "MissionCardComp", "pool already max", this.poolLv);
return; // return;
} // }
const cost = this.getUpgradeCost(this.poolLv); // const cost = this.getUpgradeCost(this.poolLv);
const currentCoin = this.getMissionCoin(); // const currentCoin = this.getMissionCoin();
if (currentCoin < cost) { // if (currentCoin < cost) {
oops.gui.toast(`金币不足,升级需要${cost}`); // oops.gui.toast(`金币不足,升级需要${cost}`);
this.updateCoinAndCostUI(); // this.updateCoinAndCostUI();
mLogger.log(this.debugMode, "MissionCardComp", "pool upgrade coin not enough", { // mLogger.log(this.debugMode, "MissionCardComp", "pool upgrade coin not enough", {
poolLv: this.poolLv, // poolLv: this.poolLv,
currentCoin, // currentCoin,
cost // cost
}); // });
return; // return;
} // }
this.setMissionCoin(currentCoin - cost); // this.setMissionCoin(currentCoin - cost);
this.poolLv += 1; // this.poolLv += 1;
this.playCoinChangeAnim(false); // this.playCoinChangeAnim(false);
this.updateCoinAndCostUI(); // this.updateCoinAndCostUI();
mLogger.log(this.debugMode, "MissionCardComp", "pool level up", { // mLogger.log(this.debugMode, "MissionCardComp", "pool level up", {
poolLv: this.poolLv, // poolLv: this.poolLv,
cost, // cost,
leftCoin: this.getMissionCoin() // leftCoin: this.getMissionCoin()
}); // });
} // }
// ======================== 阶段切换 ======================== // ======================== 阶段切换 ========================
@@ -685,23 +714,23 @@ export class MissionCardComp extends CCComp {
} }
/** 更新升级按钮上的等级文案,反馈当前卡池层级 */ /** 更新升级按钮上的等级文案,反馈当前卡池层级 */
private updatePoolLvUI() { private updatePoolLvUI() {
if (this.cards_up) { // if (this.cards_up) {
const nobg = this.cards_up.getChildByName("nobg"); // const nobg = this.cards_up.getChildByName("nobg");
if (nobg) { // if (nobg) {
nobg.active = !this.canUpPool(); // nobg.active = !this.canUpPool();
} // }
const coinNode = this.cards_up.getChildByName("coin"); // const coinNode = this.cards_up.getChildByName("coin");
const label = coinNode?.getChildByName("num")?.getComponent(Label); // const label = coinNode?.getChildByName("num")?.getComponent(Label);
if (this.poolLv >= CARD_POOL_MAX_LEVEL) { // if (this.poolLv >= CARD_POOL_MAX_LEVEL) {
if (label) { // if (label) {
label.string = `0`; // label.string = `0`;
} // }
} else { // } else {
if (label) { // if (label) {
label.string = `${this.getUpgradeCost(this.poolLv)}`; // label.string = `${this.getUpgradeCost(this.poolLv)}`;
} // }
} // }
} // }
if (this.pool_lv_node) { if (this.pool_lv_node) {
this.pool_lv_node.active = true; this.pool_lv_node.active = true;
const lv = Math.max(CARD_POOL_INIT_LEVEL, Math.min(CARD_POOL_MAX_LEVEL, Math.floor(this.poolLv))); const lv = Math.max(CARD_POOL_INIT_LEVEL, Math.min(CARD_POOL_MAX_LEVEL, Math.floor(this.poolLv)));
@@ -1059,7 +1088,7 @@ export class MissionCardComp extends CCComp {
reset() { reset() {
this.clearHeroInfoPanels(); this.clearHeroInfoPanels();
this.resetButtonScale(this.cards_chou); this.resetButtonScale(this.cards_chou);
this.resetButtonScale(this.cards_up); // this.resetButtonScale(this.cards_up);
this.node.destroy(); this.node.destroy();
} }
} }

View File

@@ -27,7 +27,7 @@
* - CardInitCoins —— 初始金币数 * - CardInitCoins —— 初始金币数
* - UIID.Victory —— 结算弹窗 * - UIID.Victory —— 结算弹窗
*/ */
import { _decorator, Vec3,Animation, instantiate, Prefab, Node, NodeEventType, ProgressBar, Label } from "cc"; import { _decorator, Vec3,Animation, instantiate, Prefab, Node, NodeEventType, ProgressBar, Label, CCInteger } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
@@ -74,6 +74,9 @@ export class MissionComp extends CCComp {
private prepareCoinWaveGrow: number = 1; private prepareCoinWaveGrow: number = 1;
/** 金币奖励上限 */ /** 金币奖励上限 */
private prepareCoinRewardCap: number = 500; private prepareCoinRewardCap: number = 500;
/** 卡池升级波次配置:达到对应波次时,推送卡池升级事件 */
@property({ type: [CCInteger], tooltip: "卡池升级波次配置,例如 [10, 20] 表示第10波升到2级第20波升到3级" })
cardPoolUpgradeWaves: number[] = [5, 10];
// ======================== 编辑器绑定节点 ======================== // ======================== 编辑器绑定节点 ========================
@@ -382,6 +385,22 @@ export class MissionComp extends CCComp {
this.grantPrepareCoinByWave(wave); this.grantPrepareCoinByWave(wave);
this.lastTimeSecond = -1; this.lastTimeSecond = -1;
this.update_time(); this.update_time();
// 检查并推送卡池升级事件
this.checkCardPoolUpgrade(wave);
}
/** 检查是否达到卡池升级波次,并推送升级事件 */
private checkCardPoolUpgrade(wave: number) {
if (!this.cardPoolUpgradeWaves || this.cardPoolUpgradeWaves.length === 0) return;
const upgradeIndex = this.cardPoolUpgradeWaves.indexOf(wave);
if (upgradeIndex !== -1) {
// 根据配置的索引,计算目标等级(初始等级 + index + 1
// 例如 index=0对应等级为2index=1对应等级为3
const targetLv = upgradeIndex + 2;
oops.message.dispatchEvent(GameEvent.CardPoolUpgrade, { wave, targetLv });
mLogger.log(this.debugMode, 'MissionComp', "card pool upgrade event pushed", { wave, targetLv });
}
} }
/** /**

View File

@@ -122,13 +122,20 @@ export const WaveSlotConfig: { [wave: number]: IWaveSlot[] } = {
/** 第 1 波2 近战 + 1 近战Boss(默认占3格) */ /** 第 1 波2 近战 + 1 近战Boss(默认占3格) */
1: [ 1: [
{ type: MonType.Long, count: 2 }, { type: MonType.Melee, count: 1 },
], ],
2: [ 2: [
{ type: MonType.Melee, count: 1 },
{ type: MonType.Long, count: 1 },
],
3: [
{ type: MonType.Melee, count: 1 },
{ type: MonType.Long, count: 2 },
],
4: [
{ type: MonType.Melee, count: 2 }, { type: MonType.Melee, count: 2 },
{ type: MonType.Long, count: 2 }, { type: MonType.Long, count: 2 },
], ],
/** 第 1 波2 近战 + 1 近战Boss(默认占3格) */ /** 第 1 波2 近战 + 1 近战Boss(默认占3格) */
10: [ 10: [
{ type: MonType.MeleeBoss, count: 1 }, { type: MonType.MeleeBoss, count: 1 },