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

@@ -397,17 +397,16 @@ export class CardControllerComp extends CCComp {
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;
smc.vm_data.mission.hero.atk += reward.atk / 100
}
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){
smc.vm_data.mission.hero.hp += reward.hp;
this.add_hero_hp_max(reward.hp)
smc.vm_data.mission.hero.hp += reward.hp / 100;
this.add_hero_hp_max(reward.hp / 100)
}
}
}
@@ -422,13 +421,11 @@ export class CardControllerComp extends CCComp {
}
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)
hero.HeroView.add_hp_max(Math.floor(hero.HeroView.hp_max*hp))
}
}
}