战斗经验统一,由站前选择局内buff
This commit is contained in:
@@ -69,44 +69,53 @@ export class Hero extends ecs.Entity {
|
||||
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO){
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
let HInf= HeroInfo[uuid] // 角色数据
|
||||
let talent= smc.vmdata.talent
|
||||
let hero =smc.heros[uuid]
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
let talent= smc.vmdata.talent //角色英雄数据
|
||||
let role =smc.heros[uuid]
|
||||
let talents=Talents;
|
||||
hv.scale = scale;
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= HInf.name;
|
||||
hv.hero_type= HInf.type;
|
||||
hv.speed =hv.ospeed = HInf.speed;
|
||||
hv.dis = HInf.dis;
|
||||
hv.pw = HInf.pw;
|
||||
hv.pwm= HInf.pwm;
|
||||
hv.pws= HInf.pws
|
||||
hv.lv = hero.lv;
|
||||
hv.slv = hero.slv;
|
||||
hv.type = HInf.type;
|
||||
hv.sk1 = HInf.sk1[hero.slv];
|
||||
hv.sk2 = HInf.sk2[hero.slv];
|
||||
hv.akc = HInf.akc[hero.slv];
|
||||
hv.uac = HInf.uac[hero.slv];
|
||||
hv.crc = HInf.crc[hero.slv];
|
||||
hv.dgc = HInf.dgc[hero.slv];
|
||||
hv.akr = HInf.akr[hero.slv];
|
||||
hv.uar = HInf.uar[hero.slv];
|
||||
hv.crr = HInf.crr[hero.slv];
|
||||
hv.dgr = HInf.dgr[hero.slv];
|
||||
hv.type = HInf.type;
|
||||
hv.hp= hv.hp_max =HInf.hp+HInf.hp_up*hero.lv ;
|
||||
hv.ap = HInf.ap+HInf.ap_up*hero.lv ;
|
||||
hv.def= HInf.def+HInf.def_up*hero.lv;
|
||||
hv.cd = HInf.a_cd
|
||||
hv.crit = HInf.crit; //暴击率
|
||||
hv.crit_add = HInf.crit_add;//暴击伤害加成
|
||||
hv.dodge = HInf.dodge; //闪避率
|
||||
hv.aep=HInf.aep;
|
||||
hv.uaep=HInf.uaep;
|
||||
hv.dep=HInf.dep;
|
||||
hv.hero_name= hero.name;
|
||||
hv.hero_type= hero.type;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.pw = hero.pw;
|
||||
hv.pwm= hero.pwm;
|
||||
hv.pws= hero.pws
|
||||
hv.apw=hero.apw;
|
||||
hv.uapw=hero.uapw;
|
||||
hv.cpw=hero.cpw;
|
||||
hv.dpw=hero.dpw;
|
||||
hv.dopw=hero.dopw;
|
||||
|
||||
hv.lv = role.lv;
|
||||
hv.slv = role.slv;
|
||||
hv.type = hero.type;
|
||||
hv.sk1 = hero.sk1[role.slv];
|
||||
hv.sk2 = hero.sk2[role.slv];
|
||||
hv.sk3 = hero.sk3[role.slv];
|
||||
hv.akc = hero.akc[role.slv];
|
||||
hv.uac = hero.uac[role.slv];
|
||||
hv.crc = hero.crc[role.slv];
|
||||
hv.dgc = hero.dgc[role.slv];
|
||||
hv.akr = hero.akr[role.slv];
|
||||
hv.uar = hero.uar[role.slv];
|
||||
hv.crr = hero.crr[role.slv];
|
||||
hv.dgr = hero.dgr[role.slv];
|
||||
hv.type = hero.type;
|
||||
hv.hp= hv.hp_max =hero.hp+hero.hp_up*role.lv ;
|
||||
hv.ap = hero.ap+hero.ap_up*role.lv ;
|
||||
hv.def= hero.def+hero.def_up*role.lv;
|
||||
hv.cd = hero.a_cd
|
||||
hv.crit = hero.crit; //暴击率
|
||||
hv.crit_add = hero.crit_add;//暴击伤害加成
|
||||
hv.dodge = hero.dodge; //闪避率
|
||||
hv.aexp=hero.aexp;
|
||||
hv.uaexp=hero.uaexp;
|
||||
hv.cexp=hero.cexp
|
||||
hv.doexp=hero.doexp
|
||||
hv.dexp=hero.dexp;
|
||||
|
||||
this.add(hv);
|
||||
}
|
||||
|
||||
@@ -60,10 +60,16 @@ export class HeroViewComp extends CCComp {
|
||||
pw: number = 0; /**能量**/
|
||||
pwm: number = 15; /** 能量最大值 */
|
||||
pws: number = 1; //能量回复速度每0.1秒回复量
|
||||
apw:number=0;
|
||||
uapw:number=0;
|
||||
cpw:number=0;
|
||||
dopw:number=0;
|
||||
dpw:number=0;
|
||||
pwt:Timer = new Timer(1); //计时器
|
||||
|
||||
sk1:number = 9001;
|
||||
sk2:number = 1001;
|
||||
sk3:number = 1001;
|
||||
akr:number=0; //攻击触发机率
|
||||
uar:number=0; //受伤触发机率
|
||||
dgr:number=0; //闪避触发机率
|
||||
@@ -72,9 +78,12 @@ export class HeroViewComp extends CCComp {
|
||||
uac:number=0; //受伤次数触发
|
||||
dgc:number=0; //闪避次数触发
|
||||
crc:number=0; //暴击次数触发
|
||||
aep:number=0;
|
||||
uaep:number=0;
|
||||
dep:number=0;
|
||||
|
||||
aexp:number=0; //攻击经验
|
||||
uaexp:number=0; //受伤经验
|
||||
cexp:number=0; //暴击经验 */
|
||||
doexp:number=0; //闪避经验 */
|
||||
dexp:number=0; //死亡经验 */
|
||||
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_buff: number = 0;
|
||||
@@ -153,28 +162,8 @@ export class HeroViewComp extends CCComp {
|
||||
if(selfCollider.group != otherCollider.group){
|
||||
let skill = otherCollider.node.getComponent(SkillCom)!;
|
||||
// console.log('onPostSolve',skill);
|
||||
|
||||
if(this.hp <= 0 ){
|
||||
return
|
||||
}
|
||||
if(this.shield > 0){
|
||||
this.shield -= 1
|
||||
if(this.shield <= 0){
|
||||
this.shield = 0
|
||||
this.node.getChildByName("shielded").active = false
|
||||
}
|
||||
return
|
||||
}
|
||||
if(this.check_dodge()) return
|
||||
this.in_atked();
|
||||
let l_hp=(skill.ap-this.def)*-1
|
||||
if(skill.is_crit){
|
||||
l_hp = l_hp * (150+skill.crit_add)/100
|
||||
}
|
||||
if(l_hp >= 0){
|
||||
l_hp=-1 //最低1点伤害
|
||||
}
|
||||
this.hp_change(l_hp,skill.is_crit);
|
||||
if(this.hp <= 0 ) return
|
||||
this.check_uatk(skill);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +247,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.is_atking=false
|
||||
}
|
||||
}
|
||||
//进入墓地
|
||||
to_grave(){
|
||||
let pos =v3(-999,this.node.position.y)
|
||||
if(this.box_group == BoxSet.MONSTER){
|
||||
@@ -265,9 +255,11 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
this.node.setPosition(pos)
|
||||
}
|
||||
//是否在墓地
|
||||
in_grave(){
|
||||
return this.node.position.x < -900 || this.node.position.x > 900;
|
||||
}
|
||||
//状态切换
|
||||
status_change(type:string){
|
||||
this.status=type
|
||||
if(type == "idle"){
|
||||
@@ -279,6 +271,7 @@ export class HeroViewComp extends CCComp {
|
||||
// this.as.change_default("move")
|
||||
}
|
||||
}
|
||||
//移动
|
||||
move(dt: number){
|
||||
if(this.stop_cd > 0||smc.vmdata.mission.is_victory||smc.vmdata.mission.is_defeat){
|
||||
this.status_change("idle")
|
||||
@@ -328,6 +321,27 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
return {pos,t_pos}
|
||||
}
|
||||
//受伤判断
|
||||
check_uatk(skill:any){
|
||||
if(this.shield > 0){
|
||||
this.shield -= 1
|
||||
if(this.shield <= 0){
|
||||
this.shield = 0
|
||||
this.node.getChildByName("shielded").active = false
|
||||
}
|
||||
return
|
||||
}
|
||||
if(this.check_dodge()) return
|
||||
this.in_atked();
|
||||
let l_hp=(skill.ap-this.def)*-1
|
||||
if(skill.is_crit){
|
||||
l_hp = l_hp * (150+skill.crit_add)/100
|
||||
}
|
||||
if(l_hp >= 0){
|
||||
l_hp=-1 //最低1点伤害
|
||||
}
|
||||
this.hp_change(l_hp,skill.is_crit);
|
||||
}
|
||||
//能量判断
|
||||
check_power(){
|
||||
if(this.pw >= this.pwm){
|
||||
@@ -348,6 +362,8 @@ export class HeroViewComp extends CCComp {
|
||||
if(i < this.crit){
|
||||
this.tooltip(5,"*会心一击*");
|
||||
this.crit_count += 1
|
||||
this.exp_add(this.cexp) // 暴击经验
|
||||
this.power_add(this.cpw)
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
@@ -359,6 +375,8 @@ export class HeroViewComp extends CCComp {
|
||||
if(i < this.dodge){
|
||||
console.log("闪避触发: i="+i+":dodge="+this.dodge);
|
||||
this.tooltip(5,"闪避");
|
||||
this.exp_add(this.doexp) // 闪避经验
|
||||
this.power_add(this.dopw)
|
||||
this.dodge_count += 1
|
||||
return true
|
||||
}else{
|
||||
@@ -377,7 +395,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
if(this.dodge_count >= this.dgc){
|
||||
@@ -391,7 +409,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
if(this.crit_count >= this.crc){
|
||||
@@ -400,12 +418,13 @@ export class HeroViewComp extends CCComp {
|
||||
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);
|
||||
// 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)
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
if(this.atked_count >= this.uac){
|
||||
@@ -418,7 +437,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,7 +446,8 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.is_atking){
|
||||
this.at = 0;
|
||||
this.atk_count++
|
||||
this.exp_add(this.aep)
|
||||
this.exp_add(this.aexp) //攻击经验
|
||||
this.power_add(this.apw)
|
||||
// console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
@@ -436,24 +456,17 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
exp_add(exp:number){
|
||||
exp_add(exp:number=0){
|
||||
if(this.box_group==BoxSet.HERO){
|
||||
if(this.type == 1)smc.vmdata.mission.a_exp +=exp
|
||||
if(this.type == 2)smc.vmdata.mission.h_exp +=exp
|
||||
if(this.type == 3){
|
||||
smc.vmdata.mission.a_exp +=exp
|
||||
smc.vmdata.mission.h_exp +=exp
|
||||
}
|
||||
smc.vmdata.mission.exp +=exp
|
||||
}
|
||||
if(this.box_group==BoxSet.MONSTER){
|
||||
if(this.type == 1)smc.vmdata.mission.ma_exp +=exp
|
||||
if(this.type == 2)smc.vmdata.mission.mh_exp +=exp
|
||||
if(this.type == 3){
|
||||
smc.vmdata.mission.ma_exp +=exp
|
||||
smc.vmdata.mission.mh_exp +=exp
|
||||
}
|
||||
smc.vmdata.mission.m_exp +=exp
|
||||
}
|
||||
}
|
||||
power_add(p:number){
|
||||
this.pw+= p
|
||||
}
|
||||
//使用max_skill
|
||||
handle_skill(skill:number){
|
||||
this.as.max()
|
||||
@@ -678,7 +691,8 @@ export class HeroViewComp extends CCComp {
|
||||
node.parent = this.node;
|
||||
// this.as.atked();
|
||||
this.atked_count++;
|
||||
this.exp_add(this.uaep)
|
||||
this.exp_add(this.uaexp)
|
||||
this.power_add(this.uapw)
|
||||
}
|
||||
dead(){
|
||||
var path = "game/skills/dead";
|
||||
@@ -687,7 +701,8 @@ export class HeroViewComp extends CCComp {
|
||||
let pos = v3(this.node.position.x,this.node.position.y+30,this.node.position.z);
|
||||
node.parent = this.node.parent;
|
||||
node.setPosition(pos);
|
||||
this.exp_add(this.dep)
|
||||
this.exp_add(this.dexp)
|
||||
this.power_add(this.dpw)
|
||||
}
|
||||
toDestroy(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user