예제 #1
0
    public virtual void ReplenishMana(float howMuch, bool show = false)
    {
        RegenerationEvent ev = new RegenerationEvent()
        {
            PredictedRegeneration = howMuch
        };

        OnRegenerateMana(ev);
        howMuch = ev.PredictedRegeneration;
        SetUnitManaBJ(this, GetUnitState(this, UNIT_STATE_MANA) + howMuch * ManaFromAllSources);
        if (show)
        {
            location loc = Location(GetUnitX(this) + GetRandomReal(0, 10), GetUnitY(this) + GetRandomReal(0, 5));
            Utils.TextDirectionRandom("+" + Utils.NotateNumber(R2I(howMuch)), loc, 5.7f, 128, 128, 255, 0, 0.7f, GetOwningPlayer(this));
            RemoveLocation(loc);
            loc = null;
        }
    }
예제 #2
0
    /// <summary>
    /// Simple function that heals a unit by howMuch amount (flat).
    /// </summary>
    /// <param name="howMuch"></param>
    public virtual void Heal(float howMuch, bool show = false)
    {
        float             pars = howMuch * HealingFromAllSources;
        RegenerationEvent ev   = new RegenerationEvent()
        {
            PredictedRegeneration = pars
        };

        OnRegenerateHP(ev);
        pars = ev.PredictedRegeneration;
        SetWidgetLife(this, GetWidgetLife(this) + pars);
        if (show)
        {
            location loc = Location(GetUnitX(this) + GetRandomReal(0, 10), GetUnitY(this) + GetRandomReal(0, 5));
            Utils.TextDirectionRandom("+" + Utils.NotateNumber(R2I(pars)), loc, 5.7f, 128, 255, 128, 0, 0.7f, GetOwningPlayer(this));
            RemoveLocation(loc);
            loc = null;
        }
    }