Exemplo n.º 1
0
        public void GainMastery(TransformationDefinition definition, float gain)
        {
            PlayerTransformation playerTransformation = AcquiredTransformations[definition];
            float maxMastery = playerTransformation.Definition.GetMaxMastery(this);

            if (playerTransformation.CurrentMastery >= maxMastery)
            {
                return;
            }

            if (playerTransformation.CurrentMastery + gain > maxMastery)
            {
                gain = maxMastery - playerTransformation.CurrentMastery;
            }

            if (Trait != null)
            {
                Trait.OnPlayerMasteryGained(this, ref gain, playerTransformation.CurrentMastery);
            }

            playerTransformation.CurrentMastery += gain;
            definition.OnPlayerMasteryGain(this, gain, playerTransformation.CurrentMastery);
        }