奖励 加血 有问题
This commit is contained in:
@@ -89,14 +89,14 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
g_time:0,
|
||||
m_less:0,
|
||||
hero:{
|
||||
reward_atk:0,
|
||||
reward_atk_cd:0,
|
||||
reward_hp:0,
|
||||
atk:1,
|
||||
atk_cd:1,
|
||||
hp:0,
|
||||
},
|
||||
role:{
|
||||
reward_atk:0,
|
||||
reward_atk_cd:0,
|
||||
reward_hp:0,
|
||||
atk:1,
|
||||
atk_cd:1,
|
||||
hp:0,
|
||||
}
|
||||
},
|
||||
role:{
|
||||
|
||||
@@ -60,8 +60,9 @@ export class Hero extends ecs.Entity {
|
||||
// console.log("hero_init",buff)
|
||||
let hero_set= smc.heros[uuid]
|
||||
hv.speed =hv.ospeed = hero_set.speed;
|
||||
hv.hero_uuid= uuid;
|
||||
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);
|
||||
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.level = hero_set.level;
|
||||
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);
|
||||
|
||||
@@ -288,7 +288,7 @@ export class HeroViewComp extends CCComp {
|
||||
shoot_enemy(skill_uuid:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let atk = smc.skills[skill_uuid].atk+this.atk+this.buff_atk;
|
||||
let atk = smc.skills[skill_uuid].atk+this.atk*smc.vm_data.mission.hero.atk+this.buff_atk;
|
||||
let {pos,t_pos}=this.get_enemy_pos()
|
||||
|
||||
pos.y=pos.y + y
|
||||
@@ -302,13 +302,13 @@ export class HeroViewComp extends CCComp {
|
||||
let {pos,t_pos}=this.get_hero_pos(hero)
|
||||
skill.load(pos,BoxSet.HERO,this.node,this.max_skill_uuid,atk,t_pos);
|
||||
if(smc.skills[s_uuid].hp > 0){ //buff加血
|
||||
hero.HeroView.add_hp(smc.skills[s_uuid].hp*this.atk*this.s_boncus)
|
||||
hero.HeroView.add_hp(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk)
|
||||
}
|
||||
if(smc.skills[s_uuid].atk > 0){ //buff加攻击
|
||||
hero.HeroView.add_atk(smc.skills[s_uuid].atk*this.atk*this.s_boncus,smc.skills[s_uuid].bsd*this.st_boncus)
|
||||
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)
|
||||
}
|
||||
if(smc.skills[s_uuid].shield > 0){ //buff护盾
|
||||
hero.HeroView.add_shield(smc.skills[s_uuid].shield*this.atk*this.s_boncus,smc.skills[s_uuid].bsd*this.st_boncus)
|
||||
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)
|
||||
}
|
||||
}
|
||||
push_least_buff(skill:number){
|
||||
@@ -383,7 +383,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.atk_time >= this.atk_cd){
|
||||
if(this.atk_time >= this.atk_cd*smc.vm_data.mission.hero.atk_cd){
|
||||
if(this.is_atking){
|
||||
this.atk_time = 0;
|
||||
// console.log("atk_cd:"+this.atk_cd);
|
||||
@@ -404,6 +404,9 @@ export class HeroViewComp extends CCComp {
|
||||
// node.setPosition(pos)
|
||||
// node.parent = this.node;
|
||||
}
|
||||
hp_max_add(){
|
||||
console.log("hp_max_add 动画");
|
||||
}
|
||||
add_hp(hp: number=0){
|
||||
this.heathed();
|
||||
this.hp+=hp;
|
||||
@@ -414,7 +417,14 @@ export class HeroViewComp extends CCComp {
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
}
|
||||
|
||||
add_hp_max(hp: number=0){
|
||||
this.hp_max_add()
|
||||
// this.hp = this.hp + hp;
|
||||
// this.hp_max = this.hp_max +hp;
|
||||
console.log("hp_max:"+this.hp_max+":"+hp+":"+this.hp)
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
}
|
||||
hp_change(hp: number){
|
||||
if(this.is_dead){
|
||||
return;
|
||||
|
||||
@@ -393,18 +393,44 @@ export class CardControllerComp extends CCComp {
|
||||
|
||||
this.node.getChildByName('rewards').active = true;
|
||||
}
|
||||
colse_reward(){
|
||||
colse_reward(value:number){
|
||||
this.node.getChildByName('rewards').active = false;
|
||||
smc.vm_data.game_pause = false;
|
||||
let reward=this.rewards[value]
|
||||
console.log("reward:",this.rewards,value)
|
||||
if(reward.type==1){
|
||||
if(reward.atk > 0){
|
||||
smc.vm_data.mission.hero.atk += reward.atk*100;
|
||||
}
|
||||
do_reward_1(value:number=1){
|
||||
this.colse_reward()
|
||||
if(reward.atk_cd > 0){
|
||||
smc.vm_data.mission.hero.atk_cd -= reward.atk_cd/100;
|
||||
}
|
||||
if(reward.hp > 0){
|
||||
smc.vm_data.mission.hero.hp += reward.hp;
|
||||
this.add_hero_hp_max(reward.hp)
|
||||
}
|
||||
}
|
||||
}
|
||||
do_reward_1(){
|
||||
this.colse_reward(1)
|
||||
}
|
||||
do_reward_2(){
|
||||
this.colse_reward(2)
|
||||
}
|
||||
do_reward_3(){
|
||||
this.colse_reward(3)
|
||||
}
|
||||
add_hero_hp_max(hp:number){
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
console.log("heros:",heros)
|
||||
if (heros.length > 0) {
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero = heros[i];
|
||||
if(!hero.HeroView) continue
|
||||
let add_hp=smc.heros[hero.HeroView.hero_uuid].hp*hp/100
|
||||
hero.HeroView.add_hp_max(add_hp)
|
||||
}
|
||||
do_reward_2(value:number=2){
|
||||
this.colse_reward()
|
||||
}
|
||||
do_reward_3(value:number=3){
|
||||
this.colse_reward()
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(smc.vm_data.game_over||smc.vm_data.game_pause){
|
||||
|
||||
Reference in New Issue
Block a user