buff需要重置

This commit is contained in:
2025-10-16 16:52:27 +08:00
parent 31eedceeb3
commit d0cd9c1326
21 changed files with 153 additions and 958 deletions

View File

@@ -11,8 +11,7 @@ import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../common/config/GameEvent";
import { FightSet, getExpDrops, getStoneDrops, TooltipTypes } from "../common/config/Mission";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { Items, MonsterDropManager } from "../common/config/Items";
import { HeroInfo } from "../common/config/heroSet";
import { HeroInfo, HeroUpSet } from "../common/config/heroSet";
const { ccclass, property } = _decorator;
@@ -45,9 +44,12 @@ export class HeroViewComp extends CCComp {
speed_base: number = 100; /** 角色初始速度 */
power:number=0;
power_max:number=100;
mp: number = 0;
mp_max: number = 100;
mp_base: number = 100;
hp: number = 100; /** 血量 */
hp_max: number = 100; /** 最大血量 */
hp_base:number=0;
hp_base:number=100; /** 基础最大血量 */
shield:number=0; //当前护甲值
shield_max:number=0; //最大护甲值
ap: number = 10; /**攻击力 */
@@ -152,14 +154,13 @@ export class HeroViewComp extends CCComp {
// this.ent.destroy();
// return
// }
this.BaseUp(dt)
if(this.DEBUFF_FROST > 0){
this.DEBUFF_FROST -=dt;
}
if(this.DEBUFF_STUN > 0){
this.DEBUFF_STUN -=dt;
}
// 更新所有按时间减少的buff和debuff
this.updateBuffsAndDebuffs(dt);
this.in_stop(dt);
@@ -167,6 +168,12 @@ export class HeroViewComp extends CCComp {
this.processDamageQueue();
}
BaseUp(dt:number){
this.mp += HeroUpSet.MP*dt
this.hp += HeroUpSet.HP*dt
if(this.mp > this.mp_max) this.mp = this.mp_max
if(this.hp > this.hp_max) this.hp = this.hp_max
}
do_fight_end(){
this.as.do_buff()
}
@@ -202,7 +209,7 @@ export class HeroViewComp extends CCComp {
add_hp(hp: number = 0,is_num:boolean=true) {
this.BUFFCOMP.heathed();
let real_hp=0
let hp_max=this.Attrs[BuffAttr.HP_MAX]
let hp_max=this.hp_max
let lost_hp=hp_max-this.hp
if(is_num){
if(lost_hp > hp){
@@ -221,7 +228,7 @@ export class HeroViewComp extends CCComp {
this.hp+=real_hp;
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
}
this.BUFFCOMP.hp_show(this.hp,this.Attrs[BuffAttr.HP_MAX])
this.BUFFCOMP.hp_show(this.hp,this.hp_max)
// this.update_vm
}
@@ -269,30 +276,7 @@ export class HeroViewComp extends CCComp {
}
do_drop(){
let drop_item=MonsterDropManager.calculateMonsterDrops(this.hero_uuid,smc.data.mission,1)
this.scheduleOnce(()=>{
if(smc.guides[2]==0&&smc.current_guide==2&&smc.guides[1]==1) {
drop_item.push({item_uuid:Items[1008].uuid,count:20})
}
},0.1)
let {exp,gold,diamond}=MonsterDropManager.calculateBaseResourceDrops(HeroInfo[this.hero_uuid].quality,smc.data.mission,this.BUFFS.length)
oops.message.dispatchEvent(GameEvent.MonDead,{mon_uuid:this.hero_uuid,drops:drop_item,game_data:{exp:exp, gold:gold, diamond:diamond}})
if(drop_item.length>0){
for(let i=0;i<drop_item.length;i++){
let d_item=drop_item[i]
smc.addItem(d_item.item_uuid,d_item.count)
}
}
if(exp>0){
smc.addExp(exp)
}
if(gold>0){
smc.addGold(gold)
}
if(diamond>0){
smc.addDiamond(diamond)
}
// console.log("[HeroViewComp]:do_drop",this.hero_uuid,drop_item,exp,gold,diamond)
}
add_debuff(type:number,deV:number,deC:number,deR:number){
let n_deR=deR-this.Attrs[BuffAttr.DEBUFF_DOWN]
@@ -325,8 +309,9 @@ export class HeroViewComp extends CCComp {
// this.is_stop=true
break
case DebuffAttr.DEHP:
this.Attrs[BuffAttr.HP_MAX]-=deV/100*this.Attrs[BuffAttr.HP_MAX]
if(this.hp-this.Attrs[BuffAttr.HP_MAX]>0) this.hp=this.Attrs[BuffAttr.HP_MAX]
this.Attrs[BuffAttr.HP_MAX]-=deV
this.hp_max=Math.floor(this.hp_base*(100+this.Attrs[BuffAttr.HP_MAX]))
if(this.hp-this.hp_max>0) this.hp=this.hp_max
break
case DebuffAttr.DEATK: //99为具体数字 并且局内永久生效,其他为百分比
if(deC == 99){
@@ -409,8 +394,10 @@ export class HeroViewComp extends CCComp {
case BuffAttr.ATK_CD: //攻击速度百分比
this.Attrs[BuffAttr.ATK_CD]+=buff_value/100*this.cd
break
case BuffAttr.HP: //血量百分比
this.Attrs[BuffAttr.HP_MAX]+=Math.floor(buff_value/100*this.hp_max)
case BuffAttr.HP_MAX: //血量百分比
this.Attrs[BuffAttr.HP_MAX]+=buff_value
this.hp_max=Math.floor(this.hp_base*(100+this.Attrs[BuffAttr.HP_MAX]))
if(this.hp-this.hp_max>0) this.hp=this.hp_max
break
default:
this.Attrs[buff_type]+=buff_value