虽然现在使用Modifier来修改,但还是存在一些问题没解决,1级时没法修改成功,我在升级的事件dota_player_gained_level来再次触发后可以修改,但是还存在一定的恢复量(0.x的量)

//关闭基础血量/魔法恢复
@registerModifier()
export class modifierBaseRegenDisable extends APermanentModifier
{
    IsHidden(): boolean 
    {
        return true;
    }

    DeclareFunctions(): modifierfunction[] 
    {
        return [
            //关闭基础恢复
            modifierfunction.MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT,
            modifierfunction.MODIFIER_PROPERTY_MANA_REGEN_CONSTANT
        ]
    }

    private _healthValue:number = 0;
    private _manaValue:number = 0;
    
    private _getOwner() : CDOTA_BaseNPC_Hero
    {
        return this.GetParent() as CDOTA_BaseNPC_Hero;
    }
    
    GetHealthAndMana()
    {
        this.SetHasCustomTransmitterData(true);
        this.ForceRefresh();
    }

    AddCustomTransmitterData(): TData
    {
        this._healthValue = this._getOwner().GetBaseHealthRegen();
        this._manaValue =(this._getOwner() as CDOTA_BaseNPC_Hero).GetBaseManaRegen();
        
        return {
            hValue: this._healthValue,
            mValue: this._manaValue
        };
    }

    HandleCustomTransmitterData(data: NetworkedData<TData>)
    {
        this._healthValue = data.hValue;
        this._manaValue = data.mValue;
    }

    GetModifierConstantManaRegen(): number
    {
        return -this._manaValue;
    }

    GetModifierConstantHealthRegen(): number
    {
        return -this._healthValue;
    }
}

type TData = {hValue:number, mValue:number};

game_mode.ts里的事件的内容

 ListenToGameEvent("dota_player_gained_level", event => 
        {
            const hero = EntIndexToHScript(event.hero_entindex) as CDOTA_BaseNPC_Hero;
            const buff = hero.FindModifierByName(modifierBaseRegenDisable.name) as modifierBaseRegenDisable;
            
            if (buff)
                buff.GetHealthAndMana();
            
        }, this);

/Icarus/ServiceFiles//1/2021/10/1634053767619.png