Beispiel #1
0
        public static float GetBaseSecondaryStatForCharacter(SecondaryStatType secondaryStatType, BaseCharacter sourceCharacter)
        {
            //Debug.Log("LevelEquations.GetSecondaryStatForCharacter(" + secondaryStatType.ToString() + ", " + sourceCharacter.CharacterName + ")");
            float returnValue = 0f;

            foreach (IStatProvider statProvider in sourceCharacter.StatProviders)
            {
                if (statProvider != null)
                {
                    foreach (StatScalingNode statScalingNode in statProvider.PrimaryStats)
                    {
                        foreach (PrimaryToSecondaryStatNode primaryToSecondaryStatNode in statScalingNode.PrimaryToSecondaryConversion)
                        {
                            if (primaryToSecondaryStatNode.SecondaryStatType == secondaryStatType)
                            {
                                if (primaryToSecondaryStatNode.RatedConversion == true)
                                {
                                    returnValue += primaryToSecondaryStatNode.ConversionRatio * (sourceCharacter.CharacterStats.PrimaryStats[statScalingNode.StatName].CurrentValue / sourceCharacter.CharacterStats.Level);
                                }
                                else
                                {
                                    returnValue += primaryToSecondaryStatNode.ConversionRatio * sourceCharacter.CharacterStats.PrimaryStats[statScalingNode.StatName].CurrentValue;
                                }
                            }
                        }
                    }
                }
            }

            returnValue += sourceCharacter.CharacterStats.SecondaryStats[secondaryStatType].DefaultAddValue;
            return(returnValue);
        }
 public void ResetByType(SecondaryStatType type)
 {
     if (_stats.Stats.ContainsKey(type))
     {
         _resetHistory.Stats[type] = _stats.Stats[type];
     }
     _stats.Stats.Remove(type);
 }
Beispiel #3
0
 public SecondaryStat(SecondaryStatType t, Stats stats, List <StatDependancy> dependencies, int startingValue = 0)
 {
     this.stats       = stats;
     statDependancies = dependencies;
     type             = t;
     value            = startingValue;
     bonuses          = new List <SecondaryStatBonus>();
 }
Beispiel #4
0
        public static float GetSecondaryStatForCharacter(SecondaryStatType secondaryStatType, BaseCharacter sourceCharacter)
        {
            //Debug.Log("LevelEquations.GetSecondaryStatForCharacter(" + sourceCharacter.CharacterName + ")");
            float returnValue = GetBaseSecondaryStatForCharacter(secondaryStatType, sourceCharacter);

            returnValue += sourceCharacter.CharacterStats.GetSecondaryAddModifiers(secondaryStatType);
            returnValue *= sourceCharacter.CharacterStats.GetSecondaryMultiplyModifiers(secondaryStatType);
            return(returnValue);
        }
Beispiel #5
0
 public virtual float GetSecondaryStatMultiplyModifier(SecondaryStatType secondaryStatType)
 {
     foreach (ItemSecondaryStatNode itemSecondaryStatNode in secondaryStats)
     {
         if (secondaryStatType == itemSecondaryStatNode.SecondaryStat)
         {
             return(itemSecondaryStatNode.BaseMultiplier);
         }
     }
     return(0);
 }
Beispiel #6
0
 public virtual float GetSecondaryStatAddModifier(SecondaryStatType secondaryStatType, int characterLevel)
 {
     foreach (ItemSecondaryStatNode itemSecondaryStatNode in secondaryStats)
     {
         if (secondaryStatType == itemSecondaryStatNode.SecondaryStat)
         {
             return(itemSecondaryStatNode.BaseAmount + (itemSecondaryStatNode.AmountPerLevel * GetItemLevel(characterLevel)));
         }
     }
     return(0f);
 }
 public void Set(
     SecondaryStatType type,
     int value,
     int reason,
     DateTime?dateExpire = null
     )
 => Set(new TemporaryStat
 {
     Type       = type,
     Value      = value,
     Reason     = reason,
     DateExpire = dateExpire
 });
Beispiel #8
0
 public SecondaryStat GetSecondaryStat(SecondaryStatType type)
 {
     return(secondaryStats[type]);
 }
Beispiel #9
0
 public SecondaryStatBonus(SecondaryStatType t, float min, StatModType modType = StatModType.Add)
 {
     type         = t;
     bonusValue   = min;
     this.modType = modType;
 }
Beispiel #10
0
 public ITemporaryStat GetStat(SecondaryStatType type)
 => HasStat(type) ? Stats[type] : null;
Beispiel #11
0
 public int GetReason(SecondaryStatType type)
 => HasStat(type) ? Stats[type].Reason : 0;
Beispiel #12
0
 public int GetValue(SecondaryStatType type)
 => HasStat(type) ? Stats[type].Value : 0;
Beispiel #13
0
 public bool HasStat(SecondaryStatType type)
 => Stats.ContainsKey(type);