添加 升级系统
This commit is contained in:
@@ -12,7 +12,7 @@ import { GameEvent } from "../common/config/GameEvent";
|
||||
import { FightConComp } from "../map/FightConComp";
|
||||
import { EquipSpecialAttr } from "../common/config/Equips";
|
||||
import { FightSet } from "../common/config/Mission";
|
||||
import { HeroPos } from "../common/config/heroSet";
|
||||
import { getApIncrease, getHpIncrease, getUpExp, HeroPos } from "../common/config/heroSet";
|
||||
import { FriendModelComp } from "./FriendModel";
|
||||
import { MasterModelComp } from "./MasterModel";
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -30,6 +30,8 @@ export class HeroViewComp extends CCComp {
|
||||
hero_name : string = "hero";
|
||||
fight_pos:number=0;
|
||||
lv:number =1;
|
||||
exp:number = 0;
|
||||
next_exp:number = 100;
|
||||
scale: number = 1; /** 角色阵营 1:hero -1 :mon */
|
||||
type: number = 0; /**角色类型 0近战-需要贴身 1远程-保持距离 2辅助 */
|
||||
fac:number=0; //阵营 0:hero 1:monster
|
||||
@@ -108,6 +110,7 @@ export class HeroViewComp extends CCComp {
|
||||
console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
||||
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
|
||||
this.on(GameEvent.UpdateHP,this.update_hp,this)
|
||||
this.on(GameEvent.EXPUP,this.exp_up,this)
|
||||
// let anm = this.node.getChildByName("anm")
|
||||
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
}
|
||||
@@ -127,7 +130,6 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.is_friend){ //只有伙伴需要召唤后添加hp 怪物,和boss 不要设置减hp debuff 主要 一开始就战斗开始就存在,所以不需要
|
||||
this.hp+=this.FIGHTCON.friend_buff.HP*this.hp_max/100
|
||||
}
|
||||
|
||||
}
|
||||
update(dt: number){
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
@@ -323,6 +325,12 @@ export class HeroViewComp extends CCComp {
|
||||
this.do_dead_trigger()
|
||||
this.Friend_alive_cd=new Timer(this.FIGHTCON.friend_alive_cd)
|
||||
console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
|
||||
if(this.is_kalami){
|
||||
oops.message.dispatchEvent(GameEvent.EXPUP,{exp:50})
|
||||
}
|
||||
if(this.is_boss){
|
||||
oops.message.dispatchEvent(GameEvent.EXPUP,{exp:100})
|
||||
}
|
||||
if(this.is_master){
|
||||
console.log("[HeroViewComp]:英雄死亡")
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
|
||||
@@ -563,14 +571,27 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
exp_up(e:any,data:any){
|
||||
console.log("[HeroViewComp]:exp_up",data)
|
||||
this.lv+=1
|
||||
this.ap=this.ap*this.lv
|
||||
this.BUFFCOMP.vmdata_update(true)
|
||||
if(this.fac==FacSet.MON) return
|
||||
console.log("[HeroViewComp]:经验提高",data.exp)
|
||||
this.exp+=data.exp
|
||||
this.next_exp=getUpExp(this.lv)
|
||||
let diff=this.exp-this.next_exp
|
||||
if(diff >= 0){
|
||||
this.exp=diff
|
||||
this.to_update()
|
||||
}
|
||||
this.BUFFCOMP.vmdata_update(true) //简易更新vmdata
|
||||
}
|
||||
|
||||
to_update(){
|
||||
this.ap=this.ap*this.lv
|
||||
console.log("[HeroViewComp]:升级",this.lv)
|
||||
this.add_ap(getApIncrease(this.hero_uuid,this.lv,this.lv+1))
|
||||
this.add_hp_max(getHpIncrease(this.hero_uuid,this.lv,this.lv+1))
|
||||
this.lv+=1
|
||||
this.next_exp=getUpExp(this.lv)
|
||||
console.log("[HeroViewComp]:up ap,hp",getApIncrease(this.hero_uuid,this.lv,this.lv+1),getHpIncrease(this.hero_uuid,this.lv,this.lv+1))
|
||||
this.BUFFCOMP.vmdata_update()
|
||||
//@todo 需要添加 升级动画
|
||||
}
|
||||
/** 显示伤害数字 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user