This commit is contained in:
2024-12-26 11:10:15 +08:00
parent 65ef666d8c
commit 13bec1e640
2 changed files with 28 additions and 27 deletions

View File

@@ -84,6 +84,7 @@ export class HeroViewComp extends CCComp {
dexp:number=0; //死亡经验 */
ap: number = 10; /**攻击力 */
ap_max: number = 0;
ap_buff: number = 0;
ap_buffs:any = [];
// atk_speed: number = 1;
@@ -92,11 +93,15 @@ export class HeroViewComp extends CCComp {
at: number = 0; /** 冷却时间 */
def: number = 0; //防御
def_max: number = 0;
vun: number = 0; //易伤
crit: number = 0; //暴击率
crit_max: number = 0;
crit_add: number = 0;//暴击伤害加成
dodge: number = 10; //闪避率
dodge_max: number = 10; //闪避率
shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */
@@ -211,8 +216,20 @@ export class HeroViewComp extends CCComp {
this.in_atk(dt);
// this.hp_show()
this.move(dt);
this.check_mission_buf()
}
check_mission_buf(){
this.ap_max=(100+smc.vmdata.mission.ap)/100*this.ap
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
this.def_max=(100+smc.vmdata.mission.def)/100*this.def
this.dodge_max=(100+smc.vmdata.mission.dodge)/100*this.dodge
if(this.box_group == BoxSet.MONSTER){
this.ap_max=(100+smc.vmdata.mission.map)/100*this.ap
this.crit_max=(100+smc.vmdata.mission.mcrit)/100*this.crit
this.def_max=(100+smc.vmdata.mission.mdef)/100*this.def
this.dodge_max=(100+smc.vmdata.mission.mdodge)/100*this.dodge
}
}
check_enemy_alive(){
let dir = 320
this.enemy = v3(720,this.node.position.y)
@@ -361,11 +378,7 @@ export class HeroViewComp extends CCComp {
//暴击判断
check_crit(){
let i = RandomManager.instance.getRandomInt(0,100,3)
let crit=this.crit+smc.vmdata.mission.crit
if(this.box_group == BoxSet.MONSTER){
crit = this.crit+smc.vmdata.mission.mcrit
}
if(i < crit){
if(i < this.crit_max){
this.tooltip(5,"*会心一击*");
this.crit_count += 1
this.exp_add(this.cexp) // 暴击经验
@@ -378,11 +391,7 @@ export class HeroViewComp extends CCComp {
//闪避判断
check_dodge(){
let i = RandomManager.instance.getRandomInt(0,100,3)
let dodge=this.dodge+smc.vmdata.mission.dodge;
if(this.box_group == BoxSet.MONSTER){
dodge = this.dodge+smc.vmdata.mission.mdodge;
}
if(i < dodge){
if(i < this.dodge_max){
// console.log("闪避触发: i="+i+":dodge="+dodge);
this.tooltip(5,"闪避");
this.exp_add(this.doexp) // 闪避经验
@@ -506,33 +515,25 @@ export class HeroViewComp extends CCComp {
shoot_enemy(sk:number,y:number=0,x:number=0){
// console.log("mon shoot_enemy");
let skill = ecs.getEntity<Skill>(Skill);
let AP = this.ap+smc.vmdata.mission.ap; //攻击力需要加上局内buff
if(this.box_group == BoxSet.MONSTER){
AP = this.ap+smc.vmdata.mission.map
}
let {pos,t_pos}=this.get_enemy_pos()
pos.y=pos.y + y
pos.x=pos.x + x
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,AP,t_pos,is_crit,this.crit_add);
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
console.log(this.scale+this.hero_name+"使用技能:"+sk);
}
to_add_buff(hero:any,sk:number){
let skill = ecs.getEntity<Skill>(Skill);
let AP = SkillSet[sk].ap+this.ap+smc.vmdata.mission.ap; //攻击力需要加上局内buff
if(this.box_group == BoxSet.MONSTER){
AP = SkillSet[sk].ap+this.ap+smc.vmdata.mission.map;
}
let {pos,t_pos}=this.get_hero_pos(hero)
console.log("to_add_buff:"+hero.hero_name+" "+sk);
let is_crit=this.check_crit()
skill.load(pos,this.box_group,this.node,sk,AP,t_pos,is_crit,this.crit_add);
skill.load(pos,this.box_group,this.node,sk,this.ap_max,t_pos,is_crit,this.crit_add);
if(SkillSet[sk].hp > 0){ //buff加血
let increase_hp=Math.floor(SkillSet[sk].hp*AP)
let increase_hp=Math.floor(SkillSet[sk].hp*this.ap_max)
hero.add_hp(increase_hp)
}
if(SkillSet[sk].ap > 0){ //buff加攻击
let increase_atk=Math.floor(SkillSet[sk].ap*AP)
let increase_atk=Math.floor(SkillSet[sk].ap*this.ap_max)
hero.add_ap(increase_atk,SkillSet[sk].bsd)
}
@@ -611,7 +612,7 @@ export class HeroViewComp extends CCComp {
if(this.hp > this.hp_max){
this.hp = this.hp_max;
}
this.tooltip(2,hp.toString());
this.tooltip(2,hp.toFixed(0));
let hp_progress= this.hp/this.hp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
}
@@ -630,9 +631,9 @@ export class HeroViewComp extends CCComp {
this.hp += hp;
if(is_crit){
this.tooltip(4,hp.toString(),250);
this.tooltip(4,hp.toFixed(0),250);
}else{
this.tooltip(1,hp.toString(),250);
this.tooltip(1,hp.toFixed(0),250);
}
if(this.hp > this.hp_max){

View File

@@ -49,7 +49,7 @@ export class HCardComp extends CCComp {
this.is_dead=false
}
this.hp.string=this.heros[this.hi].HeroView.hp_max
this.ap.string=this.heros[this.hi].HeroView.ap+smc.vmdata.mission.ap
this.ap.string=this.heros[this.hi].HeroView.ap*(smc.vmdata.mission.ap+100)/100
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm