示例#1
0
        public void SetAttribute(Attribute attribute, byte value, uint bonus)
        {
            byte oldValue = GetAttributeValue(attribute);

            byte low  = Math.Min(oldValue, value);
            byte high = Math.Max(oldValue, value);

            int totalChange = 0;

            for (int i = low + 1; i <= high; i++)
            {
                totalChange += GetAttributeLevelCost(i);
            }

            if (value > oldValue)
            {
                totalChange = -totalChange;
            }

            int newFreeAttributePoints = _freeAttributePoints + totalChange;

            Debug.Requires(newFreeAttributePoints >= 0);

            SetFreeAttributePoints((byte)newFreeAttributePoints);

            _attributes.SetAttribute(attribute, value, bonus);
        }
        public void SetAttribute(Attribute attribute, byte value, uint bonus)
        {
            Debug.Requires(!DeclarationConversion.IsPrimaryAttribute(attribute) ||
                                       DeclarationConversion.AttributesForProfession(Game.Player.Character.Professions.Primary).Contains(attribute));
                        Debug.Requires(value <= 12);

                        if (_attributes[attribute].Key == value && _attributes[attribute].Value == bonus) return;

                        _attributes[attribute] = new KeyValuePair<byte, uint>(value, bonus);

                        if (Game.State == GameState.Playing)
                        {
                                UpdateAttributes();
                        }
        }
示例#3
0
        public void SetAttribute(Attribute attribute, byte value, uint bonus)
        {
            Debug.Requires(!DeclarationConversion.IsPrimaryAttribute(attribute) ||
                           DeclarationConversion.AttributesForProfession(Game.Player.Character.Professions.Primary).Contains(attribute));
            Debug.Requires(value <= 12);

            if (_attributes[attribute].Key == value && _attributes[attribute].Value == bonus)
            {
                return;
            }

            _attributes[attribute] = new KeyValuePair <byte, uint>(value, bonus);

            if (Game.State == GameState.Playing)
            {
                UpdateAttributes();
            }
        }
 public byte GetAttributeValue(Attribute attribute)
 {
     return _attributes[attribute].Key;
 }
 public uint GetAttributeBonus(Attribute attribute)
 {
     return _attributes[attribute].Value;
 }
示例#6
0
 public uint GetAttributeBonus(Attribute attribute)
 {
     return(_attributes.GetAttributeBonus(attribute));
 }
示例#7
0
 public byte GetAttributeValue(Attribute attribute)
 {
     return(_attributes.GetAttributeValue(attribute));
 }
示例#8
0
 public uint GetAttributeBonus(Attribute attribute)
 {
     return(_attributes[attribute].Value);
 }
示例#9
0
 public byte GetAttributeValue(Attribute attribute)
 {
     return(_attributes[attribute].Key);
 }
示例#10
0
        public void SetAttribute(Attribute attribute, byte value, uint bonus)
        {
            byte oldValue = GetAttributeValue(attribute);

                        byte low = Math.Min(oldValue, value);
                        byte high = Math.Max(oldValue, value);

                        int totalChange = 0;

                        for (int i = low + 1; i <= high; i++)
                        {
                                totalChange += GetAttributeLevelCost(i);
                        }

                        if (value > oldValue) totalChange = -totalChange;

                        int newFreeAttributePoints = _freeAttributePoints + totalChange;

                        Debug.Requires(newFreeAttributePoints >= 0);

                        SetFreeAttributePoints((byte) newFreeAttributePoints);

                        _attributes.SetAttribute(attribute, value, bonus);
        }
示例#11
0
 public byte GetAttributeValue(Attribute attribute)
 {
     return _attributes.GetAttributeValue(attribute);
 }
示例#12
0
 public uint GetAttributeBonus(Attribute attribute)
 {
     return _attributes.GetAttributeBonus(attribute);
 }