From 5831697fb866e90538810eff26dd427f9544ee31 Mon Sep 17 00:00:00 2001 From: "pan@work" Date: Wed, 25 Sep 2024 17:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/hero/arc1.prefab | 4 +- assets/resources/game/hero/k1.prefab | 7 +- assets/resources/game/hero/k3.prefab | 4 +- assets/resources/game/hero/m1.prefab | 4 +- assets/resources/game/hero/m2.prefab | 4 +- assets/resources/game/hero/m3.prefab | 4 +- assets/resources/game/heros/role.prefab | 5 +- assets/resources/game/skills/patk.prefab | 2 +- assets/script/Main.ts | 4 +- assets/script/game/Role/Role.ts | 11 +- assets/script/game/Role/RoleSpine.ts | 4 +- assets/script/game/Role/RoleViewComp.ts | 108 +++++++++++------- .../script/game/common/SingletonModuleComp.ts | 5 +- assets/script/game/common/config/BoxSet.ts | 2 +- assets/script/game/common/config/SkillSet.ts | 2 +- assets/script/game/common/config/heroSet.ts | 16 +-- assets/script/game/hero/HeroViewComp.ts | 33 ++++-- assets/script/game/map/MapMonsterComp.ts | 9 +- assets/script/game/mon/MonViewComp.ts | 7 +- assets/script/game/skills/Skill.ts | 4 +- assets/script/game/skills/SkillCom.ts | 9 +- 21 files changed, 155 insertions(+), 93 deletions(-) diff --git a/assets/resources/game/hero/arc1.prefab b/assets/resources/game/hero/arc1.prefab index 9272a2df..071d1fbd 100644 --- a/assets/resources/game/hero/arc1.prefab +++ b/assets/resources/game/hero/arc1.prefab @@ -111,7 +111,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 2.157, - "y": 14.216, + "y": 8, "z": 0 }, "_lrot": { @@ -250,7 +250,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": -3.533, - "y": 5.725, + "y": 0, "z": 0 }, "_lrot": { diff --git a/assets/resources/game/hero/k1.prefab b/assets/resources/game/hero/k1.prefab index 22f92419..5d950cb5 100644 --- a/assets/resources/game/hero/k1.prefab +++ b/assets/resources/game/hero/k1.prefab @@ -110,8 +110,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 2.157, - "y": 14.216, + "x": 0, + "y": 8, "z": 0 }, "_lrot": { @@ -250,7 +250,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 5.725, + "y": 0, "z": 0 }, "_lrot": { @@ -1004,6 +1004,7 @@ }, "fileId": "fdklpBwCBM/qJ4WFlQF3kT", "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": [ { "__id__": 40 diff --git a/assets/resources/game/hero/k3.prefab b/assets/resources/game/hero/k3.prefab index 5dbbfd1c..8619231e 100644 --- a/assets/resources/game/hero/k3.prefab +++ b/assets/resources/game/hero/k3.prefab @@ -111,7 +111,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 2.157, - "y": 14.216, + "y": 8, "z": 0 }, "_lrot": { @@ -250,7 +250,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 5.725, + "y": 0, "z": 0 }, "_lrot": { diff --git a/assets/resources/game/hero/m1.prefab b/assets/resources/game/hero/m1.prefab index d3df2113..85d2c608 100644 --- a/assets/resources/game/hero/m1.prefab +++ b/assets/resources/game/hero/m1.prefab @@ -111,7 +111,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 2.157, - "y": 14.216, + "y": 8, "z": 0 }, "_lrot": { @@ -250,7 +250,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 5.725, + "y": 0, "z": 0 }, "_lrot": { diff --git a/assets/resources/game/hero/m2.prefab b/assets/resources/game/hero/m2.prefab index cbebb3d2..139999c7 100644 --- a/assets/resources/game/hero/m2.prefab +++ b/assets/resources/game/hero/m2.prefab @@ -111,7 +111,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 2.157, - "y": 14.216, + "y": 8, "z": 0 }, "_lrot": { @@ -250,7 +250,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 5.725, + "y": 0, "z": 0 }, "_lrot": { diff --git a/assets/resources/game/hero/m3.prefab b/assets/resources/game/hero/m3.prefab index 4a08cdce..2aeb849f 100644 --- a/assets/resources/game/hero/m3.prefab +++ b/assets/resources/game/hero/m3.prefab @@ -111,7 +111,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 2.157, - "y": 14.216, + "y": 8, "z": 0 }, "_lrot": { @@ -250,7 +250,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 5.725, + "y": 0, "z": 0 }, "_lrot": { diff --git a/assets/resources/game/heros/role.prefab b/assets/resources/game/heros/role.prefab index b3612f7d..c553a455 100644 --- a/assets/resources/game/heros/role.prefab +++ b/assets/resources/game/heros/role.prefab @@ -293,8 +293,8 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -2.715, - "y": -7.757, + "x": 0, + "y": 0, "z": 0 }, "_lrot": { @@ -1194,7 +1194,6 @@ }, "fileId": "fdklpBwCBM/qJ4WFlQF3kT", "instance": null, - "targetOverrides": null, "nestedPrefabInstanceRoots": [ { "__id__": 54 diff --git a/assets/resources/game/skills/patk.prefab b/assets/resources/game/skills/patk.prefab index e7ba8bee..b16738d1 100644 --- a/assets/resources/game/skills/patk.prefab +++ b/assets/resources/game/skills/patk.prefab @@ -325,7 +325,7 @@ "_size": { "__type__": "cc.Size", "width": 20, - "height": 60 + "height": 160 }, "_id": "" }, diff --git a/assets/script/Main.ts b/assets/script/Main.ts index 20a65ae0..699d810a 100644 --- a/assets/script/Main.ts +++ b/assets/script/Main.ts @@ -19,8 +19,8 @@ const { ccclass, property } = _decorator; @ccclass('Main') export class Main extends Root { start() { - // if (DEBUG) profiler.showStats(); - // PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb + if (DEBUG) profiler.showStats(); + PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb // // | EPhysics2DDrawFlags.Pair // |EPhysics2DDrawFlags.CenterOfMass // |EPhysics2DDrawFlags.Joint diff --git a/assets/script/game/Role/Role.ts b/assets/script/game/Role/Role.ts index 848e393c..8b1cc088 100644 --- a/assets/script/game/Role/Role.ts +++ b/assets/script/game/Role/Role.ts @@ -53,6 +53,7 @@ export class Role extends ecs.Entity { let role=smc.vm_data.role; rv.hero_uuid=uuid; rv.speed =rv.ospeed = role.speed; + rv.atk_dis = role.atk_dis; rv.hero_name= "role"; rv.hp= rv.hp_max = role.hp*(1+smc.vm_data.talent[1].bonus*smc.vm_data.talent[1].lv); rv.level = role.lv; @@ -62,15 +63,15 @@ export class Role extends ecs.Entity { rv.s_boncus=1+smc.vm_data.talent[16].bonus*smc.vm_data.talent[16].lv; rv.power = role.power; rv.skill1 = role.skill1; - rv.skill1.cd=rv.skill1.cd_max=1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv + rv.skill1.cd=rv.skill1.cd_max=rv.skill1.cd_max*(1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv) rv.skill2 = role.skill2; - rv.skill2.cd=rv.skill2.cd_max=1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv + rv.skill2.cd=rv.skill2.cd_max=rv.skill1.cd_max*(1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv) rv.skill3 = role.skill3; - rv.skill3.cd=rv.skill3.cd_max=1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv + rv.skill3.cd=rv.skill3.cd_max=rv.skill1.cd_max*(1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv) rv.skill4 = role.skill4; - rv.skill4.cd=rv.skill4.cd_max=1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv + rv.skill4.cd=rv.skill4.cd_max=rv.skill1.cd_max*(1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv) rv.skill5 = role.skill5; - rv.skill5.cd=rv.skill5.cd_max=1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv + rv.skill5.cd=rv.skill5.cd_max=rv.skill1.cd_max*(1-smc.vm_data.talent[4].bonus*smc.vm_data.talent[4].lv) rv.skill = role.skill; rv.box_group = BoxSet.HERO; this.add(rv); diff --git a/assets/script/game/Role/RoleSpine.ts b/assets/script/game/Role/RoleSpine.ts index a2a477d0..5a45273b 100644 --- a/assets/script/game/Role/RoleSpine.ts +++ b/assets/script/game/Role/RoleSpine.ts @@ -22,7 +22,7 @@ export class RoleSpine extends Component { private atk_name: string = "atk"; private move_name: string = "move"; private max_name: string = "max"; - private idel_name: string = "idle"; + private idel_name: string = "move"; start() { this.spine.setAnimation(0, this.default, true); } @@ -45,9 +45,11 @@ export class RoleSpine extends Component { this.spine.setAnimation(0, this.atk_name, false); } idle(){ + this.default = this.idel_name; this.spine.setAnimation(0, this.idel_name, true); } move(){ + this.default = this.move_name; this.spine.setAnimation(0, this.move_name, true); } max(){ diff --git a/assets/script/game/Role/RoleViewComp.ts b/assets/script/game/Role/RoleViewComp.ts index 5291a671..bebecbf8 100644 --- a/assets/script/game/Role/RoleViewComp.ts +++ b/assets/script/game/Role/RoleViewComp.ts @@ -91,6 +91,7 @@ export class RoleViewComp extends CCComp { is_dead:boolean = false; //是否摧毁 is_stop:boolean = false; is_atking:boolean = false; + is_moving:boolean = false; type:number = 0; onLoad() { // this.BoxRang = this.node.getChildByName("range_box"); @@ -131,14 +132,17 @@ export class RoleViewComp extends CCComp { onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) { } onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) { if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){ - - if(selfCollider.node.position.y < otherCollider.node.position.y){ - if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){ - - selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1) + // console.log(selfCollider.node.position.y+":role:hero:"+otherCollider.node.position.y); + if(selfCollider.node.position.y <= otherCollider.node.position.y){ + if(selfCollider.node.getSiblingIndex() <= otherCollider.node.getSiblingIndex()){ + selfCollider.node.setSiblingIndex(200) + // selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1) // console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex()); + }else{ - selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()-1) + selfCollider.node.setSiblingIndex(-1) + // console.log("onPreSolve f:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex()); + } } @@ -180,17 +184,41 @@ export class RoleViewComp extends CCComp { this.atk_time += dt; this.in_atk(); this.skill_cds(dt); - // this.move(); + this.move(dt); this.check_enemys() } skill_cds(dt:number){ - this.skill1.cd -= dt; + if(this.skill1.alive) this.skill1.cd -= dt; + if(this.skill2.alive) this.skill2.cd -= dt; + if(this.skill3.alive) this.skill3.cd -= dt; + if(this.skill4.alive) this.skill4.cd -= dt; + if(this.skill5.alive) this.skill5.cd -= dt; + if(this.skill1.cd <= 0){ this.shoot(this.skill1.uuid); this.skill1.cd=this.skill1.cd_max console.log("shoot uuid :"+this.skill1.uuid); - } - + } + if(this.skill2.cd <= 0){ + this.shoot(this.skill2.uuid); + this.skill2.cd=this.skill2.cd_max + console.log("shoot uuid :"+this.skill2.uuid); + } + if(this.skill3.cd <= 0){ + this.shoot(this.skill3.uuid); + this.skill3.cd=this.skill3.cd_max + console.log("shoot uuid :"+this.skill3.uuid); + } + if(this.skill4.cd <= 0){ + this.shoot(this.skill4.uuid); + this.skill4.cd=this.skill4.cd_max + console.log("shoot uuid :"+this.skill4.uuid); + } + if(this.skill5.cd <= 0){ + this.shoot(this.skill5.uuid); + this.skill5.cd=this.skill5.cd_max + console.log("shoot uuid :"+this.skill5.uuid); + } // this.skills.forEach((e:any) => { // if(e.cd > 0&&e.alive){ // e.cd -= dt; @@ -222,41 +250,29 @@ export class RoleViewComp extends CCComp { this.enemy = v3(720,this.node.position.y); } } - move(){ + move(dt:number){ if(this.stop_cd > 0){ + this.as.idle() + this.is_moving=false return } - if(this.enemy){ - this.move_to(this.enemy.position) + this.move_to() + let move_x=1 + let move_y=1 + if(Math.abs(this.enemy.x - this.node.position.x) < this.atk_dis) move_x = 0 + if(Math.abs(this.enemy.y - this.node.position.y) < this.atk_dis) move_y = 0 + if(this.enemy.x < this.node.position.x){ + this.scale = -1 }else{ - this.move_to(v3(0,0)); + this.scale = 1 } + this.node.setScale(this.scale,1); + this.node.setPosition(this.node.position.x+dt*this.speed*this.scale*move_x, this.node.position.y+dt*this.speed*move_y, this.node.position.z); } - move_to(enemy:Vec3){ - // console.log("move to ",enemy); - var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp); - move.target = v3(enemy.x-100,enemy.y); - move.node = this.node; - move.speed = this.ospeed; - if(enemy.x < this.node.position.x){ - this.node.setScale(-1,1); - }else{ - this.node.setScale(1,1); - } - } - shoot(skill_uuid:number,y:number=0,x:number=0){ - // console.log("mon shoot"); - let skill = ecs.getEntity(Skill); - let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk+this.mission_atk; - let {pos,t_pos}=this.get_enemy_pos() - pos.y=pos.y + y - pos.x=pos.x + x - if(smc.skills[skill_uuid].type==11){ - pos.y=300 - t_pos.y=t_pos.y-300 - } - skill.load(pos,this.box_group,this.node,skill_uuid,atk,t_pos); - // this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid); + move_to(){ + if(this.is_moving) return + this.is_moving=true + this.as.move() } //使用max_skill @@ -298,6 +314,20 @@ export class RoleViewComp extends CCComp { } } + shoot(skill_uuid:number,y:number=0,x:number=0){ + // console.log("mon shoot"); + let skill = ecs.getEntity(Skill); + let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk+this.mission_atk; + let {pos,t_pos}=this.get_enemy_pos() + pos.y=pos.y + y + pos.x=pos.x + x + if(smc.skills[skill_uuid].type==11){ + pos.y=300 + t_pos.y=t_pos.y-300 + } + skill.load(pos,this.box_group,this.node,skill_uuid,atk,t_pos,this.atk_dis); + // this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid); + } hp_change(hp: number){ if(this.is_dead){ return; diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index c1f6e306..d9b6f072 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -114,8 +114,9 @@ export class SingletonModuleComp extends ecs.Comp { role:{ hp:3000, hp_max:3000, - speed:0, + speed:60, atk:10, + atk_dis:100, buff_atk:0, mission_atk:0, atk_cd:1, @@ -126,7 +127,7 @@ export class SingletonModuleComp extends ecs.Comp { exp:0, next_exp:100, power:300, - skill:1004, + skill:9001, skill1:{uuid:1001,cd:3,cd_max:3,alive:true }, skill2:{uuid:1001,cd:3,cd_max:3,alive:false}, skill3:{uuid:1001,cd:3,cd_max:3,alive:false}, diff --git a/assets/script/game/common/config/BoxSet.ts b/assets/script/game/common/config/BoxSet.ts index a930eeaa..cc35b3e4 100644 --- a/assets/script/game/common/config/BoxSet.ts +++ b/assets/script/game/common/config/BoxSet.ts @@ -45,7 +45,7 @@ export enum GameSet { ATK_TO_HP_RATIO=0.2, ATK_TO_SHIELD_RATIO=2, - ATK_LINES = 3, + ATK_LINES = 6, MON_GOLD_ADD =2, MON_COIN_ADD=2, COIN_ADD=1, diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index ed4a651a..92f2a0df 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -52,7 +52,7 @@ export const SkillSet={ dis:1,count:5,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人", - dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, + dis:1,count:1,in:0,run:3,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, 9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人", dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, 9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人", diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 06e88c4a..f527ae36 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -1,12 +1,12 @@ export const HeroSet = { 9001: { - uuid: 9001, path: "k3", type: 1, level: 1,cost:2, name: "骑士", atk: 10, hp: 100, atk_dis: 40, atk_cd: 1, power: 0, power_max: 20, speed: 40, + uuid: 9001, path: "k3", type: 1, level: 1,cost:2, name: "骑士", atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 20, speed: 40, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 2002, word: "守护", info: "自身护盾", atktype: 1, }, 9002: { - uuid: 9002, path: "k1", type: 1, level: 1,cost:2, name: "战士", atk: 20, hp: 50, atk_dis: 40, atk_cd: 1, power: 0, power_max: 20, speed: 40, + uuid: 9002, path: "k1", type: 1, level: 1,cost:2, name: "战士", atk: 20, hp: 50, atk_dis: 100, atk_cd: 1, power: 0, power_max: 20, speed: 40, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 2003, word: "守护", info: "自身护盾", atktype: 1, }, 9011: { @@ -34,28 +34,28 @@ export const HeroSet = { export const MonSet = { 1011: { - uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 10, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 20, speed: 30, + uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 10, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 }, 1012: { - uuid: 1012, path: "orc2", type: 1, level: 1,cost:2, name: "荒野兽人", atk: 15, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 20, speed: 30, + uuid: 1012, path: "orc2", type: 1, level: 1,cost:2, name: "荒野兽人", atk: 15, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 }, 1013: { - uuid: 1013, path: "orc3", type: 1, level: 1,cost:2, name: "兽人战士", atk: 20, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 20, speed: 30, + uuid: 1013, path: "orc3", type: 1, level: 1,cost:2, name: "兽人战士", atk: 20, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 }, 1031: { - uuid: 1031, path: "du1", type: 1, level: 1,cost:2, name: "独眼巨人", atk: 10, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30, + uuid: 1031, path: "du1", type: 1, level: 1,cost:2, name: "独眼巨人", atk: 10, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 }, 1032: { - uuid: 1032, path: "du2", type: 1, level: 1,cost:2, name: "狂暴独眼", atk: 15, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30, + uuid: 1032, path: "du2", type: 1, level: 1,cost:2, name: "狂暴独眼", atk: 15, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 }, 1033: { - uuid: 1033, path: "du3", type: 1, level: 1,cost:2, name: "独眼首领", atk: 20, hp: 100, atk_dis: 40, atk_cd: 2, power: 0, power_max: 10, speed: 30, + uuid: 1033, path: "du3", type: 1, level: 1,cost:2, name: "独眼首领", atk: 20, hp: 100, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1 }, diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index d956d4c4..dfca77f3 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -277,10 +277,10 @@ export class HeroViewComp extends CCComp { get_hero_pos(hero:any){ let pos =this.skill_pos() let t_pos:Vec3 = v3(720,0) - if(!hero.HeroView.node.isValid){ + if(!hero.node.isValid){ return }else{ - t_pos = v3(hero.HeroView.node.position.x-this.node.position.x,hero.HeroView.node.position.y-(this.node.position.y+pos.y)) + t_pos = v3(hero.node.position.x-this.node.position.x,hero.node.position.y-(this.node.position.y+pos.y)) } return {pos,t_pos} @@ -304,32 +304,40 @@ export class HeroViewComp extends CCComp { skill.load(pos,BoxSet.HERO,this.node,this.max_skill_uuid,atk,t_pos); if(smc.skills[s_uuid].hp > 0){ //buff加血 let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) - hero.HeroView.add_hp(increase_hp) + hero.add_hp(increase_hp) } if(smc.skills[s_uuid].atk > 0){ //buff加攻击 let increase_atk=Math.floor(smc.skills[s_uuid].atk*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) - hero.HeroView.add_atk(increase_atk,smc.skills[s_uuid].bsd*this.st_boncus) + hero.add_atk(increase_atk,smc.skills[s_uuid].bsd*this.st_boncus) } if(smc.skills[s_uuid].shield > 0){ //buff护盾 let increase_shield=Math.floor(smc.skills[s_uuid].shield*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) - hero.HeroView.add_shield(increase_shield,smc.skills[s_uuid].bsd*this.st_boncus) + hero.add_shield(increase_shield,smc.skills[s_uuid].bsd*this.st_boncus) } } + push_least_buff(skill:number){ let heros:any = ecs.query(ecs.allOf(HeroModelComp)); let least_hp:number=0 let t_hero:any= null if (heros.length > 0) { if(smc.skills[skill].type==92){ //随机添加buff + let i = RandomManager.instance.getRandomInt(0,heros.length-1,3) - this.to_add_buff(heros[i],skill) + while(!heros[i].HeroView){ + i = RandomManager.instance.getRandomInt(0,heros.length-1,3) + if(heros[i].HeroView){ + break + } + } + this.to_add_buff(heros[i].HeroView,skill) }else{ for (let i = 0; i < heros.length; i++) { - let hero = heros[i]; - if(!hero.HeroView) continue + if(!heros[i].HeroView) continue + let hero = heros[i].HeroView; if(smc.skills[skill].type==91){ //血量最少单体 - if((hero.HeroView.hp_max-hero.HeroView.hp) > least_hp){ - least_hp = (hero.HeroView.hp_max-hero.HeroView.hp) + if((hero.hp_max-hero.hp) > least_hp){ + least_hp = (hero.hp_max-hero.hp) t_hero = hero } }else{ //群体 @@ -338,6 +346,11 @@ export class HeroViewComp extends CCComp { } if(t_hero){ //血量最少单体 + let role_hp=smc.Role.RoleView.hp_max-smc.Role.RoleView.hp + if(role_hp > least_hp){ + least_hp = role_hp + t_hero = smc.Role.RoleView + } this.to_add_buff(t_hero,skill) } diff --git a/assets/script/game/map/MapMonsterComp.ts b/assets/script/game/map/MapMonsterComp.ts index 98eb908b..ca61e9c3 100644 --- a/assets/script/game/map/MapMonsterComp.ts +++ b/assets/script/game/map/MapMonsterComp.ts @@ -186,6 +186,11 @@ export class MapMonsterComp extends CCComp { smc.hero_pos[1].x=-320 smc.hero_pos[2].x=-320 for(let i=0;i smc.hero_pos[0].x&&ho.y == smc.hero_pos[0].y){ @@ -201,11 +206,11 @@ export class MapMonsterComp extends CCComp { continue } } - + // console.log("count_hero_pos",smc.hero_pos); } load_role(){ let role = ecs.getEntity(Role); - let pos = v3(BoxSet.HERO_START+50,BoxSet.GAME_LINE) + let pos = v3(BoxSet.HERO_START+50,BoxSet.GAME_LINE-5) role.load(pos,109) smc.Role=role // console.log("加载玩家",role) diff --git a/assets/script/game/mon/MonViewComp.ts b/assets/script/game/mon/MonViewComp.ts index a5055c7e..9a2ba2ee 100644 --- a/assets/script/game/mon/MonViewComp.ts +++ b/assets/script/game/mon/MonViewComp.ts @@ -180,12 +180,13 @@ export class MonViewComp extends CCComp { let dir = 320 this.enemy = v3(720,this.node.position.y) for (let i = 0; i < GameSet.ATK_LINES; i++) { - let ho:any = smc.hero_pos[i]; let x=Math.abs(ho.x-this.node.position.x) + // console.log("check_enemy_alive,x:"+ho.x+"-"+this.node.position.x+"="+x); let y = Math.abs(ho.y-this.node.position.y) let squaredDistance =x*x+y*y let distance = Math.sqrt(squaredDistance); + // console.log("check_enemy_alive,z:"+x+":"+y+":"+this.atk_dis+":"+distance); if(distance < dir){ dir = distance this.enemy = ho @@ -193,10 +194,12 @@ export class MonViewComp extends CCComp { } if(dir < this.atk_dis){ + if(dir < this.atk_cd-60) this.stop_cd = 0.1 this.is_atking=true }else{ this.is_atking=false } + // console.log("check_enemy_alive", this.enemy); } hp_show(){ if(this.hp == this.hp_max){ @@ -285,7 +288,7 @@ export class MonViewComp extends CCComp { this.atk_time = 0; this.as.atk(); this.scheduleOnce(()=>{ - console.log("mon skill_cd:"+this.skill_uuid); + // console.log("mon skill_cd:"+this.skill_uuid); this.shoot(this.skill_uuid); },0.4) } diff --git a/assets/script/game/skills/Skill.ts b/assets/script/game/skills/Skill.ts index e27f6976..29119723 100644 --- a/assets/script/game/skills/Skill.ts +++ b/assets/script/game/skills/Skill.ts @@ -30,7 +30,7 @@ export class Skill extends ecs.Entity { super.destroy(); } load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node, - uuid:number=1001,atk:number =10,t_pos:Vec3 = null) + uuid:number=1001,atk:number =10,t_pos:Vec3 = null,dis:number=0,) { var path = "game/skills/"+smc.skills[uuid].sp_name; @@ -60,7 +60,7 @@ export class Skill extends ecs.Entity { node.setScale(v3(node.scale.x*scale,node.scale.y)) sv.speed=smc.skills[uuid].speed; - sv.dis=smc.skills[uuid].dis; + sv.dis=smc.skills[uuid].dis+dis; sv.run_type=smc.skills[uuid].run; if(sv.dis == 0){ sv.run_type=2 diff --git a/assets/script/game/skills/SkillCom.ts b/assets/script/game/skills/SkillCom.ts index c659e003..6333a11b 100644 --- a/assets/script/game/skills/SkillCom.ts +++ b/assets/script/game/skills/SkillCom.ts @@ -55,7 +55,14 @@ export class SkillCom extends CCComp { collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this); } - + if(this.run_type == 3){ //直线,默认直线,有特定目标 朝向目标直线 + let tx=this.node.position.x+this.dis + // console.log("skill tx:"+tx+" node :"+this.node.position.x) + let e_pos=v3(tx,this.node.position.y) + tween(this.node).to( 0.2,{ position: e_pos}, + {onComplete: (target?: object) => { this.is_destroy=true },} + ).start(); + } if(this.run_type == 0){ //直线,默认直线,有特定目标 朝向目标直线 let time = 720 / this.speed;