Represents an attribute bonus that has a direct effect on the attribute base. Assigned to items. By: NeilDG
Inheritance: AttributeBase
Ejemplo n.º 1
0
    public void Add(AttributeBonus rawBonus, int rank)
    {
        if (!this.mBonusesByRank.TryGetValue(rank, out var lBonusCollection))
        {
            lBonusCollection = new List <AttributeBonus>();
            this.mBonusesByRank.Add(rank, lBonusCollection);
        }

        lBonusCollection.Add(rawBonus);
    }
    public void Perform(ControllableUnit sourceUnit, ControllableUnit targetUnit)
    {
        AttributeBonus damageOutcome = new AttributeBonus(-2,1);

        HealthAttribute healthAttribute = targetUnit.GetCharacterData().GetHealthAttribute();
        healthAttribute.AddAttributeBonus(damageOutcome);

        Debug.Log ("Normal attack skill to " +targetUnit+ ". Unit new HP is: " +targetUnit.GetCharacterData().GetHealthAttribute().GetModifiedValue());

        this.PerformAnimation(sourceUnit, targetUnit);
    }
    public void Perform(ControllableUnit sourceUnit, ControllableUnit targetUnit)
    {
        AttributeBonus damageOutcome = new AttributeBonus(-2, 1);

        HealthAttribute healthAttribute = targetUnit.GetCharacterData().GetHealthAttribute();

        healthAttribute.AddAttributeBonus(damageOutcome);

        Debug.Log("Normal attack skill to " + targetUnit + ". Unit new HP is: " + targetUnit.GetCharacterData().GetHealthAttribute().GetModifiedValue());


        this.PerformAnimation(sourceUnit, targetUnit);
    }
    private void CheckEquipment()
    {
        this.testRawBonuses     = this.GetComponentsInChildren <TestRawBonus>();
        this.testPercentBonuses = this.GetComponentsInChildren <TestPercentBonus>();

        foreach (TestRawBonus testRawBonus in this.testRawBonuses)
        {
            AttributeBonus attributeBonus = testRawBonus.GetAttributeBonus();

            this.attributeTable[testRawBonus.GetTargetAttribute()].AddAttributeBonus(attributeBonus);
        }

        foreach (TestPercentBonus testPercentBonus in this.testPercentBonuses)
        {
            AttributeBonusPercent attributeBonusPercent = testPercentBonus.GetAttributeBonusPercent();
            this.attributeTable[testPercentBonus.GetTargetAttribute()].AddBonusPercent(attributeBonusPercent);
        }
    }
Ejemplo n.º 5
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                hashCode += 1000000007 * Type.GetHashCode();
                hashCode += 1000000009 * Class.GetHashCode();
                hashCode += 1000000021 * Slot.GetHashCode();
                hashCode += 1000000033 * BreakRate.GetHashCode();
                hashCode += 1000000087 * Gender.GetHashCode();
                hashCode += 1000000093 * FreeHands.GetHashCode();
                hashCode += 1000000097 * LifePointsBonus.GetHashCode();
                hashCode += 1000000103 * SpellPointsBonus.GetHashCode();
                hashCode += 1000000123 * AttributeType.GetHashCode();
                hashCode += 1000000181 * AttributeBonus.GetHashCode();
                hashCode += 1000000207 * SkillTypeBonus.GetHashCode();
                hashCode += 1000000223 * SkillBonus.GetHashCode();
                hashCode += 1000000241 * PhysicalDamageProtection.GetHashCode();
                hashCode += 1000000271 * PhysicalDamageCaused.GetHashCode();
                hashCode += 1000000289 * AmmunitionType.GetHashCode();
                hashCode += 1000000297 * SkillType1Tax.GetHashCode();
                hashCode += 1000000321 * SkillType2Tax.GetHashCode();
                hashCode += 1000000349 * Skill1Tax.GetHashCode();
                hashCode += 1000000363 * Skill2Tax.GetHashCode();
                hashCode += 1000000403 * TorchIntensity.GetHashCode();
                hashCode += 1000000409 * AmmoAnimation.GetHashCode();
                hashCode += 1000000411 * Spell.GetHashCode();
                hashCode += 1000000427 * SpellID.GetHashCode();
                hashCode += 1000000433 * Charges.GetHashCode();
                hashCode += 1000000439 * NumRecharged.GetHashCode();
                hashCode += 1000000447 * MaxNumRecharged.GetHashCode();
                hashCode += 1000000453 * MaxCharges.GetHashCode();
                hashCode += 1000000459 * Count1.GetHashCode();
                hashCode += 1000000483 * Count2.GetHashCode();
                hashCode += 1000000513 * IconAnim.GetHashCode();
                hashCode += 1000000531 * Weight.GetHashCode();
                hashCode += 1000000579 * Value.GetHashCode();
                hashCode += 1000000007 * Icon.GetHashCode();
                hashCode += 1000000009 * UsingClass.GetHashCode();
                hashCode += 1000000021 * UsingRace.GetHashCode();
            }
            return(hashCode);
        }
Ejemplo n.º 6
0
    public void Remove(AttributeBonus rawBonus)
    {
        var lKey        = 0;
        var lRemoveRank = false;

        foreach (var lKeyValuePair in this.mBonusesByRank)
        {
            if (lKeyValuePair.Value.Remove(rawBonus))
            {
                // We can't remove in the enumerator
                lKey        = lKeyValuePair.Key;
                lRemoveRank = lKeyValuePair.Value.Count == 0;
                break;
            }
        }

        if (lRemoveRank)
        {
            this.mBonusesByRank.Remove(lKey);
        }
    }
Ejemplo n.º 7
0
 public void RemoveAttributeBonus(AttributeBonus attributeBonus)
 {
     this.attributeBonuses.Remove(attributeBonus);
     this.valueUpdated = true;
 }
Ejemplo n.º 8
0
 public void AddAttributeBonus(AttributeBonus attributeBonus)
 {
     this.attributeBonuses.Add(attributeBonus);
     this.valueUpdated = true;
 }
Ejemplo n.º 9
0
 public void Add(AttributeBonus rawBonus)
 {
     this.Add(rawBonus, 0);
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     this.attributeBonus = new AttributeBonus(this.value, this.multiplier);
 }