hero 界面调整 局内英雄不再升级,改为升级局内技能
This commit is contained in:
@@ -80,7 +80,9 @@ export class Hero extends ecs.Entity {
|
||||
hv.hero_type= HInf.type;
|
||||
hv.speed =hv.ospeed = HInf.speed;
|
||||
hv.dis = HInf.dis;
|
||||
hv.power = HInf.power;
|
||||
hv.pw = HInf.pw;
|
||||
hv.pwm= HInf.pwm;
|
||||
hv.pws= HInf.pws
|
||||
hv.lv = HInf.lv;
|
||||
hv.type = HInf.type;
|
||||
hv.sk1 = HInf.sk1;
|
||||
@@ -88,8 +90,14 @@ export class Hero extends ecs.Entity {
|
||||
hv.sk3 = HInf.sk3;
|
||||
hv.sk4 = HInf.sk4;
|
||||
hv.sk5 = HInf.sk5;
|
||||
hv.skr = HInf.skr;
|
||||
hv.akc = HInf.akc;
|
||||
hv.uac = HInf.uac;
|
||||
hv.crc = HInf.crc;
|
||||
hv.dgc = HInf.dgc;
|
||||
hv.akr = HInf.akr;
|
||||
hv.uar = HInf.uar;
|
||||
hv.crr = HInf.crr;
|
||||
hv.dgr = HInf.dgr;
|
||||
hv.type = HInf.type;
|
||||
hv.hp= hv.hp_max =HInf.hp;
|
||||
hv.ap = HInf.ap;
|
||||
@@ -99,7 +107,6 @@ export class Hero extends ecs.Entity {
|
||||
hv.crit = HInf.crit; //暴击率
|
||||
hv.crit_add = HInf.crit_add;//暴击伤害加成
|
||||
hv.dodge = HInf.dodge; //闪避率
|
||||
hv.power_max= HInf.power_max
|
||||
this.add(hv);
|
||||
}
|
||||
set_ratio(uuid:number){
|
||||
|
||||
@@ -46,7 +46,6 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
box_group:number = BoxSet.HERO;
|
||||
atk_range:number = 150;
|
||||
private timer:Timer = new Timer(1); //计时器
|
||||
|
||||
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
@@ -57,17 +56,24 @@ export class HeroViewComp extends CCComp {
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
hp_speed: number = 0; //每秒回复量
|
||||
|
||||
power: number = 0; /**能量**/
|
||||
power_max: number = 1200; /** 能量最大值 */
|
||||
power_speed: number = 1; //能量回复速度每0.1秒回复量
|
||||
pw: number = 0; /**能量**/
|
||||
pwm: number = 15; /** 能量最大值 */
|
||||
pws: number = 1; //能量回复速度每0.1秒回复量
|
||||
pwt:Timer = new Timer(1); //计时器
|
||||
|
||||
sk1:number = 9001;
|
||||
sk2:number = 1001;
|
||||
sk3:number = 1001;
|
||||
sk4:number = 1001;
|
||||
sk5:number = 1001;
|
||||
skr:any=[0,0,0,0,0,0];
|
||||
uar:any=[0,0,0,0,0,0];
|
||||
akr:number=0;
|
||||
uar:number=0;
|
||||
dgr:number=0;
|
||||
crr:number=0;
|
||||
akc:number=0;
|
||||
uac:number=0;
|
||||
dgc:number=0;
|
||||
crc:number=0;
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_buff: number = 0;
|
||||
ap_buffs:any = [];
|
||||
@@ -88,7 +94,11 @@ export class HeroViewComp extends CCComp {
|
||||
ospeed: number = 100; /** 角色初始速度 */
|
||||
|
||||
atk_count: number = 0;
|
||||
atked_count: number = 0;
|
||||
atked_count: number = 0;
|
||||
dodge_count: number = 0;
|
||||
crit_count: number = 0;
|
||||
|
||||
|
||||
stop_cd: number = 0.5; /*停止倒计时*/
|
||||
|
||||
dir_y:number = 0;
|
||||
@@ -125,7 +135,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
let collider = this.getComponent(Collider2D);
|
||||
collider.group = this.box_group;
|
||||
console.log("hero collider ",this.scale,collider);
|
||||
// console.log("hero collider ",this.scale,collider);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
||||
@@ -204,12 +214,10 @@ export class HeroViewComp extends CCComp {
|
||||
return
|
||||
}
|
||||
|
||||
// if (this.timer.update(dt)) {
|
||||
// this.power_change(this.power_speed)
|
||||
// }
|
||||
// if(this.anm_timer.update(dt)) {
|
||||
// this.handle_skill(this.sk2)
|
||||
// }
|
||||
if (this.pwt.update(dt)) {
|
||||
this.pw+=this.pws
|
||||
}
|
||||
this.check_power()
|
||||
this.check_atk_buffs(dt)
|
||||
this.check_atk_counts()
|
||||
this.in_stop(dt);
|
||||
@@ -220,23 +228,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.move(dt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
change_anm(){
|
||||
if (this.anm_name == "atk") {
|
||||
this.as.atk()
|
||||
this.anm_name = "move"
|
||||
}
|
||||
if (this.anm_name == "move") {
|
||||
this.as.move()
|
||||
this.anm_name = "atk"
|
||||
}
|
||||
if (this.anm_name == "idle") {
|
||||
this.as.idle()
|
||||
this.anm_name = "move"
|
||||
}
|
||||
}
|
||||
|
||||
check_enemy_alive(){
|
||||
let dir = 320
|
||||
this.enemy = v3(720,this.node.position.y)
|
||||
@@ -329,11 +320,26 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
return {pos,t_pos}
|
||||
}
|
||||
//能量判断
|
||||
check_power(){
|
||||
if(this.pw >= this.pwm){
|
||||
this.pw = 0
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
//暴击判断
|
||||
check_crit(){
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
if(i < this.crit){
|
||||
console.log("攻击会暴击",i,this.crit);
|
||||
this.tooltip(5,"*会心一击*");
|
||||
this.crit_count += 1
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
@@ -343,21 +349,21 @@ export class HeroViewComp extends CCComp {
|
||||
check_dodge(){
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
if(i < this.dodge){
|
||||
this.tooltip(5,"闪避");
|
||||
console.log("闪避了",i,this.dodge);
|
||||
this.tooltip(5,"/闪避/");
|
||||
this.dodge_count += 1
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
check_atk_counts(){
|
||||
if(this.atk_count >= 1){
|
||||
if(this.atk_count >= this.akc){
|
||||
this.atk_count = 0
|
||||
console.log("atk_count 清零:"+this.atk_count);
|
||||
// console.log("atk_count 清零:"+this.atk_count);
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
console.log("大招判断: i="+i+":skr="+this.skr[this.lv]);
|
||||
if(i < this.skr[this.lv]){
|
||||
console.log("大招触发: i="+i+":skr="+this.skr[this.lv]);
|
||||
// console.log("攻击判断: i="+i+":akr="+this.akr);
|
||||
if(i < this.akr){
|
||||
// console.log("攻击触发: i="+i+":akr="+this.akr);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
@@ -365,12 +371,40 @@ export class HeroViewComp extends CCComp {
|
||||
this.handle_skill(this.sk2)
|
||||
}
|
||||
}
|
||||
if(this.atked_count >= 1){
|
||||
if(this.dodge_count >= this.dgc){
|
||||
this.dodge_count = 0
|
||||
// console.log("dodge_count 清零:"+this.dodge_count);
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
// console.log("闪避判断: i="+i+":dgr="+this.dgr);
|
||||
if(i < this.dgr){
|
||||
// console.log("闪避触发: i="+i+":dgr="+this.dgr);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
}
|
||||
}
|
||||
if(this.crit_count >= this.crc){
|
||||
this.crit_count = 0
|
||||
// console.log("crit_count 清零:"+this.crit_count);
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
// console.log("暴击判断: i="+i+":crr="+this.crr);
|
||||
if(i < this.crr){
|
||||
// console.log("闪避触发: i="+i+":crr="+this.crr);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
}
|
||||
}
|
||||
if(this.atked_count >= this.uac){
|
||||
this.atked_count = 0
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
console.log("受伤判断:i="+i+":skr="+this.skr[this.lv]);
|
||||
if(i < this.skr[this.lv]){
|
||||
console.log("受伤触发: i="+i+":skr="+this.skr[this.lv]);
|
||||
// console.log("受伤判断:i="+i+":akr="+this.uar);
|
||||
if(i < this.uar){
|
||||
// console.log("受伤触发: i="+i+":uar="+this.uar);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
|
||||
Reference in New Issue
Block a user