去掉skillcom处理 buff skill只负责动画运行和碰撞伤害
This commit is contained in:
@@ -5,7 +5,7 @@ import { HeroSpine } from "./HeroSpine";
|
||||
import { BoxSet, FacSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { BuffAttr, DebuffAttr, SkillSet, TGroup, TType } from "../common/config/SkillSet";
|
||||
import { BuffAttr, DebuffAttr, geDebuffNum, getBuffNum, SkillSet, TGroup, TType } from "../common/config/SkillSet";
|
||||
import { BuffComp } from "./BuffComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
@@ -44,27 +44,25 @@ export class HeroViewComp extends CCComp {
|
||||
is_friend:boolean =false;
|
||||
is_kalami:boolean =false;
|
||||
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
speed_base: number = 100; /** 角色初始速度 */
|
||||
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
hp_buff:number=0;
|
||||
hp_base:number=0;
|
||||
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_buff:number=0;
|
||||
ap_base:number=0;
|
||||
// atk_speed: number = 1;
|
||||
cd_base:number=1.3;
|
||||
cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
cd_buff:number=0;
|
||||
def: number = 0; //防御
|
||||
dmg_red:number=0//免伤
|
||||
dis: number = 80;
|
||||
skills:any[]=[]
|
||||
puncture:number=0; //穿刺敌人伤害后方敌人个数
|
||||
puncture_damage:number=0; //后伤害加成
|
||||
def: number = 0; //防御
|
||||
dmg_red:number=0//免伤
|
||||
burn: number = 0; //易伤 伤害加成
|
||||
stun_time:number=0; //眩晕加成
|
||||
stun_ratto:number=0; //攻击眩晕概率加成
|
||||
stun_ratio:number=0; //攻击眩晕概率加成
|
||||
stun_no:boolean=false; //眩晕免疫
|
||||
dod: number = 0; //闪避率
|
||||
dod_no:boolean=false;
|
||||
@@ -72,30 +70,30 @@ export class HeroViewComp extends CCComp {
|
||||
crit_no:boolean=false; //暴击免疫
|
||||
crit_d:number=0; //暴击伤害
|
||||
wfuny:number=0; //风怒概率
|
||||
frost_ratto:number=0; //冰冻概率
|
||||
frost_ratio:number=0; //冰冻概率
|
||||
frost_time:number=0; //冰冻时间
|
||||
frost_no:boolean=false; //冰冻免疫
|
||||
knockback:number=0; //击退概率
|
||||
knockback_no:boolean=false; //击退免疫
|
||||
shield:number = 0; //护盾,免伤1次减1
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
ospeed: number = 100; /** 角色初始速度 */
|
||||
reflect:number=0; //反射伤害比率
|
||||
lifesteal:number=0; //吸血比率
|
||||
skill_dmg:number=0
|
||||
debuff_down:number=0
|
||||
|
||||
|
||||
|
||||
Attrs:any=getBuffNum()
|
||||
debuff_status:any=geDebuffNum()
|
||||
|
||||
|
||||
atk_count: number = 0;
|
||||
atked_count: number = 0;
|
||||
|
||||
stop_cd: number = 0; /*停止倒计时*/
|
||||
speek_time:number = 0;
|
||||
debuff_down_ratto:number=0
|
||||
|
||||
BUFF_DEFS: Array<{value: number, duration: number}> = [] //防御提升
|
||||
BUFF_ATKS: Array<{value: number, duration: number}> = [] //攻击提升
|
||||
BUFF_CDS: Array<{value: number, duration: number}> = [] //攻击加速
|
||||
BUFF_DEDOWN:Array<{value: number, duration: number}> = [] //debuff 概率降低
|
||||
|
||||
BUFFS:Array<{value: number, duration: number,type:number}> = [] //buff
|
||||
|
||||
DEBUFF_BURNS: Array<{value: number, duration: number}> = [] //易伤
|
||||
DEBUFF_DEATKS: Array<{value: number, duration: number}> = [] //减攻击
|
||||
DEBUFF_DECDS: Array<{value: number, duration: number}> = [] //减攻击速度
|
||||
@@ -138,7 +136,6 @@ export class HeroViewComp extends CCComp {
|
||||
start () {
|
||||
this.as.idle()
|
||||
this.BUFFCOMP=this.node.getComponent(BuffComp);
|
||||
|
||||
/** 方向 */
|
||||
this.node.setScale(this.scale,1);
|
||||
this.node.getChildByName("top").setScale(this.scale,1);
|
||||
@@ -209,136 +206,12 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.shield>6) this.shield=6
|
||||
if(this.shield>0) this.BUFFCOMP.show_shield(true)
|
||||
}
|
||||
change_wfuny(wfuny: number){
|
||||
this.wfuny+=wfuny
|
||||
if(this.wfuny<0) this.wfuny=0
|
||||
|
||||
}
|
||||
change_puncture(puncture: number){
|
||||
this.puncture+=puncture
|
||||
if(this.puncture<1) this.puncture=1
|
||||
|
||||
}
|
||||
change_puncture_damage(puncture_damage: number){
|
||||
this.puncture_damage+=puncture_damage
|
||||
if(this.puncture_damage<0) this.puncture_damage=0
|
||||
if(this.puncture_damage>80) this.puncture_damage=80
|
||||
|
||||
}
|
||||
change_dodge(dodge: number){
|
||||
this.dod+=dodge
|
||||
if(this.dod<0) this.dod=0
|
||||
if(this.dod>90) this.dod=90
|
||||
|
||||
}
|
||||
change_frost_ratto(frost_ratto: number){
|
||||
this.frost_ratto+=frost_ratto
|
||||
if(this.frost_ratto<0) this.frost_ratto=0
|
||||
if(this.frost_ratto>90) this.frost_ratto=90
|
||||
|
||||
}
|
||||
|
||||
change_knockback(knockback: number){
|
||||
this.knockback+=knockback
|
||||
if(this.knockback<0) this.knockback=0
|
||||
|
||||
}
|
||||
|
||||
change_stun_ratto(stun_ratto: number){
|
||||
this.stun_ratto+=stun_ratto
|
||||
if(this.stun_ratto<0) this.stun_ratto=0
|
||||
|
||||
}
|
||||
|
||||
change_def(def: number){
|
||||
this.def+=def
|
||||
if(this.def>90) this.def=90
|
||||
if(this.def<0) this.def=0
|
||||
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
|
||||
}
|
||||
change_crit(crit: number){
|
||||
this.crit+=crit
|
||||
if(this.crit<0) this.crit=0
|
||||
|
||||
}
|
||||
change_crit_d(crit_d: number){
|
||||
this.crit_d+=crit_d
|
||||
if(this.crit_d<0) this.crit_d=0
|
||||
|
||||
}
|
||||
change_reflect(reflect: number){
|
||||
this.reflect+=reflect
|
||||
if(this.reflect<0) this.reflect=0
|
||||
|
||||
}
|
||||
change_lifesteal(lifesteal: number){
|
||||
this.lifesteal+=lifesteal
|
||||
if(this.lifesteal<0) this.lifesteal=0
|
||||
|
||||
}
|
||||
|
||||
check_atrr(buff:BuffAttr){
|
||||
switch(buff){
|
||||
case BuffAttr.ATK:
|
||||
return Math.floor(this.ap_base*(100+this.ap_buff)/100)
|
||||
case BuffAttr.ATK_CD:
|
||||
return this.cd_base/((this.cd_buff)/100+1)
|
||||
case BuffAttr.HP:
|
||||
return Math.floor(this.hp_base*(100+this.hp_buff)/100)
|
||||
}
|
||||
}
|
||||
|
||||
count_atrr(buff:BuffAttr){
|
||||
switch(buff){
|
||||
case BuffAttr.ATK:
|
||||
this.ap=this.check_atrr(BuffAttr.ATK)
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.cd=this.check_atrr(BuffAttr.ATK_CD)
|
||||
break
|
||||
case BuffAttr.HP:
|
||||
let diff=this.check_atrr(BuffAttr.HP)-this.hp_max
|
||||
this.hp_max=this.check_atrr(BuffAttr.HP)
|
||||
this.hp+=diff
|
||||
this.hp_show()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
add_speed(cd: number){
|
||||
this.cd_buff+=cd
|
||||
this.count_atrr(BuffAttr.ATK_CD)
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
|
||||
}
|
||||
|
||||
|
||||
change_ap(ap: number,is_num:boolean=true){
|
||||
// console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
|
||||
if(is_num){
|
||||
this.ap_base += Math.floor(ap);
|
||||
}else{
|
||||
this.ap_buff += Math.floor(ap/100*this.ap_base);
|
||||
}
|
||||
|
||||
this.count_atrr(BuffAttr.ATK)
|
||||
}
|
||||
|
||||
change_hp_max(hp: number=0,is_num:boolean=false){
|
||||
// console.log("[HeroViewComp]:add_hp_max add:",hp,this.currentHpMax)
|
||||
if(is_num){
|
||||
this.hp_base += Math.floor(hp) ;
|
||||
}else{
|
||||
this.hp_buff+=hp
|
||||
}
|
||||
this.count_atrr(BuffAttr.HP)
|
||||
// this.update_vm
|
||||
}
|
||||
|
||||
|
||||
add_hp(hp: number = 0,is_num:boolean=true) {
|
||||
this.BUFFCOMP.heathed();
|
||||
let real_hp=0
|
||||
let hp_max=Math.floor(this.hp_max*(100+this.hp_buff)/100)
|
||||
let hp_max=this.hp_max
|
||||
let lost_hp=hp_max-this.hp
|
||||
if(is_num){
|
||||
if(lost_hp > hp){
|
||||
@@ -402,17 +275,8 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
}
|
||||
|
||||
get_debuff(){
|
||||
|
||||
}
|
||||
add_debuff(type:number,deV:number,deC:number,deR:number){
|
||||
let DEBUFF_DOWN=0
|
||||
|
||||
for(let i=0;i<this.BUFF_DEDOWN.length;i++){
|
||||
DEBUFF_DOWN+=this.BUFF_DEDOWN[i].value
|
||||
// 不再在这里减少duration,改为在update中按时间减少
|
||||
}
|
||||
let n_deR=deR-DEBUFF_DOWN-this.debuff_down_ratto // 触发概率
|
||||
let n_deR=deR-this.Attrs[BuffAttr.DEBUFF_DOWN]
|
||||
let r=RandomManager.instance.getRandomInt(0,100) // 随机数
|
||||
//console.log("[HeroViewComp]:类型,值,次数,技能概率,实际概率,随机数",type,deV,deC,deR,n_deR,r)
|
||||
if(r < n_deR) {
|
||||
@@ -469,35 +333,12 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
// 更新所有按时间减少的buff和debuff
|
||||
updateBuffsAndDebuffs(dt: number) {
|
||||
// 更新BUFF_DEFS
|
||||
for(let i = this.BUFF_DEFS.length - 1; i >= 0; i--) {
|
||||
this.BUFF_DEFS[i].duration -= dt;
|
||||
if(this.BUFF_DEFS[i].duration <= 0) {
|
||||
this.BUFF_DEFS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新BUFF_ATKS
|
||||
for(let i = this.BUFF_ATKS.length - 1; i >= 0; i--) {
|
||||
this.BUFF_ATKS[i].duration -= dt;
|
||||
if(this.BUFF_ATKS[i].duration <= 0) {
|
||||
this.BUFF_ATKS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新BUFF_CDS
|
||||
for(let i = this.BUFF_CDS.length - 1; i >= 0; i--) {
|
||||
this.BUFF_CDS[i].duration -= dt;
|
||||
if(this.BUFF_CDS[i].duration <= 0) {
|
||||
this.BUFF_CDS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新BUFF_DEDOWN
|
||||
for(let i = this.BUFF_DEDOWN.length - 1; i >= 0; i--) {
|
||||
this.BUFF_DEDOWN[i].duration -= dt;
|
||||
if(this.BUFF_DEDOWN[i].duration <= 0) {
|
||||
this.BUFF_DEDOWN.splice(i, 1);
|
||||
// 更新BUFFS
|
||||
for(let i = this.BUFFS.length - 1; i >= 0; i--) {
|
||||
this.BUFFS[i].duration -= dt;
|
||||
if(this.BUFFS[i].duration <= 0) {
|
||||
this.apply_buff(this.BUFFS[i].type,-this.BUFFS[i].value)
|
||||
this.BUFFS.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,27 +368,40 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
add_buff(buff:number,duration:number,type:number){
|
||||
switch(type){
|
||||
case BuffAttr.DEF:
|
||||
this.BUFF_DEFS.push({value:buff,duration:duration})
|
||||
if(this.BUFFS.find(b=>b.type==type)) {
|
||||
if(this.BUFFS.find(b=>b.type==type).value<buff) {
|
||||
let dis_buff_value=buff-this.BUFFS.find(b=>b.type==type).value
|
||||
this.BUFFS.find(b=>b.type==type).value=buff
|
||||
this.BUFFS.find(b=>b.type==type).duration=duration
|
||||
this.apply_buff(type,dis_buff_value)
|
||||
}
|
||||
}else{
|
||||
this.BUFFS.push({value:buff,duration:duration,type:type})
|
||||
this.apply_buff(type,buff)
|
||||
}
|
||||
}
|
||||
// 应用buff,有基础值的需要特殊处理,其他的直接加减
|
||||
apply_buff(buff_type:number,buff_value:number){
|
||||
switch(buff_type){
|
||||
case BuffAttr.ATK: //攻击百分比
|
||||
this.Attrs[BuffAttr.AP]+=Math.floor(buff_value/100*this.ap)
|
||||
break
|
||||
case BuffAttr.ATK:
|
||||
this.BUFF_ATKS.push({value:buff,duration:duration})
|
||||
case BuffAttr.ATK_CD: //攻击速度百分比
|
||||
this.Attrs[BuffAttr.ATK_CD]+=buff_value/100*this.cd
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.BUFF_CDS.push({value:buff,duration:duration})
|
||||
case BuffAttr.HP: //血量百分比
|
||||
this.Attrs[BuffAttr.HP_MAX]+=Math.floor(buff_value/100*this.hp_max)
|
||||
break
|
||||
case BuffAttr.DEBUFF_DOWN:
|
||||
this.BUFF_DEDOWN.push({value:buff,duration:duration})
|
||||
default:
|
||||
this.Attrs[buff_type]+=buff_value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
do_atked(remainingDamage:number,
|
||||
crit:number=0,crit_d:number=0,
|
||||
burn_count:number=0,burn_value:number=0,
|
||||
stun_time:number=0,stun_ratto:number=0,
|
||||
frost_time:number=0,frost_ratto:number=0,
|
||||
stun_time:number=0,stun_ratio:number=0,
|
||||
frost_time:number=0,frost_ratio:number=0,
|
||||
atked_anm:string="atked"
|
||||
){
|
||||
this.do_atked_trigger()
|
||||
@@ -555,7 +409,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.add_debuff(DebuffAttr.BURN,burn_value,burn_count,100)
|
||||
}
|
||||
if(stun_time>0){
|
||||
this.add_debuff(DebuffAttr.STUN,stun_time,1,stun_ratto)
|
||||
this.add_debuff(DebuffAttr.STUN,stun_time,1,stun_ratio)
|
||||
}
|
||||
if(this.check_shield()) return
|
||||
if(this.check_dodge()) return
|
||||
@@ -730,8 +584,8 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.fac==FacSet.MON) return
|
||||
console.log("[HeroViewComp]:升级",this.BUFFCOMP)
|
||||
if(this.hero_uuid!=data.uuid) return
|
||||
this.change_ap(HeroInfo[data.uuid].ap,true)
|
||||
this.change_hp_max(HeroInfo[data.uuid].hp,true)
|
||||
this.apply_buff(BuffAttr.HP_MAX,data.hp)
|
||||
this.apply_buff(BuffAttr.AP,data.ap)
|
||||
this.BUFFCOMP.lv_up()
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.lvup)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user