Esempio n. 1
0
        private float GetModifier(MingmingAlignment attackerType, MingmingAlignment defenderTypes, CardAlignment cardType)
        {
            float modifier = attackerType.Contains(cardType) ? SAME_TYPE_ADVANTAGE : 1f; //Bonus for using same type

            modifier *= GetTypeAdvantage(defenderTypes, cardType);
            return(modifier);
        }
Esempio n. 2
0
        public int GetAttackDamage(int level, int attack, int defense, float cardPower,
                                   MingmingAlignment attackerType, MingmingAlignment defenderTypes, CardAlignment cardType)
        {
            float _modifier = GetModifier(attackerType, defenderTypes, cardType);
            //float damage = ((((((2 * level) / 5) + 2) * power * attack / defense) / 50) + 2) * _modifier;
            float damage = (float)((2 * level) / 5) + 2;

            damage *= (float)cardPower * attack / defense;
            damage  = (float)(damage / 50) + 2;
            damage *= _modifier;

            return(Mathf.FloorToInt(damage));
        }
Esempio n. 3
0
        private float GetTypeAdvantage(MingmingAlignment defenderTypes, CardAlignment cardType)
        {
            float modifier = 1f;

            bool hasPrimaryAdvantage = AlignmentAdvantageLookup.TryGetValue(new AlignmentCombination {
                Source = cardType, Target = defenderTypes.Primary
            }, out float primaryValue);

            modifier *= hasPrimaryAdvantage ? primaryValue : 1;

            bool hasSecondaryAdvantage = AlignmentAdvantageLookup.TryGetValue(new AlignmentCombination {
                Source = cardType, Target = defenderTypes.Secondary
            }, out float secondaryValue);

            modifier *= hasSecondaryAdvantage ? secondaryValue * SECONDARY_TYPE_ADVANTAGE : 1;

            return(modifier);
        }