fix(hero): 修正英雄与怪物技能消耗和状态判断逻辑

- 修改Hero和Monster类中技能对象,新增cost属性用于技能消耗
- 修复HeroViewComp中isStun和isFrost方法,确保返回布尔值
- SkillConComp日志输出技能列表和消耗信息,增强调试能力
- 更新英雄配置中的map属性值由0改为100,统一角色数据映射
This commit is contained in:
walkpan
2025-10-18 09:07:22 +08:00
parent a3e4e70d9d
commit 2eae29f1a1
5 changed files with 30 additions and 27 deletions

View File

@@ -73,7 +73,7 @@ export class Hero extends ecs.Entity {
hv.hero_uuid= uuid;
hv.hero_name= hero.name;
for(let i=0;i<hero.skills.length;i++){
let skill={ uuid:SkillSet[hero.skills[i]].uuid, cd_max:SkillSet[hero.skills[i]].cd,cd:0 }
let skill={ uuid:SkillSet[hero.skills[i]].uuid, cd_max:SkillSet[hero.skills[i]].cd,cost:SkillSet[hero.skills[i]].cost,cd:0 }
hv.skills.push(skill)
}
hv.base_ap=hero.ap

View File

@@ -474,10 +474,10 @@ export class HeroViewComp extends CCComp {
}
public isStun() {
this.DBUFFS_V[DBuff.STUN] !== undefined
return this.DBUFFS_V[DBuff.STUN] !== undefined?true:false
}
public isFrost() {
this.DBUFFS_V[DBuff.FROST] !== undefined
return this.DBUFFS_V[DBuff.FROST] !== undefined?true:false
}
update(dt: number){

View File

@@ -95,7 +95,7 @@ export class Monster extends ecs.Entity {
// console.log(`[Monster]: 怪物${hero.name} 关卡倍数 - HP: ${baseHp} x ${stageMultipliers.hp.toFixed(2)} = ${finalHp}, AP: ${baseAp} x ${stageMultipliers.attack.toFixed(2)} = ${finalAp}`);
}
for(let i=0;i<hero.skills.length;i++){
let skill={ uuid:SkillSet[hero.skills[i]].uuid, cd_max:SkillSet[hero.skills[i]].cd,cd:0 }
let skill={ uuid:SkillSet[hero.skills[i]].uuid, cd_max:SkillSet[hero.skills[i]].cd,cost:SkillSet[hero.skills[i]].cost,cd:0 }
hv.skills.push(skill)
}
hv.base_ap=finalAp

View File

@@ -34,9 +34,12 @@ export class SkillConComp extends CCComp {
if(!smc.mission.play||smc.mission.pause) return
if(!this.HeroView.isStun() && !this.HeroView.isFrost()) {
let skills=this.HeroView.skills
console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"技能列表:",skills)
for(let i=0;i<skills.length;i++){
skills[i].cd += dt;
console.log(this.HeroView.uuid+"=>"+skills[i].cost,this.HeroView.mp)
if(skills[i].cd > skills[i].cd_max&&this.HeroView.mp >= skills[i].cost){
if(SkillSet[skills[i].uuid].SType==SType.damage&&this.HeroView.is_atking){
this.castSkill(SkillSet[skills[i].uuid])
this.HeroView.skills[i].cd = 0