This commit is contained in:
2024-09-25 17:23:56 +08:00
parent 3870bdec50
commit 5831697fb8
21 changed files with 155 additions and 93 deletions

View File

@@ -111,7 +111,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 2.157, "x": 2.157,
"y": 14.216, "y": 8,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -250,7 +250,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -3.533, "x": -3.533,
"y": 5.725, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {

View File

@@ -110,8 +110,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 2.157, "x": 0,
"y": 14.216, "y": 8,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -250,7 +250,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 5.725, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1004,6 +1004,7 @@
}, },
"fileId": "fdklpBwCBM/qJ4WFlQF3kT", "fileId": "fdklpBwCBM/qJ4WFlQF3kT",
"instance": null, "instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 40 "__id__": 40

View File

@@ -111,7 +111,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 2.157, "x": 2.157,
"y": 14.216, "y": 8,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -250,7 +250,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 5.725, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {

View File

@@ -111,7 +111,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 2.157, "x": 2.157,
"y": 14.216, "y": 8,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -250,7 +250,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 5.725, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {

View File

@@ -111,7 +111,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 2.157, "x": 2.157,
"y": 14.216, "y": 8,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -250,7 +250,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 5.725, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {

View File

@@ -111,7 +111,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 2.157, "x": 2.157,
"y": 14.216, "y": 8,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -250,7 +250,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 5.725, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {

View File

@@ -293,8 +293,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -2.715, "x": 0,
"y": -7.757, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1194,7 +1194,6 @@
}, },
"fileId": "fdklpBwCBM/qJ4WFlQF3kT", "fileId": "fdklpBwCBM/qJ4WFlQF3kT",
"instance": null, "instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 54 "__id__": 54

View File

@@ -325,7 +325,7 @@
"_size": { "_size": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 20, "width": 20,
"height": 60 "height": 160
}, },
"_id": "" "_id": ""
}, },

View File

@@ -19,8 +19,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

View File

@@ -53,6 +53,7 @@ export class Role extends ecs.Entity {
let role=smc.vm_data.role; let role=smc.vm_data.role;
rv.hero_uuid=uuid; rv.hero_uuid=uuid;
rv.speed =rv.ospeed = role.speed; rv.speed =rv.ospeed = role.speed;
rv.atk_dis = role.atk_dis;
rv.hero_name= "role"; 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.hp= rv.hp_max = role.hp*(1+smc.vm_data.talent[1].bonus*smc.vm_data.talent[1].lv);
rv.level = role.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.s_boncus=1+smc.vm_data.talent[16].bonus*smc.vm_data.talent[16].lv;
rv.power = role.power; rv.power = role.power;
rv.skill1 = role.skill1; 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 = 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 = 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 = 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 = 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.skill = role.skill;
rv.box_group = BoxSet.HERO; rv.box_group = BoxSet.HERO;
this.add(rv); this.add(rv);

View File

@@ -22,7 +22,7 @@ export class RoleSpine extends Component {
private atk_name: string = "atk"; private atk_name: string = "atk";
private move_name: string = "move"; private move_name: string = "move";
private max_name: string = "max"; private max_name: string = "max";
private idel_name: string = "idle"; private idel_name: string = "move";
start() { start() {
this.spine.setAnimation(0, this.default, true); this.spine.setAnimation(0, this.default, true);
} }
@@ -45,9 +45,11 @@ export class RoleSpine extends Component {
this.spine.setAnimation(0, this.atk_name, false); this.spine.setAnimation(0, this.atk_name, false);
} }
idle(){ idle(){
this.default = this.idel_name;
this.spine.setAnimation(0, this.idel_name, true); this.spine.setAnimation(0, this.idel_name, true);
} }
move(){ move(){
this.default = this.move_name;
this.spine.setAnimation(0, this.move_name, true); this.spine.setAnimation(0, this.move_name, true);
} }
max(){ max(){

View File

@@ -91,6 +91,7 @@ export class RoleViewComp extends CCComp {
is_dead:boolean = false; //是否摧毁 is_dead:boolean = false; //是否摧毁
is_stop:boolean = false; is_stop:boolean = false;
is_atking:boolean = false; is_atking:boolean = false;
is_moving:boolean = false;
type:number = 0; type:number = 0;
onLoad() { onLoad() {
// this.BoxRang = this.node.getChildByName("range_box"); // this.BoxRang = this.node.getChildByName("range_box");
@@ -131,14 +132,17 @@ export class RoleViewComp extends CCComp {
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) { } onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) { }
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) { onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){ if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
// console.log(selfCollider.node.position.y+":role:hero:"+otherCollider.node.position.y);
if(selfCollider.node.position.y < otherCollider.node.position.y){ if(selfCollider.node.position.y <= otherCollider.node.position.y){
if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){ if(selfCollider.node.getSiblingIndex() <= otherCollider.node.getSiblingIndex()){
selfCollider.node.setSiblingIndex(200)
selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1) // selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1)
// console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex()); // console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex());
}else{ }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.atk_time += dt;
this.in_atk(); this.in_atk();
this.skill_cds(dt); this.skill_cds(dt);
// this.move(); this.move(dt);
this.check_enemys() this.check_enemys()
} }
skill_cds(dt:number){ 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){ if(this.skill1.cd <= 0){
this.shoot(this.skill1.uuid); this.shoot(this.skill1.uuid);
this.skill1.cd=this.skill1.cd_max this.skill1.cd=this.skill1.cd_max
console.log("shoot uuid :"+this.skill1.uuid); 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) => { // this.skills.forEach((e:any) => {
// if(e.cd > 0&&e.alive){ // if(e.cd > 0&&e.alive){
// e.cd -= dt; // e.cd -= dt;
@@ -222,41 +250,29 @@ export class RoleViewComp extends CCComp {
this.enemy = v3(720,this.node.position.y); this.enemy = v3(720,this.node.position.y);
} }
} }
move(){ move(dt:number){
if(this.stop_cd > 0){ if(this.stop_cd > 0){
this.as.idle()
this.is_moving=false
return return
} }
if(this.enemy){ this.move_to()
this.move_to(this.enemy.position) 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{ }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){ move_to(){
// console.log("move to ",enemy); if(this.is_moving) return
var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp); this.is_moving=true
move.target = v3(enemy.x-100,enemy.y); this.as.move()
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>(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);
} }
//使用max_skill //使用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>(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){ hp_change(hp: number){
if(this.is_dead){ if(this.is_dead){
return; return;

View File

@@ -114,8 +114,9 @@ export class SingletonModuleComp extends ecs.Comp {
role:{ role:{
hp:3000, hp:3000,
hp_max:3000, hp_max:3000,
speed:0, speed:60,
atk:10, atk:10,
atk_dis:100,
buff_atk:0, buff_atk:0,
mission_atk:0, mission_atk:0,
atk_cd:1, atk_cd:1,
@@ -126,7 +127,7 @@ export class SingletonModuleComp extends ecs.Comp {
exp:0, exp:0,
next_exp:100, next_exp:100,
power:300, power:300,
skill:1004, skill:9001,
skill1:{uuid:1001,cd:3,cd_max:3,alive:true }, skill1:{uuid:1001,cd:3,cd_max:3,alive:true },
skill2:{uuid:1001,cd:3,cd_max:3,alive:false}, skill2:{uuid:1001,cd:3,cd_max:3,alive:false},
skill3:{uuid:1001,cd:3,cd_max:3,alive:false}, skill3:{uuid:1001,cd:3,cd_max:3,alive:false},

View File

@@ -45,7 +45,7 @@ export enum GameSet {
ATK_TO_HP_RATIO=0.2, ATK_TO_HP_RATIO=0.2,
ATK_TO_SHIELD_RATIO=2, ATK_TO_SHIELD_RATIO=2,
ATK_LINES = 3, ATK_LINES = 6,
MON_GOLD_ADD =2, MON_GOLD_ADD =2,
MON_COIN_ADD=2, MON_COIN_ADD=2,
COIN_ADD=1, COIN_ADD=1,

View File

@@ -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, }, 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:"释放一个魔法球攻击敌人", 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:"释放一个魔法球攻击敌人", 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,}, 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:"释放一个魔法球攻击敌人", 9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人",

View File

@@ -1,12 +1,12 @@
export const HeroSet = { export const HeroSet = {
9001: { 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, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 2002, word: "守护", info: "自身护盾", atktype: 1,
}, },
9002: { 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, max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 2003, word: "守护", info: "自身护盾", atktype: 1,
}, },
9011: { 9011: {
@@ -34,28 +34,28 @@ export const HeroSet = {
export const MonSet = { export const MonSet = {
1011: { 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 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1012: { 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 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1013: { 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 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1031: { 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 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1032: { 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 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },
1033: { 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 max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, word: "守护", info: "自身护盾", atktype: 1
}, },

View File

@@ -277,10 +277,10 @@ export class HeroViewComp extends CCComp {
get_hero_pos(hero:any){ get_hero_pos(hero:any){
let pos =this.skill_pos() let pos =this.skill_pos()
let t_pos:Vec3 = v3(720,0) let t_pos:Vec3 = v3(720,0)
if(!hero.HeroView.node.isValid){ if(!hero.node.isValid){
return return
}else{ }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} 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); skill.load(pos,BoxSet.HERO,this.node,this.max_skill_uuid,atk,t_pos);
if(smc.skills[s_uuid].hp > 0){ //buff加血 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) 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加攻击 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) 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护盾 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) 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){ push_least_buff(skill:number){
let heros:any = ecs.query(ecs.allOf(HeroModelComp)); let heros:any = ecs.query(ecs.allOf(HeroModelComp));
let least_hp:number=0 let least_hp:number=0
let t_hero:any= null let t_hero:any= null
if (heros.length > 0) { if (heros.length > 0) {
if(smc.skills[skill].type==92){ //随机添加buff if(smc.skills[skill].type==92){ //随机添加buff
let i = RandomManager.instance.getRandomInt(0,heros.length-1,3) 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{ }else{
for (let i = 0; i < heros.length; i++) { for (let i = 0; i < heros.length; i++) {
let hero = heros[i]; if(!heros[i].HeroView) continue
if(!hero.HeroView) continue let hero = heros[i].HeroView;
if(smc.skills[skill].type==91){ //血量最少单体 if(smc.skills[skill].type==91){ //血量最少单体
if((hero.HeroView.hp_max-hero.HeroView.hp) > least_hp){ if((hero.hp_max-hero.hp) > least_hp){
least_hp = (hero.HeroView.hp_max-hero.HeroView.hp) least_hp = (hero.hp_max-hero.hp)
t_hero = hero t_hero = hero
} }
}else{ //群体 }else{ //群体
@@ -338,6 +346,11 @@ export class HeroViewComp extends CCComp {
} }
if(t_hero){ //血量最少单体 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) this.to_add_buff(t_hero,skill)
} }

View File

@@ -186,6 +186,11 @@ export class MapMonsterComp extends CCComp {
smc.hero_pos[1].x=-320 smc.hero_pos[1].x=-320
smc.hero_pos[2].x=-320 smc.hero_pos[2].x=-320
for(let i=0;i<heros.length;i++){ for(let i=0;i<heros.length;i++){
if(heros[i].RoleView != undefined){
smc.hero_pos[5].x = heros[i].RoleView.node.position.x
smc.hero_pos[5].y = heros[i].RoleView.node.position.y
continue
}
if(heros[i].HeroView == undefined) return if(heros[i].HeroView == undefined) return
let ho:any = heros[i].HeroView.node.position let ho:any = heros[i].HeroView.node.position
if(ho.x > smc.hero_pos[0].x&&ho.y == smc.hero_pos[0].y){ if(ho.x > smc.hero_pos[0].x&&ho.y == smc.hero_pos[0].y){
@@ -201,11 +206,11 @@ export class MapMonsterComp extends CCComp {
continue continue
} }
} }
// console.log("count_hero_pos",smc.hero_pos);
} }
load_role(){ load_role(){
let role = ecs.getEntity<Role>(Role); let role = ecs.getEntity<Role>(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) role.load(pos,109)
smc.Role=role smc.Role=role
// console.log("加载玩家",role) // console.log("加载玩家",role)

View File

@@ -180,12 +180,13 @@ export class MonViewComp extends CCComp {
let dir = 320 let dir = 320
this.enemy = v3(720,this.node.position.y) this.enemy = v3(720,this.node.position.y)
for (let i = 0; i < GameSet.ATK_LINES; i++) { for (let i = 0; i < GameSet.ATK_LINES; i++) {
let ho:any = smc.hero_pos[i]; let ho:any = smc.hero_pos[i];
let x=Math.abs(ho.x-this.node.position.x) 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 y = Math.abs(ho.y-this.node.position.y)
let squaredDistance =x*x+y*y let squaredDistance =x*x+y*y
let distance = Math.sqrt(squaredDistance); let distance = Math.sqrt(squaredDistance);
// console.log("check_enemy_alive,z:"+x+":"+y+":"+this.atk_dis+":"+distance);
if(distance < dir){ if(distance < dir){
dir = distance dir = distance
this.enemy = ho this.enemy = ho
@@ -193,10 +194,12 @@ export class MonViewComp extends CCComp {
} }
if(dir < this.atk_dis){ if(dir < this.atk_dis){
if(dir < this.atk_cd-60) this.stop_cd = 0.1
this.is_atking=true this.is_atking=true
}else{ }else{
this.is_atking=false this.is_atking=false
} }
// console.log("check_enemy_alive", this.enemy);
} }
hp_show(){ hp_show(){
if(this.hp == this.hp_max){ if(this.hp == this.hp_max){
@@ -285,7 +288,7 @@ export class MonViewComp extends CCComp {
this.atk_time = 0; this.atk_time = 0;
this.as.atk(); this.as.atk();
this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
console.log("mon skill_cd:"+this.skill_uuid); // console.log("mon skill_cd:"+this.skill_uuid);
this.shoot(this.skill_uuid); this.shoot(this.skill_uuid);
},0.4) },0.4)
} }

View File

@@ -30,7 +30,7 @@ export class Skill extends ecs.Entity {
super.destroy(); super.destroy();
} }
load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node, 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; 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)) node.setScale(v3(node.scale.x*scale,node.scale.y))
sv.speed=smc.skills[uuid].speed; 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; sv.run_type=smc.skills[uuid].run;
if(sv.dis == 0){ if(sv.dis == 0){
sv.run_type=2 sv.run_type=2

View File

@@ -55,7 +55,14 @@ export class SkillCom extends CCComp {
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this); 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){ //直线,默认直线,有特定目标 朝向目标直线 if(this.run_type == 0){ //直线,默认直线,有特定目标 朝向目标直线
let time = 720 / this.speed; let time = 720 / this.speed;