hero 界面调整 局内英雄不再升级,改为升级局内技能
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
export const HeroInfo = {
|
||||
9001: {
|
||||
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: 100,vun:0,crit:20,crit_add:0,dodge:0,
|
||||
sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,skr:[0,10,20,30,40,50],uar:[0,10,20,30,40,50],dr:[0,10,20,30,40,50],
|
||||
aep:1,uaep:1,dep:10,edep:1,
|
||||
ap: 20, ap_rate:0.1, hp: 100, hp_rate:0.1, def:10,def_rate:0.1,dis: 100, a_cd: 1, pw: 0, pwm: 15,pws: 1, speed: 100,vun:0,crit:20,crit_add:0,dodge:0,
|
||||
sk1: 9001, sk2: 2002, sk3: 9003, sk4: 9004, sk5: 9005, sk6: 9006, atktype: 1,akr:10,uar:10,dgr:10,crr:10,akc:1,uac:1,dgc:1,crc:1,
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,7 @@ export class HCardComp extends CCComp {
|
||||
ap:any=[]
|
||||
hp:any=[]
|
||||
life:any=[]
|
||||
pw:any=[]
|
||||
protected onLoad(): void {
|
||||
|
||||
|
||||
@@ -26,10 +27,11 @@ export class HCardComp extends CCComp {
|
||||
start() {
|
||||
this.heros= ecs.query(ecs.allOf(HeroModelComp));
|
||||
this.hc_name=this.node.getChildByName("name").getComponent(Label)!
|
||||
this.icon=this.node.getChildByName("icon").getComponent(Sprite)!
|
||||
// this.icon=this.node.getChildByName("icon").getComponent(Sprite)!
|
||||
this.hp=this.node.getChildByName("hp").getChildByName("num").getComponent(Label)!
|
||||
this.ap=this.node.getChildByName("ap").getChildByName("num").getComponent(Label)!
|
||||
this.life=this.node.getChildByName("life").getComponent(ProgressBar)!
|
||||
this.life=this.node.getChildByName("life").getComponent(ProgressBar)!
|
||||
this.pw=this.node.getChildByName("pow").getComponent(ProgressBar)!
|
||||
this.hc_name.string= this.heros[this.hi].HeroView.hero_name
|
||||
console.log("hcard start")
|
||||
}
|
||||
@@ -37,6 +39,7 @@ export class HCardComp extends CCComp {
|
||||
this.hp.string=this.heros[this.hi].HeroView.hp_max
|
||||
this.ap.string=this.heros[this.hi].HeroView.ap
|
||||
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
|
||||
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
|
||||
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -58,18 +58,10 @@ export class MissionComp extends CCComp {
|
||||
mon_index:number = 0
|
||||
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("other_add_monster", this.on_other_add_monster, this);
|
||||
oops.message.on("do_add_hero", this.on_do_add_hero, this);
|
||||
oops.message.on("mission_start", this.mission_start, this);
|
||||
oops.message.on("mission_end", this.mission_end, this);
|
||||
oops.message.on("mon_dead", this.on_mon_dead, this);
|
||||
|
||||
|
||||
|
||||
}
|
||||
start() {
|
||||
|
||||
this.hcard_call()
|
||||
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
@@ -174,18 +166,6 @@ export class MissionComp extends CCComp {
|
||||
oops.message.dispatchEvent("do_reward");
|
||||
}
|
||||
|
||||
private on_other_add_monster(event: string, args: any) {
|
||||
var scene = smc.map.MapView.scene;
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
this.addMonster(args.uuid)
|
||||
}
|
||||
check_mon_count(){
|
||||
let count = 0;
|
||||
let list = ecs.query(ecs.allOf(MonModelComp));
|
||||
count = list.length
|
||||
return count;
|
||||
}
|
||||
count_mon_pos(){
|
||||
let monsters:any= ecs.query(ecs.allOf(MonModelComp));
|
||||
for(let i=0;i<monsters.length;i++){
|
||||
@@ -203,9 +183,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
private on_do_add_hero(event: string, args: any) {
|
||||
this.addHero(args.uuid)
|
||||
}
|
||||
|
||||
heros_call(){
|
||||
let hero:any =RandomManager.instance.getRandomByObjectList(smc.cards, 1);
|
||||
this.addHero(hero[0].uuid)
|
||||
|
||||
Reference in New Issue
Block a user