FightConComp 的效用已经取消,下一步 进一步 精简,去掉临时 buff debuff 因为本身就是 当局游戏 没必要加零时debuff 直接当局永久debuff

This commit is contained in:
2025-07-22 16:42:42 +08:00
parent e45ebd524b
commit b17de4a2ac
5 changed files with 55 additions and 114 deletions

View File

@@ -9,7 +9,6 @@ import { BuffAttr, DebuffAttr, SkillSet, TGroup, TType } from "../common/config/
import { BuffComp } from "./BuffComp";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { FightConComp } from "../map/FightConComp";
import { EquipSpecialAttr } from "../common/config/Equips";
import { FightSet, getExpDrops, getStoneDrops, TooltipTypes } from "../common/config/Mission";
import { getApIncrease, getHpIncrease, getUpExp, HeroInfo, HeroPos } from "../common/config/heroSet";
@@ -24,7 +23,6 @@ const { ccclass, property } = _decorator;
@ccclass('HeroViewComp') // 定义为 Cocos Creator 组件
@ecs.register('HeroView', false) // 定义为 ECS 组件
export class HeroViewComp extends CCComp {
FIGHTCON:FightConComp=null!
BUFFCOMP:BuffComp=null!
as: HeroSpine = null!
status:String = "idle"
@@ -92,6 +90,10 @@ export class HeroViewComp extends CCComp {
speek_time:number = 0;
is_stop_temp:boolean = false
double_atked:boolean=false
atk_add_master_atk:number=0
atk_add_master_hp:number=0
buff_debuff_down:number=0
skill_dmg:number=0
BUFF_DEFS: Array<{value: number, count: number}> = [] //防御提升
BUFF_ATKS: Array<{value: number, count: number}> = [] //攻击提升
@@ -105,6 +107,10 @@ export class HeroViewComp extends CCComp {
DEBUFF_FROST: number = 0; //冰冻
DEBUFF_STUN: number = 0; //眩晕
DEBUFF_VALUE:number=0; //debuff 增益值
DEBUFF_COUNT:number=0; //debuff 持续次数
DEBUFF_UP:number=0; //debuff 概率提升
private damageQueue: Array<{
damage: number,
isCrit: boolean,
@@ -117,7 +123,6 @@ export class HeroViewComp extends CCComp {
onLoad() {
this.as = this.getComponent(HeroSpine);
this.FIGHTCON=this.node.parent.getComponent(FightConComp);
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_atk,this)
this.on(GameEvent.EXPUP,this.exp_up,this)
@@ -311,17 +316,16 @@ export class HeroViewComp extends CCComp {
if(!this.is_master) return
this.atk_count+=1
if(this.atk_count< FightSet.ATK_ADD_COUNT) return
if(this.FIGHTCON.atk_add_glod >0) smc.vmdata.mission_data.gold+=this.FIGHTCON.atk_add_glod
let master=ecs.query(ecs.allOf(MasterModelComp))
master.forEach(master=>{
let master_view=master.get(HeroViewComp)
if(this.FIGHTCON.atk_add_master_atk>0) {
master_view.add_ap(this.FIGHTCON.atk_add_master_atk)
if(this.atk_add_master_atk>0) {
master_view.add_ap(this.atk_add_master_atk,true)
}
if(this.FIGHTCON.atk_add_master_hp>0) {
master_view.add_hp_max(this.FIGHTCON.atk_add_master_hp)
if(this.atk_add_master_hp>0) {
master_view.add_hp_max(this.atk_add_master_hp,true)
}
})
@@ -349,22 +353,13 @@ export class HeroViewComp extends CCComp {
}
get_buff(){
let buff=null
if(this.fac==FacSet.HERO) buff=this.FIGHTCON.hero_buff
if(this.is_boss) buff=this.FIGHTCON.enemy_buff
if(this.is_kalami) buff=this.FIGHTCON.enemy_buff
if(buff==null) return
return buff
}
get_debuff(){
}
add_debuff(type:number,deV:number,deC:number,deR:number){
let DEBUFF_DOWN=0
let buff_debuff_down=0
let buff=this.get_buff()
if(buff!==null) buff_debuff_down=buff.DEBUFF_DOWN
for(let i=0;i<this.BUFF_DEDOWN.length;i++){
DEBUFF_DOWN+=this.BUFF_DEDOWN[i].value
this.BUFF_DEDOWN[i].count-=1
@@ -372,7 +367,7 @@ export class HeroViewComp extends CCComp {
this.BUFF_DEDOWN.splice(i,1)
}
}
let n_deR=deR-DEBUFF_DOWN-buff_debuff_down // 触发概率
let n_deR=deR-DEBUFF_DOWN-this.buff_debuff_down // 触发概率
let r=RandomManager.instance.getRandomInt(0,100) // 随机数
//console.log("[HeroViewComp]:类型,值,次数,技能概率,实际概率,随机数",type,deV,deC,deR,n_deR,r)
if(r < n_deR) {
@@ -504,11 +499,8 @@ export class HeroViewComp extends CCComp {
}
}
// buff 防御 即免伤
let buff_def=0
let buff=this.get_buff()
if(buff!==null) buff_def=buff.DEF
damage=remainingDamage*(100-(buff_def+def)+Burn)/100
damage=remainingDamage*(100-def-this.def+Burn)/100
////console.log("[HeroViewComp]:最终伤害,敌人伤害值,免伤,防御,易伤",damage,remainingDamage,buff_def,def,Burn)
return Math.floor(damage)
}
@@ -650,7 +642,7 @@ export class HeroViewComp extends CCComp {
this.add_speed(data.value)
break
case EnhancementType.HEALTH:
this.add_hp_max(data.value)
this.add_hp_max(data.value,true)
break
case EnhancementType.DEF:
this.add_def(data.value)