feat: 实现角色经验获取与升级系统
- 在SingletonModuleComp中新增addExp方法,处理经验累积和升级逻辑 - 修改英雄初始等级从0调整为1,确保等级系统正常运作 - 在MissionComp中为不同怪物类型添加经验奖励计算 - 使用getLevelExp函数动态计算各级所需经验值 - 升级时触发GameEvent.CanUpdateLv事件通知其他模块
This commit is contained in:
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { MonsterCost, MonType, calculateMonsterGold } from "./RogueConfig";
|
||||
import { MonsterCost, MonType, calculateMonsterGold, getLevelExp } from "./RogueConfig";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
@@ -128,6 +128,22 @@ export class MissionComp extends CCComp {
|
||||
type = MonType.ELITE;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算经验
|
||||
let exp = 10; // 基础经验
|
||||
switch (type) {
|
||||
case MonType.BOSS:
|
||||
exp = 200;
|
||||
break;
|
||||
case MonType.ELITE:
|
||||
exp = 50;
|
||||
break;
|
||||
default:
|
||||
exp = 10;
|
||||
break;
|
||||
}
|
||||
smc.addExp(exp);
|
||||
|
||||
this.cal_gold_reward(data, type);
|
||||
}
|
||||
}
|
||||
@@ -251,9 +267,9 @@ do_ad(){
|
||||
path:'',
|
||||
as:0,
|
||||
type:0,
|
||||
lv:0,
|
||||
lv:1,
|
||||
exp:0,
|
||||
exp_max:100,
|
||||
exp_max: getLevelExp(1),
|
||||
exp_pre:0,
|
||||
hp:50,
|
||||
hp_max:100,
|
||||
|
||||
Reference in New Issue
Block a user