Beispiel #1
0
        /// <summary>
        /// Used to determine the float value that needs to be added to the baseStatAdd value
        /// </summary>
        /// <param name="body">The body in question, will be passed to GetGeneMultiplier</param>
        /// <param name="statType">The stat being checked</param>
        /// <returns>The stat modifier, this is to be added to the base stat</returns>
        public static float GetStatValueToAdd(CharacterBody body, GeneStat statType)
        {
            float baseStatValue = 0f;

            switch (statType)
            {
            case GeneStat.MaxHealth:
                baseStatValue = body.baseMaxHealth + (body.levelMaxHealth * body.level);
                break;

            case GeneStat.MoveSpeed:
                baseStatValue = body.baseMoveSpeed + (body.levelMoveSpeed * body.level);
                break;

            case GeneStat.AttackSpeed:
                baseStatValue = body.baseAttackSpeed + (body.levelAttackSpeed * body.level);
                break;

            case GeneStat.AttackDamage:
                baseStatValue = body.baseDamage + (body.levelDamage * body.level);
                break;
            }
            float modStatValue = baseStatValue * GetGeneMultiplier(body, statType);

            return(modStatValue - baseStatValue);
        }
Beispiel #2
0
        /// <summary>
        /// Used to determine the current gene multiplier for a given CharacterBody
        /// </summary>
        /// <param name="body">The body in question, needs an inventory</param>
        /// <param name="statType">The stat being checked</param>
        /// <returns>The stat multiplier based on the current items</returns>
        public static float GetGeneMultiplier(CharacterBody body, GeneStat statType)
        {
            float geneValue = 1;

            geneValue += 0.01f * body.inventory?.GetItemCount(GeneTokens.tokenDict[statType][GeneMod.Plus1]) ?? 0f;
            geneValue -= 0.01f * body.inventory?.GetItemCount(GeneTokens.tokenDict[statType][GeneMod.Minus1]) ?? 0f;
            return(geneValue);
        }