血量更新 修改
This commit is contained in:
@@ -13,8 +13,8 @@ const { ccclass, property } = _decorator;
|
|||||||
@ccclass('Main')
|
@ccclass('Main')
|
||||||
export class Main extends Root {
|
export class Main extends Root {
|
||||||
start() {
|
start() {
|
||||||
// if (DEBUG) profiler.showStats();
|
if (DEBUG) profiler.showStats();
|
||||||
// PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
|
||||||
// // | EPhysics2DDrawFlags.Pair
|
// // | EPhysics2DDrawFlags.Pair
|
||||||
// |EPhysics2DDrawFlags.CenterOfMass
|
// |EPhysics2DDrawFlags.CenterOfMass
|
||||||
// |EPhysics2DDrawFlags.Joint
|
// |EPhysics2DDrawFlags.Joint
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ export const MBSet = {
|
|||||||
ap_exp:100,
|
ap_exp:100,
|
||||||
def_exp:100,
|
def_exp:100,
|
||||||
hp_exp:100,
|
hp_exp:100,
|
||||||
ap_add:10,
|
ap_add:2,
|
||||||
def_add:5,
|
def_add:1,
|
||||||
hp_add:50,
|
hp_add:5,
|
||||||
crit_add:1,
|
crit_add:1,
|
||||||
dodge_add:1,
|
dodge_add:1,
|
||||||
ap_cost:1,
|
ap_cost:1,
|
||||||
|
|||||||
@@ -29,22 +29,22 @@ run:number = 0; // 0有目标 带方向,1贝塞尔曲线 2 不动 ,3 直线
|
|||||||
*/
|
*/
|
||||||
export const SkillSet={
|
export const SkillSet={
|
||||||
6001:{uuid: 6001,path: "6001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
|
6001:{uuid: 6001,path: "6001",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "火球术",sp_name:"fire",info:"释放一个火球术攻击敌人",
|
||||||
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:600, },
|
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:3,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
6002:{uuid: 6002,path: "6002",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人",
|
6002:{uuid: 6002,path: "6002",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "寒冰箭",sp_name:"ice",info:"释放一个寒冰箭攻击敌人",
|
||||||
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:600, },
|
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
6003:{uuid: 6003,path: "6003",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人",
|
6003:{uuid: 6003,path: "6003",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "强效射击",sp_name:"b_arrow",info:"释放一个火球术攻击敌人",
|
||||||
dis:1,count:1,in:0,run:1,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:600, },
|
dis:1,count:1,in:0,run:1,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
6004:{uuid: 6004,path: "6004",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人",
|
6004:{uuid: 6004,path: "6004",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 3,name: "奥术冲击",sp_name:"bm_ball",info:"释放一个寒冰箭攻击敌人",
|
||||||
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:600, },
|
dis:1,count:1,in:0,run:0,ap:10,hp:0,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
6005:{uuid: 6005,path: "6005",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "挥砍",sp_name:"patk",info:"蓄力释放剑气攻击敌人",
|
6005:{uuid: 6005,path: "6005",type: 1,tg:3,angle:true,exp:30,upcost:2,level: 1,name: "挥砍",sp_name:"patk",info:"蓄力释放剑气攻击敌人",
|
||||||
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:6000,},
|
dis:1,count:1,in:0,run:0,ap:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:300,},
|
||||||
|
|
||||||
6101:{uuid: 6101,path: "6101",type: 91,tg:1,angle:false,exp:30,upcost:2,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
|
6101:{uuid: 6101,path: "6101",type: 91,tg:1,angle:false,exp:30,upcost:2,level: 1,name: "治愈术",sp_name:"heath",info:"释放一个寒冰箭攻击敌人",
|
||||||
dis:1,count:1,in:0,run:1,ap:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:450, },
|
dis:1,count:1,in:0,run:1,ap:0,hp:3,shield:0,sd:10,cd:1,bsd:0,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
6102:{uuid: 6102,path: "6102",type: 91,tg:0,angle:false,exp:30,upcost:2,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
|
6102:{uuid: 6102,path: "6102",type: 91,tg:0,angle:false,exp:30,upcost:2,level: 1,name: "魔法盾",sp_name:"shield",info:"释放一个寒冰箭攻击敌人",
|
||||||
dis:1,count:1,in:0.2,run:2,ap:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:6001,sk_count:0,speed:450, },
|
dis:1,count:1,in:0.2,run:2,ap:0,hp:0,shield:1,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
6103:{uuid: 6103,path: "6103",type: 91,tg:0,angle:false,exp:30,upcost:2,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
|
6103:{uuid: 6103,path: "6103",type: 91,tg:0,angle:false,exp:30,upcost:2,level: 1,name: "狂暴",sp_name:"atkup",info:"释放一个寒冰箭攻击敌人",
|
||||||
dis:1,count:1,in:0.2,run:2,ap:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:6001,sk_count:0,speed:450, },
|
dis:1,count:1,in:0.2,run:2,ap:1,hp:0,shield:0,sd:0,cd:0,bsd:8,bcd:0,sk_uuid:6001,sk_count:0,speed:300, },
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export class Hero extends ecs.Entity {
|
|||||||
hv.uar = hero.uar[slv];
|
hv.uar = hero.uar[slv];
|
||||||
hv.crr = hero.crr[slv];
|
hv.crr = hero.crr[slv];
|
||||||
hv.dgr = hero.dgr[slv];
|
hv.dgr = hero.dgr[slv];
|
||||||
hv.hp= hv.hp_max =hero.hp+hero.hp_up*hv.lv ;
|
hv.rhp_max=hv.hp= hv.hp_max =hero.hp+hero.hp_up*hv.lv ;
|
||||||
hv.ap = hero.ap+hero.ap_up*hv.lv ;
|
hv.ap = hero.ap+hero.ap_up*hv.lv ;
|
||||||
hv.def= hero.def+hero.def_up*hv.lv;
|
hv.def= hero.def+hero.def_up*hv.lv;
|
||||||
hv.cd = hero.a_cd
|
hv.cd = hero.a_cd
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
|
|
||||||
hp: number = 100; /** 血量 */
|
hp: number = 100; /** 血量 */
|
||||||
hp_max: number = 100; /** 最大血量 */
|
hp_max: number = 100; /** 最大血量 */
|
||||||
|
rhp_max: number = 100;
|
||||||
hp_speed: number = 0; //每秒回复量
|
hp_speed: number = 0; //每秒回复量
|
||||||
|
|
||||||
pw: number = 0; /**能量**/
|
pw: number = 0; /**能量**/
|
||||||
@@ -178,13 +179,16 @@ export class HeroViewComp extends CCComp {
|
|||||||
let self_x = selfCollider.node.position.x;
|
let self_x = selfCollider.node.position.x;
|
||||||
let other_x = otherCollider.node.position.x;
|
let other_x = otherCollider.node.position.x;
|
||||||
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
|
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
|
||||||
|
|
||||||
if(selfCollider.group==BoxSet.HERO){
|
if(selfCollider.group==BoxSet.HERO){
|
||||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 8 ){
|
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 20 ){
|
||||||
|
// this.node.setSiblingIndex(otherCollider.node.getSiblingIndex()-10)
|
||||||
this.stop_cd = 0.1;
|
this.stop_cd = 0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(selfCollider.group==BoxSet.MONSTER){
|
if(selfCollider.group==BoxSet.MONSTER){
|
||||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x > other_x && Math.abs(other_x-self_x) < 8 ){
|
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x > other_x && Math.abs(other_x-self_x) < 20 ){
|
||||||
|
// this.node.setSiblingIndex(otherCollider.node.getSiblingIndex()-10)
|
||||||
this.stop_cd = 0.1;
|
this.stop_cd = 0.1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +218,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
this.at += dt;
|
this.at += dt;
|
||||||
this.check_enemy_alive()
|
this.check_enemy_alive()
|
||||||
this.in_atk(dt);
|
this.in_atk(dt);
|
||||||
// this.hp_show()
|
this.hp_show()
|
||||||
this.move(dt);
|
this.move(dt);
|
||||||
this.check_mission_buf()
|
this.check_mission_buf()
|
||||||
}
|
}
|
||||||
@@ -223,41 +227,35 @@ export class HeroViewComp extends CCComp {
|
|||||||
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
|
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
|
||||||
this.def_max=(100+smc.vmdata.mission.def)/100*this.def
|
this.def_max=(100+smc.vmdata.mission.def)/100*this.def
|
||||||
this.dodge_max=(100+smc.vmdata.mission.dodge)/100*this.dodge
|
this.dodge_max=(100+smc.vmdata.mission.dodge)/100*this.dodge
|
||||||
|
this.rhp_max=(100+smc.vmdata.mission.hp)/100*this.hp_max
|
||||||
if(this.box_group == BoxSet.MONSTER){
|
if(this.box_group == BoxSet.MONSTER){
|
||||||
this.ap_max=(100+smc.vmdata.mission.map)/100*this.ap
|
this.ap_max=(100+smc.vmdata.mission.map)/100*this.ap
|
||||||
this.crit_max=(100+smc.vmdata.mission.mcrit)/100*this.crit
|
this.crit_max=(100+smc.vmdata.mission.mcrit)/100*this.crit
|
||||||
this.def_max=(100+smc.vmdata.mission.mdef)/100*this.def
|
this.def_max=(100+smc.vmdata.mission.mdef)/100*this.def
|
||||||
this.dodge_max=(100+smc.vmdata.mission.mdodge)/100*this.dodge
|
this.dodge_max=(100+smc.vmdata.mission.mdodge)/100*this.dodge
|
||||||
|
this.rhp_max=(100+smc.vmdata.mission.mhp)/100*this.hp_max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
check_enemy_alive(){
|
check_enemy_alive(){
|
||||||
let dir = 320
|
let dir = 320
|
||||||
|
let enemys=smc.enemy_pos
|
||||||
this.enemy = v3(720,this.node.position.y)
|
this.enemy = v3(720,this.node.position.y)
|
||||||
if(this.box_group == BoxSet.MONSTER){
|
if(this.box_group == BoxSet.MONSTER){
|
||||||
for (let i = 0; i < smc.hero_pos.length; i++) {
|
enemys=smc.hero_pos
|
||||||
let ho:any = smc.hero_pos[i];
|
this.enemy=v3(-720,this.node.position.y)
|
||||||
let x=Math.abs(ho.x-this.node.position.x)
|
}
|
||||||
if(x < dir){
|
for (let i = 0; i < enemys.length; i++) {
|
||||||
dir = x
|
let ho:any = enemys[i];
|
||||||
this.enemy = ho
|
let x=Math.abs(ho.x-this.node.position.x)
|
||||||
}
|
if(x < dir){
|
||||||
|
dir = x
|
||||||
|
this.enemy = ho
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.box_group == BoxSet.HERO){
|
|
||||||
for (let i = 0; i < smc.enemy_pos.length; i++) {
|
|
||||||
let mon:any = smc.enemy_pos[i];
|
|
||||||
let x=Math.abs(mon.x-this.node.position.x)
|
|
||||||
if(x < dir){
|
|
||||||
dir = x
|
|
||||||
this.enemy = mon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(dir < this.dis){
|
if(dir < this.dis){
|
||||||
this.is_atking=true
|
this.is_atking=true
|
||||||
if(this.dis-dir > 45 ) this.stop_cd = 0.1
|
if(this.dis-dir > 80 &&this.type > 0 ) this.stop_cd = 0.1
|
||||||
}else{
|
}else{
|
||||||
this.is_atking=false
|
this.is_atking=false
|
||||||
}
|
}
|
||||||
@@ -312,7 +310,9 @@ export class HeroViewComp extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hp_show(){
|
hp_show(){
|
||||||
if(this.hp == this.hp_max){
|
let hp_progress= this.hp/this.rhp_max;
|
||||||
|
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||||
|
if(this.hp == this.rhp_max){
|
||||||
this.node.getChildByName("top").getChildByName("hp").active = false;
|
this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||||
} else{
|
} else{
|
||||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||||
@@ -563,8 +563,8 @@ export class HeroViewComp extends CCComp {
|
|||||||
if(!heros[i].HeroView) continue
|
if(!heros[i].HeroView) continue
|
||||||
let hero = heros[i].HeroView;
|
let hero = heros[i].HeroView;
|
||||||
if(SkillSet[skill].type==91){ //血量最少单体
|
if(SkillSet[skill].type==91){ //血量最少单体
|
||||||
if((hero.hp_max-hero.hp) > least_hp){
|
if((hero.rhp_max-hero.hp) > least_hp){
|
||||||
least_hp = (hero.hp_max-hero.hp)
|
least_hp = (hero.rhp_max-hero.hp)
|
||||||
t_hero = hero
|
t_hero = hero
|
||||||
}
|
}
|
||||||
}else{ //群体
|
}else{ //群体
|
||||||
@@ -609,19 +609,14 @@ export class HeroViewComp extends CCComp {
|
|||||||
add_hp(hp: number=0){
|
add_hp(hp: number=0){
|
||||||
this.heathed();
|
this.heathed();
|
||||||
this.hp+=hp;
|
this.hp+=hp;
|
||||||
if(this.hp > this.hp_max){
|
if(this.hp > this.rhp_max){
|
||||||
this.hp = this.hp_max;
|
this.hp = this.rhp_max;
|
||||||
}
|
}
|
||||||
this.tooltip(2,hp.toFixed(0));
|
this.tooltip(2,hp.toFixed(0));
|
||||||
let hp_progress= this.hp/this.hp_max;
|
|
||||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
|
||||||
}
|
}
|
||||||
add_hp_max(hp: number=0){
|
add_hp_max(hp: number=0){
|
||||||
this.hp_max_add()
|
this.hp_max_add()
|
||||||
this.hp += hp;
|
this.hp += hp/100*this.hp_max;
|
||||||
this.hp_max += hp;
|
|
||||||
let hp_progress= this.hp/this.hp_max;
|
|
||||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
|
||||||
}
|
}
|
||||||
hp_change(hp: number,is_crit:boolean=false){
|
hp_change(hp: number,is_crit:boolean=false){
|
||||||
if(this.is_dead){
|
if(this.is_dead){
|
||||||
@@ -636,11 +631,10 @@ export class HeroViewComp extends CCComp {
|
|||||||
this.tooltip(1,hp.toFixed(0),250);
|
this.tooltip(1,hp.toFixed(0),250);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.hp > this.hp_max){
|
if(this.hp > this.rhp_max){
|
||||||
this.hp = this.hp_max;
|
this.hp = this.rhp_max;
|
||||||
}
|
}
|
||||||
let hp_progress= this.hp/this.hp_max;
|
|
||||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
|
||||||
if(this.hp <= 0){
|
if(this.hp <= 0){
|
||||||
this.dead();
|
this.dead();
|
||||||
this.to_grave()
|
this.to_grave()
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ export class HCardComp extends CCComp {
|
|||||||
this.node.getChildByName("bg").getComponent(Sprite).grayscale=false
|
this.node.getChildByName("bg").getComponent(Sprite).grayscale=false
|
||||||
this.is_dead=false
|
this.is_dead=false
|
||||||
}
|
}
|
||||||
this.hp.string=this.heros[this.hi].HeroView.hp_max
|
this.hp.string=this.heros[this.hi].HeroView.rhp_max
|
||||||
this.ap.string=this.heros[this.hi].HeroView.ap*(smc.vmdata.mission.ap+100)/100
|
this.ap.string=this.heros[this.hi].HeroView.ap*(smc.vmdata.mission.ap+100)/100
|
||||||
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
|
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.rhp_max
|
||||||
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
|
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,12 @@ export class Skill extends ecs.Entity {
|
|||||||
let angle=0
|
let angle=0
|
||||||
if(SkillSet[uuid].angle){
|
if(SkillSet[uuid].angle){
|
||||||
angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;
|
angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;
|
||||||
|
if(t_pos.x<0){
|
||||||
|
angle+=180
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sv.angle = angle;
|
sv.angle = angle;
|
||||||
// console.log(SkillSet[uuid].name+"angle:"+angle)
|
console.log(group+" "+SkillSet[uuid].name+"angle:"+angle)
|
||||||
sv.s_uuid = uuid;
|
sv.s_uuid = uuid;
|
||||||
sv.ap = ap;
|
sv.ap = ap;
|
||||||
sv.is_crit=is_crit
|
sv.is_crit=is_crit
|
||||||
|
|||||||
Reference in New Issue
Block a user