护盾改为 护甲值

This commit is contained in:
2025-08-17 12:25:22 +08:00
parent 6288d4e4bb
commit e5874bf936
15 changed files with 8903 additions and 8921 deletions

View File

@@ -43,10 +43,13 @@ export class HeroViewComp extends CCComp {
speed: number = 100; /** 角色移动速度 */
speed_base: number = 100; /** 角色初始速度 */
power:number=0;
power_max:number=100;
hp: number = 100; /** 血量 */
hp_max: number = 100; /** 最大血量 */
hp_base:number=0;
shield:number=0; //当前护甲值
shield_max:number=0; //最大护甲值
ap: number = 10; /**攻击力 */
ap_base:number=0;
// atk_speed: number = 1;
@@ -72,7 +75,6 @@ export class HeroViewComp extends CCComp {
frost_no:boolean=false; //冰冻免疫
knockback:number=0; //击退概率
knockback_no:boolean=false; //击退免疫
shield:number = 0; //护盾,免伤1次减1
reflect:number=0; //反射伤害比率
lifesteal:number=0; //吸血比率
skill_dmg:number=0
@@ -143,6 +145,7 @@ export class HeroViewComp extends CCComp {
}
/* 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true;
this.add_shield(100)
}
update(dt: number){
@@ -166,17 +169,6 @@ export class HeroViewComp extends CCComp {
this.processDamageQueue();
}
hp_show(){
// if(this.node.getComponent(HeroViewComp).fac == 0) return
let hp=this.hp;
let hp_max=this.Attrs[BuffAttr.HP_MAX];
let hp_progress= hp/hp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar).progress = hp_progress;
this.scheduleOnce(()=>{
this.node.getChildByName("top").getChildByName("hp").getChildByName("hpb").getComponent(ProgressBar).progress = hp_progress;
},0.15)
// this.node.getChildByName("top").getChildByName("hp").active = (hp == hp_max) ? false : true;
}
do_fight_end(){
this.as.do_buff()
}
@@ -204,9 +196,8 @@ export class HeroViewComp extends CCComp {
}
add_shield(shield:number){
this.shield =shield
if(this.shield>6) this.shield=6
if(this.shield>0) this.BUFFCOMP.show_shield(true)
this.shield = this.shield_max +=shield
if(this.shield>0) this.BUFFCOMP.show_shield(this.shield,this.shield_max)
}
@@ -232,7 +223,7 @@ export class HeroViewComp extends CCComp {
this.hp+=real_hp;
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
}
this.hp_show()
this.BUFFCOMP.hp_show(this.hp,this.Attrs[BuffAttr.HP_MAX])
// this.update_vm
}
@@ -414,7 +405,7 @@ export class HeroViewComp extends CCComp {
if(stun_time>0){
this.add_debuff(DebuffAttr.STUN,stun_time,1,stun_ratio)
}
if(this.check_shield()) return
if(this.check_dodge()) return
let is_crit = this.check_crit(crit)
@@ -424,8 +415,9 @@ export class HeroViewComp extends CCComp {
damage = Math.floor(damage * (1 + (FightSet.CRIT_DAMAGE+crit_d)/100))
}
console.log(this.hero_name+"[HeroViewComp]:heroview :damage|hp|hp_max",damage,this.hp,this.Attrs[BuffAttr.HP_MAX])
damage=this.check_shield(damage)
if(damage <= 0) return
this.hp -= damage;
if(this.hp <= 0) {
if(this == null) return;
this.is_dead=true
@@ -470,17 +462,23 @@ export class HeroViewComp extends CCComp {
return Math.floor(Math.max(damage,min))
}
check_shield(){
if(this.shield>0){
this.shield -= 1
check_shield(damage:number){
if(this.shield <= 0 ) return damage
if(this.shield >= damage){
this.shield -= damage
this.BUFFCOMP.tooltip(TooltipTypes.uskill,"*吸收*");
if (this.shield <= 0) {
if(this == null) return;
this.BUFFCOMP.show_shield(false);
if(this.shield <= 0){
this.shield=this.shield_max=0
}
return true
damage = 0
}
return false
if(this.shield < damage){
damage=damage-this.shield
this.shield=0
this.shield_max=0
}
this.BUFFCOMP.show_shield(this.shield,this.shield_max)
return damage
}
check_dodge(){
@@ -622,7 +620,7 @@ export class HeroViewComp extends CCComp {
/** 立即显示伤害效果 */
private showDamageImmediate(damage: number, isCrit: boolean,anm:string="atked") {
// this.as.atked()
this.hp_show()
this.BUFFCOMP.hp_show(this.hp,this.Attrs[BuffAttr.HP_MAX])
this.BUFFCOMP.in_atked(anm,this.fac==FacSet.HERO?1:-1)
this.atked_count++;
if (isCrit) {