大招修改为攻击触发,或者受伤触发
This commit is contained in:
@@ -4,7 +4,7 @@ export const HeroInfo = {
|
||||
uuid: 9001, path: "k1", type: 1, lv: 1,name: "白骑士", wp:1001,arm:2001,ring:3001,shoes:4001,
|
||||
exp_type:0,lv2:5,lv3:10,lv4:20,lv5:30,a_exp:1,ua_exp:1,d_exp:10,ed_exp:1,a_buff:8101,ua_buff:8201,d_buff:8301,ed_buff:8401,
|
||||
ap: 20, ap_rate:0.1, hp: 100, hp_rate:0.1, def:10,def_rate:0.1, dis: 100, a_cd: 1, power: 0, power_max: 15, speed: 40,
|
||||
sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,
|
||||
sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,skr:[0,10,20,30,40,50]
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -81,13 +81,14 @@ export class Hero extends ecs.Entity {
|
||||
hv.speed =hv.ospeed = HInf.speed;
|
||||
hv.dis = HInf.dis;
|
||||
hv.power = HInf.power;
|
||||
hv.level = HInf.level;
|
||||
hv.lv = HInf.lv;
|
||||
hv.type = HInf.type;
|
||||
hv.sk1 = HInf.sk1;
|
||||
hv.sk2 = HInf.sk2;
|
||||
hv.sk3 = HInf.sk3;
|
||||
hv.sk4 = HInf.sk4;
|
||||
hv.sk5 = HInf.sk5;
|
||||
hv.sk5 = HInf.sk5;
|
||||
hv.skr = HInf.skr;
|
||||
hv.type = HInf.type;
|
||||
hv.hp= hv.hp_max =HInf.hp;
|
||||
hv.ap = HInf.ap;
|
||||
|
||||
@@ -40,14 +40,14 @@ export class HeroViewComp extends CCComp {
|
||||
hero_uuid:number = 1001;
|
||||
hero_name : string = "hero";
|
||||
hero_type:number = 1;
|
||||
level:number =1;
|
||||
lv:number =1;
|
||||
scale: number = 1; /** 角色阵营 1:hero -1 :mon */
|
||||
type: number = 1; /**角色类型 1近战 2 远程 3 辅助 */
|
||||
|
||||
box_group:number = BoxSet.HERO;
|
||||
atk_range:number = 150;
|
||||
private timer:Timer = new Timer(1); //计时器
|
||||
|
||||
|
||||
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
is_stop:boolean = false;
|
||||
@@ -66,7 +66,7 @@ export class HeroViewComp extends CCComp {
|
||||
sk3:number = 1001;
|
||||
sk4:number = 1001;
|
||||
sk5:number = 1001;
|
||||
|
||||
skr:any=[0,0,0,0,0,0];
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_buff: number = 0;
|
||||
ap_buffs:any = [];
|
||||
@@ -204,9 +204,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.setPosition(pos)
|
||||
return
|
||||
}
|
||||
if (this.timer.update(dt)) {
|
||||
this.power_change(this.power_speed)
|
||||
}
|
||||
// if (this.timer.update(dt)) {
|
||||
// this.power_change(this.power_speed)
|
||||
// }
|
||||
// if(this.anm_timer.update(dt)) {
|
||||
// this.change_anm()
|
||||
// }
|
||||
@@ -307,20 +307,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
}
|
||||
}
|
||||
|
||||
power_change(power: number){
|
||||
this.power += power;
|
||||
if(this.power >= this.power_max){
|
||||
this.as.atk()
|
||||
// this.to_speek(smc.skills[this.sk2].name)
|
||||
this.scheduleOnce(()=>{
|
||||
this.handle_skill(this.sk2);
|
||||
},0.5)
|
||||
this.power = 0
|
||||
}
|
||||
// let power_progress= this.power/this.power_max;
|
||||
// this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
|
||||
}
|
||||
skill_pos(){
|
||||
return v3(0,35)
|
||||
}
|
||||
@@ -343,6 +329,54 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
return {pos,t_pos}
|
||||
}
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.at >= this.cd){
|
||||
if(this.is_atking){
|
||||
this.at = 0;
|
||||
// console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
console.log("大招触发判断: i="+i+":skr="+this.skr[this.lv]);
|
||||
if(i < this.skr[this.lv]){
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
|
||||
return
|
||||
}
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot_enemy(this.sk1)
|
||||
},0.3)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//使用max_skill
|
||||
handle_skill(skill:number){
|
||||
|
||||
switch (smc.skills[skill].tg) {
|
||||
case 0: //自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
break;
|
||||
case 1: //伙伴
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 2: //自己和伙伴
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 3: //敌人
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
case 4: //敌人和自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
shoot_enemy(sk1:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
@@ -413,32 +447,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
}
|
||||
//使用max_skill
|
||||
handle_skill(skill:number){
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
switch (smc.skills[skill].tg) {
|
||||
case 0: //自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
break;
|
||||
case 1: //伙伴
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 2: //自己和伙伴
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 3: //敌人
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
case 4: //敌人和自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
to_speek(words:string,time:number=0.5){
|
||||
this.speek_time=0.5
|
||||
this.node.getChildByName("tooltip").active=true
|
||||
@@ -455,24 +464,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("tooltip").active=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.at >= this.cd){
|
||||
if(this.is_atking){
|
||||
this.at = 0;
|
||||
console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot_enemy(this.sk1)
|
||||
},0.4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
heathed(){
|
||||
this.node.getChildByName("heathed").active=true
|
||||
|
||||
}
|
||||
hp_max_add(){
|
||||
console.log("hp_max_add 动画");
|
||||
@@ -527,7 +521,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
// console.log(this.ap_buffs)
|
||||
}
|
||||
|
||||
check_atk_buffs(dt: number){
|
||||
for(let i=0;i<this.ap_buffs.length;i++){
|
||||
let buff=this.ap_buffs[i];
|
||||
@@ -545,20 +538,15 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buff_icon_change(icon:string,value:boolean){
|
||||
// this.node.getChildByName("top").getChildByName("buff").getChildByName(icon).active=value
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
if(this.shield > 0){
|
||||
this.node.getChildByName("shielded").active=true
|
||||
}
|
||||
}
|
||||
|
||||
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){
|
||||
// console.log("tooltip",type);
|
||||
let tip =ecs.getEntity<Tooltip>(Tooltip);
|
||||
|
||||
Reference in New Issue
Block a user