buff动画优化 + 添加闪避最大值限定值

This commit is contained in:
2025-01-13 10:19:26 +08:00
parent 82b68e4f87
commit 0f1c30e666
9 changed files with 7949 additions and 6510 deletions

View File

@@ -326,7 +326,7 @@ export class HeroViewComp extends CCComp {
this.hp_less(l_hp,skill.is_crit);
}
check_less(ap:number,is_crit:boolean,crit_add:number=0){
let d=this.def/ap
let d=this.def_max/ap
if(d > 1) d = 1
let l_hp=ap*(1-d*GameSet.DEF_RATE) //防御最高减免伤害比率计算
if(is_crit){
@@ -420,6 +420,7 @@ export class HeroViewComp extends CCComp {
check_dodge():boolean
{
let i = RandomManager.instance.getRandomInt(0,100,3)
if(this.dodge_max > GameSet.DODGE_MAX) this.dodge_max = GameSet.DODGE_MAX
if(i < this.dodge_max){
// console.log("闪避触发: i="+i+":dodge="+dodge);
this.BUFFCOMP.tooltip(5,"闪避");
@@ -732,18 +733,70 @@ export class HeroViewComp extends CCComp {
power_add(p:number){
this.pw+= p
}
add_shield(shield:number){
this.shield =shield
console.log("shield:",shield);
}
// add_cd(cd: number){
// this.cd += this.cd*((100-cd)/100);
// this.BUFFCOMP.buff_get("cd")
// }
/**
* 增加英雄的攻击AP
* @param ap 要增加的攻击。
*/
add_ap(ap: number){
this.ap += Math.floor(ap);
this.BUFFCOMP.buff_get("ap")
}
add_shield(shield:number){
this.shield =shield
console.log("shield:",shield);
de_ap(ap: number){
this.ap -= Math.floor(ap);
this.BUFFCOMP.buff_get("deap")
}
add_hp(hp: number=0){
add_def(def: number){
this.def += Math.floor(def);
this.BUFFCOMP.buff_get("def")
}
de_def(def: number){
this.def -= Math.floor(def);
this.BUFFCOMP.buff_get("dedef")
}
/**
* 增加英雄的暴击率。
* @param crit 要增加的暴击率。
*/
add_crit(critRate: number) {
this.crit += Math.floor(critRate);
this.BUFFCOMP.buff_get("crit");
}
de_crit(critRate: number) {
this.crit += Math.floor(critRate);
this.BUFFCOMP.buff_get("decrit");
}
/**
* 增加英雄的闪避率。
* @param dodge 要增加的闪避率。
*/
add_dodge(dodgeRate: number) {
this.dodge += Math.floor(dodgeRate);
this.BUFFCOMP.buff_get("dodge");
}
de_dodge(dodgeRate: number) {
this.dodge += Math.floor(dodgeRate);
this.BUFFCOMP.buff_get("dedodge");
}
add_hp_max(hprate: number=0){
this.BUFFCOMP.buff_get("hp")
this.hp_max += Math.floor(hprate/100*this.rhp_max) ;
this.add_hp2(hprate)
}
de_hp_max(hprate: number=0){
this.BUFFCOMP.buff_get("dehp")
this.hp_max -= Math.floor(hprate/100*this.rhp_max) ;
}
add_hp(hp: number = 0) {
this.BUFFCOMP.heathed();
this.hp+=Math.floor(hp);
if(this.hp > this.rhp_max){
@@ -754,11 +807,6 @@ export class HeroViewComp extends CCComp {
add_hp2(hprate: number=0){
this.hp += Math.floor(hprate/100*this.hp_max) ;
}
add_hp_max(hprate: number=0){
this.BUFFCOMP.show_hp(0.5)
this.hp_max += Math.floor(hprate/100*this.rhp_max) ;
this.add_hp2(hprate)
}
hp_less(hp: number,is_crit:boolean=false){
if(this.is_dead) return