This commit is contained in:
2024-09-23 23:29:36 +08:00
parent f72cdb94aa
commit 6d233253ad
6 changed files with 41 additions and 39 deletions

View File

@@ -91,12 +91,12 @@ export class SingletonModuleComp extends ecs.Comp {
hero:{ hero:{
atk:1, atk:1,
atk_cd:1, atk_cd:1,
hp:0, hp:1,
}, },
role:{ role:{
atk:1, atk:1,
atk_cd:1, atk_cd:1,
hp:0, hp:1,
} }
}, },
role:{ role:{

View File

@@ -1,31 +1,31 @@
export const HeroSet = { export const HeroSet = {
9001: { 9001: {
uuid: 9001, path: "k3", type: 1, level: 1,cost:2, name: "骑士", atk: 4, hp: 60, 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: 40, 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: 8, hp: 30, 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: 40, 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: {
uuid: 9004, path: "m1", type: 3, level: 1,cost:2, name: "冰法", atk: 15, hp: 20, atk_dis: 260, atk_cd: 2.5, power: 0, power_max: 20, speed: 30, uuid: 9004, path: "m1", type: 3, level: 1,cost:2, name: "冰法", atk: 25, hp: 50, atk_dis: 260, atk_cd: 2.5, power: 0, power_max: 20, speed: 30,
max_skill: "寒冰箭", skill_uuid: 9002, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1, max_skill: "寒冰箭", skill_uuid: 9002, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1,
}, },
9021: { 9021: {
uuid: 9006, path: "m3", type: 3, level: 1,cost:2, name: "火法", atk: 10, hp: 20, atk_dis: 260, atk_cd: 2, power: 0, power_max: 20, speed: 30, uuid: 9006, path: "m3", type: 3, level: 1,cost:2, name: "火法", atk: 20, hp: 50, atk_dis: 260, atk_cd: 2, power: 0, power_max: 20, speed: 30,
max_skill: "火球术", skill_uuid: 9002, max_skill_uuid: 1001, word: "守护", info: "自身护盾", atktype: 2 max_skill: "火球术", skill_uuid: 9002, max_skill_uuid: 1001, word: "守护", info: "自身护盾", atktype: 2
}, },
9031: { 9031: {
uuid: 9005, path: "m2", type: 3, level: 1,cost:2, name: "牧师", atk: 3, hp: 20, atk_dis: 260, atk_cd: 2, power: 15, power_max: 20, speed: 30, uuid: 9005, path: "m2", type: 3, level: 1,cost:2, name: "牧师", atk: 10, hp: 50, atk_dis: 260, atk_cd: 2, power: 1, power_max: 1, speed: 30,
max_skill: "治愈术", skill_uuid: 9002, max_skill_uuid: 2001, word: "守护", info: "自身护盾", atktype: 2 max_skill: "治愈术", skill_uuid: 9002, max_skill_uuid: 2001, word: "守护", info: "自身护盾", atktype: 2
}, },
9041: { 9041: {
uuid: 9009, path: "arc1", type: 2, level: 1,cost:2, name: "弓箭手", atk: 5, hp: 30, atk_dis: 200, atk_cd: 1.5, power: 0, power_max: 20, speed: 30, uuid: 9009, path: "arc1", type: 2, level: 1,cost:2, name: "弓箭手", atk: 15, hp: 50, atk_dis: 200, atk_cd: 1.5, power: 0, power_max: 20, speed: 30,
max_skill: "精准射击", skill_uuid: 9003, max_skill_uuid: 1003, word: "狂暴", info: "全体攻击", atktype: 2 max_skill: "精准射击", skill_uuid: 9003, max_skill_uuid: 1003, word: "狂暴", info: "全体攻击", atktype: 2
}, },
@@ -34,34 +34,34 @@ export const HeroSet = {
export const MonSet = { export const MonSet = {
1011: { 1011: {
uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 8, hp: 30, 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: 40, 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: 8, hp: 40, 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: 40, 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: 8, hp: 60, 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: 40, 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: 4, hp: 50, 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: 40, 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: 5, hp: 60, 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: 40, 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: 6, 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: 40, 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
}, },
5001: { 5001: {
uuid: 5001, path: "boss1", type: 1, level: 1,cost:2, name: "骷髅王", atk: 20, hp: 1000, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 7, uuid: 5001, path: "boss1", type: 1, level: 1,cost:2, name: "骷髅王", atk: 30, hp: 1000, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 7,
max_skill: "精准打击", skill_uuid: 1001, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1 max_skill: "精准打击", skill_uuid: 1001, max_skill_uuid: 1002, word: "守护", info: "自身护盾", atktype: 1
}, },

View File

@@ -62,14 +62,14 @@ export class Hero extends ecs.Entity {
hv.speed =hv.ospeed = hero_set.speed; hv.speed =hv.ospeed = hero_set.speed;
hv.hero_uuid= uuid; hv.hero_uuid= uuid;
hv.hero_name= hero_set.name; hv.hero_name= hero_set.name;
hv.hp= hv.hp_max = hero_set.hp*(1+smc.vm_data.talent[11].bonus*smc.vm_data.talent[11].lv)*smc.vm_data.mission.hero.hp; hv.hp= hv.hp_max =Math.floor(hero_set.hp*(1+smc.vm_data.talent[11].bonus*smc.vm_data.talent[11].lv)*smc.vm_data.mission.hero.hp);
hv.level = hero_set.level; hv.atk = Math.floor(hero_set.atk*(1+smc.vm_data.talent[12].bonus*smc.vm_data.talent[12].lv))
hv.atk = hero_set.atk*(1+smc.vm_data.talent[12].bonus*smc.vm_data.talent[12].lv);
hv.atk_cd = hero_set.atk_cd*(1-smc.vm_data.talent[13].bonus*smc.vm_data.talent[13].lv); hv.atk_cd = hero_set.atk_cd*(1-smc.vm_data.talent[13].bonus*smc.vm_data.talent[13].lv);
hv.st_boncus=1+smc.vm_data.talent[15].bonus*smc.vm_data.talent[15].lv; hv.st_boncus=1+smc.vm_data.talent[15].bonus*smc.vm_data.talent[15].lv;
hv.s_boncus=1+smc.vm_data.talent[16].bonus*smc.vm_data.talent[16].lv; hv.s_boncus=1+smc.vm_data.talent[16].bonus*smc.vm_data.talent[16].lv;
hv.atk_dis = hero_set.atk_dis; hv.atk_dis = hero_set.atk_dis;
hv.power = hero_set.power; hv.power = hero_set.power;
hv.level = hero_set.level;
hv.power_max= hero_set.power_max*(1-smc.vm_data.talent[14].bonus*smc.vm_data.talent[14].lv);; hv.power_max= hero_set.power_max*(1-smc.vm_data.talent[14].bonus*smc.vm_data.talent[14].lv);;
hv.type = hero_set.type; hv.type = hero_set.type;
hv.skill_uuid = hero_set.skill_uuid; hv.skill_uuid = hero_set.skill_uuid;

View File

@@ -288,7 +288,8 @@ export class HeroViewComp extends CCComp {
shoot_enemy(skill_uuid:number,y:number=0,x:number=0){ shoot_enemy(skill_uuid:number,y:number=0,x:number=0){
// console.log("mon shoot_enemy"); // console.log("mon shoot_enemy");
let skill = ecs.getEntity<Skill>(Skill); let skill = ecs.getEntity<Skill>(Skill);
let atk = smc.skills[skill_uuid].atk+this.atk*smc.vm_data.mission.hero.atk+this.buff_atk; let increase_atk=Math.floor(this.atk*smc.vm_data.mission.hero.atk)
let atk = smc.skills[skill_uuid].atk+this.buff_atk+increase_atk;
let {pos,t_pos}=this.get_enemy_pos() let {pos,t_pos}=this.get_enemy_pos()
pos.y=pos.y + y pos.y=pos.y + y
@@ -302,13 +303,16 @@ export class HeroViewComp extends CCComp {
let {pos,t_pos}=this.get_hero_pos(hero) let {pos,t_pos}=this.get_hero_pos(hero)
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加血
hero.HeroView.add_hp(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)
} }
if(smc.skills[s_uuid].atk > 0){ //buff加攻击 if(smc.skills[s_uuid].atk > 0){ //buff加攻击
hero.HeroView.add_atk(smc.skills[s_uuid].atk*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk,smc.skills[s_uuid].bsd*this.st_boncus) 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)
} }
if(smc.skills[s_uuid].shield > 0){ //buff护盾 if(smc.skills[s_uuid].shield > 0){ //buff护盾
hero.HeroView.add_shield(smc.skills[s_uuid].shield*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk,smc.skills[s_uuid].bsd*this.st_boncus) 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)
} }
} }
push_least_buff(skill:number){ push_least_buff(skill:number){
@@ -419,8 +423,8 @@ export class HeroViewComp extends CCComp {
} }
add_hp_max(hp: number=0){ add_hp_max(hp: number=0){
this.hp_max_add() this.hp_max_add()
// this.hp = this.hp + hp; this.hp += hp;
// this.hp_max = this.hp_max +hp; this.hp_max += hp;
console.log("hp_max:"+this.hp_max+":"+hp+":"+this.hp) console.log("hp_max:"+this.hp_max+":"+hp+":"+this.hp)
let hp_progress= this.hp/this.hp_max; let hp_progress= this.hp/this.hp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress; this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;

View File

@@ -397,17 +397,16 @@ export class CardControllerComp extends CCComp {
this.node.getChildByName('rewards').active = false; this.node.getChildByName('rewards').active = false;
smc.vm_data.game_pause = false; smc.vm_data.game_pause = false;
let reward=this.rewards[value] let reward=this.rewards[value]
console.log("reward:",this.rewards,value)
if(reward.type==1){ if(reward.type==1){
if(reward.atk > 0){ if(reward.atk > 0){
smc.vm_data.mission.hero.atk += reward.atk*100; smc.vm_data.mission.hero.atk += reward.atk / 100
} }
if(reward.atk_cd > 0){ if(reward.atk_cd > 0){
smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100; smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100
} }
if(reward.hp > 0){ if(reward.hp > 0){
smc.vm_data.mission.hero.hp += reward.hp; smc.vm_data.mission.hero.hp += reward.hp / 100;
this.add_hero_hp_max(reward.hp) this.add_hero_hp_max(reward.hp / 100)
} }
} }
} }
@@ -422,13 +421,11 @@ export class CardControllerComp extends CCComp {
} }
add_hero_hp_max(hp:number){ add_hero_hp_max(hp:number){
let heros:any = ecs.query(ecs.allOf(HeroModelComp)); let heros:any = ecs.query(ecs.allOf(HeroModelComp));
console.log("heros:",heros)
if (heros.length > 0) { if (heros.length > 0) {
for (let i = 0; i < heros.length; i++) { for (let i = 0; i < heros.length; i++) {
let hero = heros[i]; let hero = heros[i];
if(!hero.HeroView) continue if(!hero.HeroView) continue
let add_hp=smc.heros[hero.HeroView.hero_uuid].hp*hp/100 hero.HeroView.add_hp_max(Math.floor(hero.HeroView.hp_max*hp))
hero.HeroView.add_hp_max(add_hp)
} }
} }
} }

View File

@@ -149,6 +149,7 @@ export class MonViewComp extends CCComp {
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){ if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
this.stop_cd = 0.1; this.stop_cd = 0.1;
this.is_atking=true this.is_atking=true
} }
} }
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {} onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {}
@@ -177,15 +178,17 @@ export class MonViewComp extends CCComp {
} }
check_enemy_alive(){ check_enemy_alive(){
let dir = 320 let dir = 320
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 hero:any = smc.hero_pos[i];
let x=Math.abs(hero.x-this.node.position.x) let ho:any = smc.hero_pos[i];
let y = Math.abs(hero.y-this.node.position.y) let x=Math.abs(ho.x-this.node.position.x)
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);
if(distance < dir){ if(distance < dir){
dir = distance dir = distance
this.enemy = hero this.enemy = ho
} }
} }
@@ -280,14 +283,12 @@ export class MonViewComp extends CCComp {
if(this.atk_time >= this.atk_cd){ if(this.atk_time >= this.atk_cd){
if(this.is_atking){ if(this.is_atking){
this.atk_time = 0; this.atk_time = 0;
// console.log("atk_cd:"+this.atk_cd);
this.as.atk(); this.as.atk();
this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
console.log("mon skill_cd:"+this.skill_uuid);
this.shoot(this.skill_uuid); this.shoot(this.skill_uuid);
},0.4) },0.4)
} }
}else{
this.atk_time += dt;
} }
} }