增益 再全面完善下
This commit is contained in:
@@ -110,7 +110,6 @@ export class BuffComp extends Component {
|
||||
// info.lv=this.HeroView.lv
|
||||
info.cd=Number(this.HeroView.cd.toFixed(2))
|
||||
|
||||
info.equip_ap=this.HeroView.ap_base*this.HeroView.buff_ap
|
||||
info.buff_ap=view_atk
|
||||
info.debuff_ap=view_deatk
|
||||
info.damage=this.HeroView.ap*(100+view_atk-view_deatk)/100
|
||||
|
||||
@@ -89,10 +89,10 @@ export class Hero extends ecs.Entity {
|
||||
hv.hero_name= hero.name;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.cd = hero.cd
|
||||
hv.cd = hv.cd_base = hero.cd
|
||||
hv.hp= hv.hp_max = hv.hp_base=hero.hp+info.hp
|
||||
hv.ap = hero.ap+info.ap;
|
||||
hv.ap_base=hero.ap+info.ap;
|
||||
hv.ap = hv.ap_base=hero.ap+info.ap;
|
||||
hv.def = hv.def_base=hero.def+info.def;
|
||||
hero.buff.forEach((buff:any)=>{
|
||||
switch(buff.buff_type){
|
||||
case BuffAttr.CRITICAL:
|
||||
|
||||
@@ -7,6 +7,7 @@ import { EquipAttrTarget, EquipInfo } from "../common/config/Equips";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BuffAttr } from "../common/config/SkillSet";
|
||||
import { EnhancementType } from "../common/config/LevelUp";
|
||||
import { TalentList } from "../common/config/TalentSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -94,29 +95,30 @@ export class HeroConComp extends CCComp {
|
||||
|
||||
use_talent_card(e:GameEvent,data:any){
|
||||
console.log("[HeroConCompComp]:use_talent_card",data)
|
||||
switch(data.buffType){
|
||||
let tal=TalentList[data.uuid]
|
||||
switch(tal.buffType){
|
||||
case BuffAttr.ATK:
|
||||
this.heroView.TALENT[BuffAttr.ATK]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.ATK]+=tal.value
|
||||
this.heroView.count_atrr(BuffAttr.ATK)
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.heroView.TALENT[BuffAttr.ATK_CD]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.ATK_CD]+=tal.value
|
||||
this.heroView.count_atrr(BuffAttr.ATK_CD)
|
||||
break
|
||||
case BuffAttr.HP:
|
||||
this.heroView.TALENT[BuffAttr.HP]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.HP]+=tal.value
|
||||
break
|
||||
case BuffAttr.CRITICAL:
|
||||
this.heroView.TALENT[BuffAttr.CRITICAL]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.CRITICAL]+=tal.value
|
||||
break
|
||||
case BuffAttr.CRITICAL_DMG:
|
||||
this.heroView.TALENT[BuffAttr.CRITICAL_DMG]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.CRITICAL_DMG]+=tal.value
|
||||
break
|
||||
case BuffAttr.DODGE:
|
||||
this.heroView.TALENT[BuffAttr.DODGE]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.DODGE]+=tal.value
|
||||
break
|
||||
case BuffAttr.DEBUFF_COUNT:
|
||||
this.heroView.TALENT[BuffAttr.DEBUFF_COUNT]+=data.value
|
||||
this.heroView.TALENT[BuffAttr.DEBUFF_COUNT]+=tal.value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,22 +50,25 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
buff_hp:number=0;
|
||||
hp_buff:number=0;
|
||||
hp_base:number=0;
|
||||
|
||||
pwt:Timer = new Timer(1); //计时器
|
||||
ap: number = 10; /**攻击力 */
|
||||
buff_ap:number=0;
|
||||
ap_buff:number=0;
|
||||
ap_base:number=0;
|
||||
// atk_speed: number = 1;
|
||||
cd_base:number=1.3;
|
||||
cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
buff_cd:number=0;
|
||||
cd_buff:number=0;
|
||||
dis: number = 80;
|
||||
at: number = 0; /** 冷却时间 */
|
||||
atk_skill:number=0;
|
||||
puncture:number=0; //穿刺敌人伤害后方敌人个数
|
||||
puncture_damage:number=0; //后伤害加成
|
||||
def: number = 0; //防御
|
||||
def_base:number=0;
|
||||
def_buff:number=0;
|
||||
vun: number = 0; //易伤
|
||||
burn_count:number=0; //易伤次数
|
||||
burn_value:number=0; //易伤值
|
||||
@@ -235,24 +238,24 @@ export class HeroViewComp extends CCComp {
|
||||
* @param ap 要增加的攻击。
|
||||
*/
|
||||
add_def(def: number){
|
||||
this.def+=def
|
||||
this.def_base+=def
|
||||
this.count_atrr(BuffAttr.DEF)
|
||||
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
|
||||
}
|
||||
|
||||
check_atrr(buff:BuffAttr){
|
||||
switch(buff){
|
||||
case BuffAttr.ATK:
|
||||
return Math.floor(this.ap_base*(100+this.buff_ap+this.TALENT[BuffAttr.ATK])/100)
|
||||
return Math.floor(this.ap*(100+this.ap+this.TALENT[BuffAttr.ATK])/100)
|
||||
case BuffAttr.ATK_CD:
|
||||
return this.cd/((this.buff_cd+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
return this.cd_base/((this.cd_buff+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
case BuffAttr.HP:
|
||||
return Math.floor(this.hp_base*(100+this.buff_hp+this.TALENT[BuffAttr.HP])/100)
|
||||
return Math.floor(this.hp_base*(100+this.hp_buff+this.TALENT[BuffAttr.HP])/100)
|
||||
case BuffAttr.DEF:
|
||||
return this.def+this.TALENT[BuffAttr.DEF]
|
||||
return this.def_base+this.def_buff+this.TALENT[BuffAttr.DEF]
|
||||
}
|
||||
}
|
||||
|
||||
count_atrr(buff:BuffAttr){
|
||||
switch(buff){
|
||||
case BuffAttr.ATK:
|
||||
@@ -264,6 +267,7 @@ export class HeroViewComp extends CCComp {
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.cd=this.check_atrr(BuffAttr.ATK_CD)
|
||||
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||
break
|
||||
case BuffAttr.HP:
|
||||
this.hp_max=this.check_atrr(BuffAttr.HP)
|
||||
@@ -279,7 +283,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
|
||||
add_speed(cd: number){
|
||||
this.buff_cd+=cd
|
||||
this.cd_buff+=cd
|
||||
this.count_atrr(BuffAttr.ATK_CD)
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
|
||||
}
|
||||
@@ -288,9 +292,9 @@ export class HeroViewComp extends CCComp {
|
||||
add_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);
|
||||
this.ap += Math.floor(ap);
|
||||
}else{
|
||||
this.buff_ap += Math.floor(ap);
|
||||
this.ap += Math.floor(ap);
|
||||
}
|
||||
let diff=this.check_atrr(BuffAttr.ATK)-this.ap
|
||||
this.count_atrr(BuffAttr.ATK)
|
||||
@@ -300,9 +304,9 @@ export class HeroViewComp extends CCComp {
|
||||
de_ap(ap: number,is_num:boolean=true){
|
||||
//console.log("[HeroViewComp]:de_ap de:",ap,this.ap)
|
||||
if(is_num){
|
||||
this.ap_base -= Math.floor(ap);
|
||||
this.ap -= Math.floor(ap);
|
||||
}else{
|
||||
this.buff_ap -= Math.floor(ap/100*this.ap);
|
||||
this.ap -= Math.floor(ap/100*this.ap);
|
||||
}
|
||||
let diff=this.check_atrr(BuffAttr.ATK)-this.ap
|
||||
this.count_atrr(BuffAttr.ATK)
|
||||
@@ -313,7 +317,7 @@ export class HeroViewComp extends CCComp {
|
||||
if(is_num){
|
||||
this.hp_base += Math.floor(hp) ;
|
||||
}else{
|
||||
this.buff_hp+=hp
|
||||
this.hp_buff+=hp
|
||||
}
|
||||
let diff=this.check_atrr(BuffAttr.HP)-this.hp_max
|
||||
this.count_atrr(BuffAttr.HP)
|
||||
@@ -321,7 +325,7 @@ export class HeroViewComp extends CCComp {
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.hpup,diff.toFixed(0));
|
||||
}
|
||||
|
||||
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过buff_hp处理
|
||||
de_hp_max(hp: number=0,is_num:boolean=true){ //最大值 只存在数值添加, 比例通过hp_buff处理
|
||||
//console.log("[HeroViewComp]:de_hp_max de:",hp,this.hp_max)
|
||||
this.hp_base -= Math.floor(hp) ;
|
||||
let diff=this.check_atrr(BuffAttr.HP)-this.hp_max
|
||||
@@ -333,7 +337,7 @@ export class HeroViewComp extends CCComp {
|
||||
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.buff_hp)/100)
|
||||
let hp_max=Math.floor(this.hp_max*(100+this.hp_buff)/100)
|
||||
let lost_hp=hp_max-this.hp
|
||||
if(is_num){
|
||||
if(lost_hp > hp){
|
||||
@@ -687,7 +691,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
// to_alive(){
|
||||
// this.is_dead=false
|
||||
// this.hp=this.hp_max*(100+this.buff_hp)/100
|
||||
// this.hp=this.hp_max*(100+this.hp_buff)/100
|
||||
// this.BUFFCOMP.vmdata_update(true)
|
||||
// this.node.setPosition(HeroPos[this.fight_pos].pos)
|
||||
// this.BUFFCOMP.heathed()
|
||||
|
||||
Reference in New Issue
Block a user