Beispiel #1
0
    protected void OnStatChanged(EventData data)
    {
        StatCollection.BaseStat.BaseStatType stat = (StatCollection.BaseStat.BaseStatType)data.GetInt("Stat");
        Entity target = data.GetMonoBehaviour("Target") as Entity;
        Entity cause  = data.GetMonoBehaviour("Cause") as Entity;

        if (target != owner)
        {
            return;
        }

        if (stat == StatCollection.BaseStat.BaseStatType.Health)
        {
            //Debug.Log(owner.stats.GetStatModifiedValue(Constants.BaseStatType.Health) + " is the health of " + owner.gameObject.name);

            float currentHealth = owner.stats.GetStatModifiedValue(StatCollection.BaseStat.BaseStatType.Health);
            float maxHealth     = owner.stats.GetStatMaxValue(StatCollection.BaseStat.BaseStatType.Health);

            //UpdateHealthBar(currentHealth, maxHealth);

            if (currentHealth <= 0f)
            {
                if (!cheat)
                {
                    Die(cause);
                }
            }
        }
    }
    public static void RemoveTrackedStatMod(Entity targetOfChange, StatCollection.BaseStat.BaseStatType stat, StatCollection.StatModifer mod)
    {
        targetOfChange.stats.RemoveTrackedMod(stat, mod);

        Debug.Log("Removing a mod: " + stat + " value of " + mod.value);

        statAdjustmentManager.SendStatChangeEvent(null, targetOfChange, stat, mod.value);
    }
Beispiel #3
0
    public void ApplyTrackedMod(BaseStatType statType, StatModifer mod)
    {
        BaseStat targetStat = GetStat(statType);

        if (targetStat == null)
        {
            Debug.Log("Stat: " + statType + " not found");
            return;
        }
        targetStat.ModifyStat(mod);
    }
Beispiel #4
0
    public void ApplyUntrackedMod(BaseStatType statType, float value, StatModificationType modType = StatModificationType.Additive)
    {
        BaseStat targetStat = GetStat(statType);

        if (targetStat == null)
        {
            Debug.Log("Stat: " + statType + " not found");
            return;
        }
        targetStat.ModifyStat(value, modType);
    }
    private void SendStatChangeEvent(Entity causeOfChagne, Entity targetOfChagnge, StatCollection.BaseStat.BaseStatType stat, float value)
    {
        //EventData data = new EventData();

        //data.AddMonoBehaviour("Cause", causeOfChagne);
        //data.AddMonoBehaviour("Target", targetOfChagnge);
        //data.AddInt("Stat", (int)stat);
        //data.AddFloat("Value", value);

        ////Debug.Log("Event Sent: " + stat.ToString() + " :: " + value);
        //EventGrid.EventManager.SendEvent(Constants.GameEvent.StatChanged, data);
    }
Beispiel #6
0
    public float GetStatMultipler(BaseStatType statType)
    {
        for (int i = 0; i < baseStats.Count; i++)
        {
            if (baseStats[i].statType == statType)
            {
                return(baseStats[i].GetTotalMultiplier());
            }
        }

        return(1f);
    }
Beispiel #7
0
    public float GetStatMaxValue(BaseStatType statType)
    {
        for (int i = 0; i < baseStats.Count; i++)
        {
            if (baseStats[i].statType == statType)
            {
                return(baseStats[i].MaxValue);
            }
        }

        return(0);
    }
Beispiel #8
0
    private BaseStat GetStat(BaseStatType statType)
    {
        for (int i = 0; i < baseStats.Count; i++)
        {
            if (baseStats[i].statType == statType)
            {
                return(baseStats[i]);
            }
        }

        return(null);
    }
    public void InitializeDurationalStatChange(StatCollection.BaseStat.BaseStatType targetStat, StatCollection.StatModificationType modType, float statAdjValue)
    {
        this.targetStat   = targetStat;
        this.modType      = modType;
        this.statAdjValue = statAdjValue;


        if (StatusManager.IsTargetAlreadyAffected(targetEntity, this, sourceAbility) == false)
        {
            CreateStatMod();
        }
    }
Beispiel #10
0
    public EffectStatus(EffectStatus effectStatus)
    {
        effectName       = effectStatus.effectName;
        riderTarget      = effectStatus.riderTarget;
        effectType       = effectStatus.effectType;
        deliveryMethod   = effectStatus.deliveryMethod;
        animationTrigger = effectStatus.animationTrigger;

        //applyToSpecificTarget = effectStatus.applyToSpecificTarget;
        //targetIndex = effectStatus.targetIndex;
        riders = effectStatus.CloneRiders();

        scaleFromBaseDamage = effectStatus.scaleFromBaseDamage;
        percentOfBaseDamage = effectStatus.percentOfBaseDamage;
        damagePerInterval   = effectStatus.damagePerInterval;

        statusType  = effectStatus.statusType;
        stackMethod = effectStatus.stackMethod;
        maxStack    = effectStatus.maxStack;
        duration    = effectStatus.duration;
        interval    = effectStatus.interval;

        onCompleteEffectName = effectStatus.onCompleteEffectName;

        affectMoveType  = effectStatus.affectMoveType;
        affectMoveValue = effectStatus.affectMoveValue;
        knocbackAngle   = effectStatus.knocbackAngle;

        statType            = effectStatus.statType;
        statAdjustmentValue = effectStatus.statAdjustmentValue;
        modType             = effectStatus.modType;



        switch (deliveryMethod)
        {
        case Constants.EffectDeliveryMethod.Melee:
            meleeDelivery.prefabName = effectStatus.meleeDelivery.prefabName;
            meleeDelivery.layerMask  = effectStatus.meleeDelivery.layerMask;
            break;

        case Constants.EffectDeliveryMethod.Projectile:
            projectileDelivery.prefabName = effectStatus.projectileDelivery.prefabName;
            projectileDelivery.layerMask  = effectStatus.projectileDelivery.layerMask;
            break;
        }
    }
    public static void ApplyTrackedStatMod(Entity causeOfChagne, Entity targetOfChange, StatCollection.BaseStat.BaseStatType stat, StatCollection.StatModifer mod)
    {
        targetOfChange.stats.ApplyTrackedMod(stat, mod);

        statAdjustmentManager.SendStatChangeEvent(causeOfChagne, targetOfChange, stat, mod.value);

        if (stat == StatCollection.BaseStat.BaseStatType.Health && mod.value < 0f)
        {
            VisualEffectManager.MakeFloatingText(Mathf.Abs(mod.value).ToString(), targetOfChange.transform.position);
        }
    }
    //public static void AddStaticPlayerStatAdjustment(StatCollection.BaseStat.BaseStatType targetStat, float value) {
    //    ApplyUntrackedStatMod(null, GameManager.GetPlayer(), targetStat, value);
    //}

    public static void ApplyUntrackedStatMod(Entity causeOfChagne, Entity targetOfChagnge, StatCollection.BaseStat.BaseStatType stat, float value, StatCollection.StatModificationType modType = StatCollection.StatModificationType.Additive)
    {
        float sendableValue = 0f;

        if (stat == StatCollection.BaseStat.BaseStatType.Health)
        {
            //Debug.Log(targetOfChagnge);

            float armor = targetOfChagnge.stats.GetStatModifiedValue(StatCollection.BaseStat.BaseStatType.Armor);
            //Debug.Log(armor + " is the armor of " + targetOfChagnge.entityName);
            sendableValue = Mathf.Clamp(value + armor, value, 0f);

            float damageReduction = targetOfChagnge.stats.GetStatModifiedValue(StatCollection.BaseStat.BaseStatType.DamageReduction);

            float convertedDR = Mathf.Clamp(Mathf.Abs(damageReduction - 1f), 0f, 1f);

            sendableValue *= convertedDR;
        }
        else
        {
            sendableValue = value;
        }


        targetOfChagnge.stats.ApplyUntrackedMod(stat, sendableValue, modType);

        statAdjustmentManager.SendStatChangeEvent(causeOfChagne, targetOfChagnge, stat, sendableValue);

        if (stat == StatCollection.BaseStat.BaseStatType.Health && value < 0f)
        {
            VisualEffectManager.MakeFloatingText(Mathf.Abs(sendableValue).ToString(), targetOfChagnge.transform.position);
        }
    }
Beispiel #13
0
 public BaseStat(BaseStatType statType, float baseValue, float maxValue)
 {
     this.statType = statType;
     BaseValue     = baseValue;
     MaxValue      = maxValue;
 }