dd
This commit is contained in:
@@ -15,6 +15,7 @@ import { FightSet } from "../common/config/Mission";
|
||||
import { getApIncrease, getHpIncrease, getUpExp, HeroPos } from "../common/config/heroSet";
|
||||
import { FriendModelComp } from "./FriendModel";
|
||||
import { MasterModelComp } from "./MasterModel";
|
||||
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -84,15 +85,17 @@ export class HeroViewComp extends CCComp {
|
||||
double_dead:boolean=false
|
||||
double_atked:boolean=false
|
||||
|
||||
BUFF_DEFS: Array<{value: number, count: number}> = []
|
||||
BUFF_ATKS: Array<{value: number, count: number}> = []
|
||||
BUFF_CDS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_BURNS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_DECDS: Array<{value: number, count: number}> = []
|
||||
DEBUFF_SLOW: number = 0;
|
||||
DEBUFF_FROST: number = 0;
|
||||
DEBUFF_STUN: number = 0;
|
||||
BUFF_DEFS: Array<{value: number, count: number}> = [] //防御提升
|
||||
BUFF_ATKS: Array<{value: number, count: number}> = [] //攻击提升
|
||||
BUFF_CDS: Array<{value: number, count: number}> = [] //攻击加速
|
||||
BUFF_DEDOWN:Array<{value: number, count: number}> = [] //debuff 概率降低
|
||||
|
||||
DEBUFF_BURNS: Array<{value: number, count: number}> = [] //易伤
|
||||
DEBUFF_DEATKS: Array<{value: number, count: number}> = [] //减攻击
|
||||
DEBUFF_DECDS: Array<{value: number, count: number}> = [] //减攻击速度
|
||||
DEBUFF_SLOW: number = 0; //减速
|
||||
DEBUFF_FROST: number = 0; //冰冻
|
||||
DEBUFF_STUN: number = 0; //眩晕
|
||||
|
||||
private damageQueue: Array<{
|
||||
damage: number,
|
||||
@@ -336,8 +339,37 @@ export class HeroViewComp extends CCComp {
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd,{victory:false})
|
||||
}
|
||||
}
|
||||
get_buff(){
|
||||
let buff=null
|
||||
if(this.is_master) buff=this.FIGHTCON.hero_buff
|
||||
if(this.is_friend) buff=this.FIGHTCON.friend_buff
|
||||
if(this.is_boss) buff=this.FIGHTCON.enemy_buff
|
||||
if(this.is_kalami) buff=this.FIGHTCON.enemy_buff
|
||||
if(buff==null) return
|
||||
return buff
|
||||
}
|
||||
get_debuff(){
|
||||
|
||||
}
|
||||
add_debuff(type:number,deV:number,deC:number,deR:number){
|
||||
let DEBUFF_DOWN=0
|
||||
let buff_debuff_down=0
|
||||
let buff=this.get_buff()
|
||||
if(buff!==null) buff_debuff_down=buff.DEBUFF_DOWN
|
||||
for(let i=0;i<this.BUFF_DEDOWN.length;i++){
|
||||
DEBUFF_DOWN+=this.BUFF_DEDOWN[i].value
|
||||
this.BUFF_DEDOWN[i].count-=1
|
||||
if(this.BUFF_DEDOWN[i].count<=0){
|
||||
this.BUFF_DEDOWN.splice(i,1)
|
||||
}
|
||||
}
|
||||
let n_deR=deR-DEBUFF_DOWN-buff_debuff_down
|
||||
let r=RandomManager.instance.getRandomInt(0,100)
|
||||
if(r > n_deR) {
|
||||
this.BUFFCOMP.tooltip(5,"*抵抗*")
|
||||
return
|
||||
}
|
||||
|
||||
add_debuff(type:number,deV:number,deC:number,){
|
||||
switch(type){
|
||||
case DebuffAttr.BURN:
|
||||
this.DEBUFF_BURNS.push({value:deV,count:deC})
|
||||
@@ -382,11 +414,21 @@ export class HeroViewComp extends CCComp {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
add_buff(buff:number,count:number,type:number){
|
||||
switch(type){
|
||||
case BuffAttr.DEF:
|
||||
this.BUFF_DEFS.push({value:buff,count:count})
|
||||
break
|
||||
case BuffAttr.ATK:
|
||||
this.BUFF_ATKS.push({value:buff,count:count})
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.BUFF_CDS.push({value:buff,count:count})
|
||||
break
|
||||
case BuffAttr.DEBUFF_DOWN:
|
||||
this.BUFF_DEDOWN.push({value:buff,count:count})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,13 +481,12 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFF_DEFS.splice(i,1)
|
||||
}
|
||||
}
|
||||
let buff=null
|
||||
if(this.is_master) buff=this.FIGHTCON.hero_buff
|
||||
if(this.is_friend) buff=this.FIGHTCON.friend_buff
|
||||
if(this.is_boss) buff=this.FIGHTCON.enemy_buff
|
||||
if(this.is_kalami) buff=this.FIGHTCON.enemy_buff
|
||||
if(buff==null) return
|
||||
damage=remainingDamage*(100-(buff.DEF+def)+Burn)/100
|
||||
// buff 防御 即免伤
|
||||
let buff_def=0
|
||||
let buff=this.get_buff()
|
||||
if(buff!==null) buff_def=buff.DEF
|
||||
|
||||
damage=remainingDamage*(100-(buff_def+def)+Burn)/100
|
||||
|
||||
return Math.floor(damage)
|
||||
}
|
||||
@@ -591,6 +632,7 @@ export class HeroViewComp extends CCComp {
|
||||
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()
|
||||
this.BUFFCOMP.lv_up()
|
||||
//@todo 需要添加 升级动画
|
||||
}
|
||||
/** 显示伤害数字 */
|
||||
|
||||
Reference in New Issue
Block a user