hero 添加了buff up max 特效,hero设定继续完善
This commit is contained in:
@@ -88,8 +88,8 @@ export class Hero extends ecs.Entity {
|
||||
hv.sk5 = hero_set.sk5;
|
||||
hv.type = hero_set.type;
|
||||
hv.hp= hv.hp_max =hero_set.hp;
|
||||
hv.atk = hero_set.atk;
|
||||
hv.atk_cd = hero_set.atk_cd
|
||||
hv.ap = hero_set.ap;
|
||||
hv.cd = hero_set.a_cd
|
||||
hv.power_max= hero_set.power_max
|
||||
this.add(hv);
|
||||
}
|
||||
|
||||
@@ -74,13 +74,13 @@ export class HeroViewComp extends CCComp {
|
||||
sk4:number = 1001;
|
||||
sk5:number = 1001;
|
||||
|
||||
atk: number = 10; /**攻击力 */
|
||||
atk_buff: number = 0;
|
||||
atk_buffs:any = [];
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_buff: number = 0;
|
||||
ap_buffs:any = [];
|
||||
// atk_speed: number = 1;
|
||||
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
cd: number = 1.3; /**攻击速度 攻击间隔 */
|
||||
dis: number = 80;
|
||||
atk_time: number = 0; /** 冷却时间 */
|
||||
at: number = 0; /** 冷却时间 */
|
||||
|
||||
def: number = 0; //防御
|
||||
vun: number = 0; //易伤
|
||||
@@ -125,11 +125,11 @@ export class HeroViewComp extends CCComp {
|
||||
// this.node.getChildByName("shielded").active = false;
|
||||
// this.node.getChildByName("top").setScale(this.scale,1);
|
||||
// this.node.getChildByName("atk").setScale(this.scale,1);
|
||||
// this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString();
|
||||
// this.node.getChildByName("atk").getComponent(Label).string = this.ap.toString();
|
||||
// this.node.getChildByName("hp_max").setScale(this.scale,1);
|
||||
// this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString();
|
||||
// this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group;
|
||||
// this.BoxRang.getComponent(BoxRangComp).atk_range = this.atk_range
|
||||
// this.BoxRang.getComponent(BoxRangComp).atk_range = this.ap_range
|
||||
// this.BoxRang.getComponent(BoxRangComp).offset_x = 300;
|
||||
// console.log("monseter ",this.BoxRang);
|
||||
// console.log("monseter ",this.BoxRang);
|
||||
@@ -230,7 +230,7 @@ export class HeroViewComp extends CCComp {
|
||||
// }
|
||||
this.check_atk_buffs(dt)
|
||||
this.in_stop(dt);
|
||||
this.atk_time += dt;
|
||||
this.at += dt;
|
||||
this.check_enemy_alive()
|
||||
this.in_atk(dt);
|
||||
// this.hp_show()
|
||||
@@ -373,8 +373,8 @@ export class HeroViewComp extends CCComp {
|
||||
shoot_enemy(sk1:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let increase_atk=Math.floor(this.atk*smc.vm_data.mission.hero.atk)
|
||||
let atk = smc.skills[sk1].atk+this.atk_buff+increase_atk;
|
||||
let increase_atk=Math.floor(this.ap*smc.vm_data.mission.hero.atk)
|
||||
let atk = smc.skills[sk1].atk+this.ap_buff+increase_atk;
|
||||
let {pos,t_pos}=this.get_enemy_pos()
|
||||
|
||||
pos.y=pos.y + y
|
||||
@@ -385,15 +385,15 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
to_add_buff(hero:any,s_uuid:number){
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let atk = smc.skills[s_uuid].atk+this.atk;
|
||||
let atk = smc.skills[s_uuid].atk+this.ap;
|
||||
let {pos,t_pos}=this.get_hero_pos(hero)
|
||||
skill.load(pos,this.box_group,this.node,this.sk2,atk,t_pos);
|
||||
if(smc.skills[s_uuid].hp > 0){ //buff加血
|
||||
let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk)
|
||||
let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.ap)
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
if(smc.skills[s_uuid].atk > 0){ //buff加攻击
|
||||
let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.atk)
|
||||
let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.ap)
|
||||
hero.add_atk(increase_atk,smc.skills[s_uuid].bsd)
|
||||
}
|
||||
if(smc.skills[s_uuid].shield > 0){ //buff护盾
|
||||
@@ -481,10 +481,10 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.atk_time >= this.atk_cd){
|
||||
if(this.at >= this.cd){
|
||||
if(this.is_atking){
|
||||
this.atk_time = 0;
|
||||
console.log("atk_cd:"+this.atk_cd);
|
||||
this.at = 0;
|
||||
console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.handle_skill(this.sk1)
|
||||
@@ -544,29 +544,29 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
add_atk(atk: number,time:number=0){
|
||||
if(time > 0){
|
||||
this.atk_buff=0
|
||||
this.ap_buff=0
|
||||
let buff={atk:atk,time:time}
|
||||
this.atk_buffs.push(buff);
|
||||
this.atk_buffs.forEach((element: { atk: number; }) => {
|
||||
this.atk_buff += element.atk
|
||||
this.ap_buffs.push(buff);
|
||||
this.ap_buffs.forEach((element: { atk: number; }) => {
|
||||
this.ap_buff += element.atk
|
||||
});
|
||||
}else{
|
||||
this.atk += atk;
|
||||
this.ap += atk;
|
||||
}
|
||||
// console.log(this.atk_buffs)
|
||||
// console.log(this.ap_buffs)
|
||||
}
|
||||
|
||||
check_atk_buffs(dt: number){
|
||||
for(let i=0;i<this.atk_buffs.length;i++){
|
||||
let buff=this.atk_buffs[i];
|
||||
for(let i=0;i<this.ap_buffs.length;i++){
|
||||
let buff=this.ap_buffs[i];
|
||||
buff.time -= dt;
|
||||
if(buff.time <= 0){
|
||||
this.atk_buff -= buff.atk
|
||||
this.atk_buffs.splice(i,1);
|
||||
this.ap_buff -= buff.atk
|
||||
this.ap_buffs.splice(i,1);
|
||||
}
|
||||
}
|
||||
if(this.atk_buffs.length <= 0){
|
||||
this.atk_buff = 0
|
||||
if(this.ap_buffs.length <= 0){
|
||||
this.ap_buff = 0
|
||||
// this.buff_icon_change("atk",false)
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user