dd
This commit is contained in:
@@ -22,6 +22,7 @@ export class HeroConComp extends CCComp {
|
||||
this.on(GameEvent.FightReady,this.fight_ready,this)
|
||||
this.on(GameEvent.UseSpecialCard,this.use_special_card,this)
|
||||
this.on(GameEvent.UseEnhancement,this.use_enhancement,this)
|
||||
this.on(GameEvent.UseTalentCard,this.use_talent_card,this)
|
||||
|
||||
this.heroView=this.node.getComponent(HeroViewComp)
|
||||
console.log("[HeroConCompComp]:onLoad",this.heroView)
|
||||
@@ -74,22 +75,50 @@ export class HeroConComp extends CCComp {
|
||||
console.log("[HeroConCompComp]:use_special_card",data)
|
||||
}
|
||||
use_enhancement(e:GameEvent,data:any){
|
||||
// console.log("[HeroViewComp]:use_enhancement",data)
|
||||
switch(data.type){
|
||||
case EnhancementType.ATTACK:
|
||||
this.heroView.add_ap(data.value)
|
||||
break
|
||||
case EnhancementType.ATTACK_SPEED:
|
||||
this.heroView.add_speed(data.value)
|
||||
break
|
||||
case EnhancementType.HEALTH:
|
||||
this.heroView.add_hp_max(data.value,true)
|
||||
break
|
||||
case EnhancementType.DEF:
|
||||
this.heroView.add_def(data.value)
|
||||
break
|
||||
}
|
||||
// console.log("[HeroViewComp]:use_enhancement",data)
|
||||
switch(data.type){
|
||||
case EnhancementType.ATTACK:
|
||||
this.heroView.add_ap(data.value)
|
||||
break
|
||||
case EnhancementType.ATTACK_SPEED:
|
||||
this.heroView.add_speed(data.value)
|
||||
break
|
||||
case EnhancementType.HEALTH:
|
||||
this.heroView.add_hp_max(data.value,true)
|
||||
break
|
||||
case EnhancementType.DEF:
|
||||
this.heroView.add_def(data.value)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
use_talent_card(e:GameEvent,data:any){
|
||||
console.log("[HeroConCompComp]:use_talent_card",data)
|
||||
switch(data.buffType){
|
||||
case BuffAttr.ATK:
|
||||
this.heroView.TALENT[BuffAttr.ATK]+=data.value
|
||||
this.heroView.count_ap()
|
||||
break
|
||||
case BuffAttr.ATK_CD:
|
||||
this.heroView.TALENT[BuffAttr.ATK_CD]+=data.value
|
||||
break
|
||||
case BuffAttr.HP:
|
||||
this.heroView.TALENT[BuffAttr.HP]+=data.value
|
||||
break
|
||||
case BuffAttr.CRITICAL:
|
||||
this.heroView.TALENT[BuffAttr.CRITICAL]+=data.value
|
||||
break
|
||||
case BuffAttr.CRITICAL_DMG:
|
||||
this.heroView.TALENT[BuffAttr.CRITICAL_DMG]+=data.value
|
||||
break
|
||||
case BuffAttr.DODGE:
|
||||
this.heroView.TALENT[BuffAttr.DODGE]+=data.value
|
||||
break
|
||||
case BuffAttr.DEBUFF_COUNT:
|
||||
this.heroView.TALENT[BuffAttr.DEBUFF_COUNT]+=data.value
|
||||
break
|
||||
}
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
|
||||
@@ -59,6 +59,7 @@ export class HeroViewComp extends CCComp {
|
||||
ap_base:number=0;
|
||||
// atk_speed: number = 1;
|
||||
cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
buff_cd:number=0;
|
||||
dis: number = 80;
|
||||
at: number = 0; /** 冷却时间 */
|
||||
atk_skill:number=0;
|
||||
@@ -103,6 +104,7 @@ export class HeroViewComp extends CCComp {
|
||||
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; //眩晕
|
||||
@@ -111,7 +113,23 @@ export class HeroViewComp extends CCComp {
|
||||
DEBUFF_COUNT:number=0; //debuff 持续次数
|
||||
DEBUFF_UP:number=0; //debuff 概率提升
|
||||
|
||||
|
||||
TALENT:any={
|
||||
[BuffAttr.ATK]:0,
|
||||
[BuffAttr.CRITICAL]:0,
|
||||
[BuffAttr.CRITICAL_DMG]:0,
|
||||
[BuffAttr.DODGE]:0,
|
||||
[BuffAttr.DEBUFF_COUNT]:0,
|
||||
[BuffAttr.HP]:0,
|
||||
[BuffAttr.DEF]:0,
|
||||
[BuffAttr.PUNCTURE]:0,
|
||||
[BuffAttr.ATK_CD]:0,
|
||||
[BuffAttr.SKILL_CD]:0,
|
||||
[BuffAttr.FROST_RATIO]:0,
|
||||
[BuffAttr.KNOCKBACK]:0,
|
||||
[BuffAttr.STUN_RATTO]:0,
|
||||
[BuffAttr.REFLECT]:0,
|
||||
[BuffAttr.LIFESTEAL]:0,
|
||||
}
|
||||
|
||||
|
||||
private damageQueue: Array<{
|
||||
@@ -150,6 +168,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
|
||||
}
|
||||
|
||||
update(dt: number){
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
// if(this.is_dead) {
|
||||
@@ -218,11 +237,33 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.defup,def.toFixed(0));
|
||||
}
|
||||
|
||||
add_speed(cd: number){
|
||||
this.cd -=this.cd*cd/100
|
||||
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||
this.buff_cd+=cd
|
||||
this.count_cd()
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.speedup,speed.toFixed(0));
|
||||
}
|
||||
|
||||
check_cd(){
|
||||
return this.cd/((this.buff_cd+this.TALENT[BuffAttr.ATK_CD])/100+1)
|
||||
}
|
||||
count_cd(){
|
||||
this.cd=this.check_cd()
|
||||
if(this.is_master) {
|
||||
this.BUFFCOMP.vmdata_update();
|
||||
}
|
||||
}
|
||||
check_ap(){
|
||||
return Math.floor(this.ap_base*(100+this.buff_ap+this.TALENT[BuffAttr.ATK])/100)
|
||||
}
|
||||
|
||||
count_ap(){
|
||||
this.ap=this.check_ap()
|
||||
if(this.is_master) {
|
||||
this.BUFFCOMP.vmdata_update();
|
||||
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
|
||||
}
|
||||
}
|
||||
add_ap(ap: number,is_num:boolean=true){
|
||||
// console.log("[HeroViewComp]:add_ap add:",ap,this.ap)
|
||||
if(is_num){
|
||||
@@ -230,15 +271,9 @@ export class HeroViewComp extends CCComp {
|
||||
}else{
|
||||
this.buff_ap += Math.floor(ap);
|
||||
}
|
||||
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
|
||||
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
|
||||
|
||||
let diff=this.check_ap()-this.ap
|
||||
this.count_ap()
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
|
||||
|
||||
if(this.is_master) {
|
||||
this.BUFFCOMP.vmdata_update();
|
||||
oops.message.dispatchEvent(GameEvent.APChange,{is_master:this.is_master,fac:this.fac})
|
||||
}
|
||||
}
|
||||
|
||||
de_ap(ap: number,is_num:boolean=true){
|
||||
@@ -248,12 +283,8 @@ export class HeroViewComp extends CCComp {
|
||||
}else{
|
||||
this.buff_ap -= Math.floor(ap/100*this.ap);
|
||||
}
|
||||
let diff=Math.floor(this.ap_base*(100+this.buff_ap)/100)-this.ap
|
||||
this.ap = Math.floor(this.ap_base*(100+this.buff_ap)/100)
|
||||
|
||||
// this.BUFFCOMP.tooltip(TooltipTypes.apup,diff.toFixed(0));
|
||||
|
||||
if(this.is_master) this.BUFFCOMP.vmdata_update()
|
||||
let diff=this.check_ap()-this.ap
|
||||
this.count_ap()
|
||||
}
|
||||
|
||||
add_hp_max(hp: number=0,is_num:boolean=false){
|
||||
|
||||
Reference in New Issue
Block a user