Ejemplo n.º 1
0
    // Consolidates enchants
    public void ConsolidateEnchants()
    {
        Enchant a = null;
        Enchant b = null;

        for (int i = 0; i < maxEnchants; i++)
        {
            for (int j = 0; j < maxEnchants; j++)
            {
                a = enchants[i];
                b = enchants[j];

                if (i != j)
                {
                    if ((a.GetEnchantName() == b.GetEnchantName() && (!a.consolidated && !b.consolidated)) ||
                        (a.GetEnchantName() == b.GetEnchantName() && (!a.consolidated && b.consolidated && !b.rejected)) ||
                        (a.GetEnchantName() == b.GetEnchantName() && (a.consolidated && !b.consolidated && !a.rejected)))
                    {
                        if (b.consolidated)
                        {
                            enchants[j].SetBonusStatText((a.power + b.power).ToString() + " " + a.GetEnchantName());
                            enchants[j].power        = a.power + b.power;
                            enchants[j].consolidated = true;
                            enchants[i].power        = 0;
                            enchants[i].consolidated = true;
                            enchants[i].SetBonusStatText("");
                            enchants[i].rejected = true;
                        }
                        else
                        {
                            enchants[i].SetBonusStatText((a.power + b.power).ToString() + " " + a.GetEnchantName());
                            enchants[i].power        = a.power + b.power;
                            enchants[i].consolidated = true;
                            enchants[j].power        = 0;
                            enchants[j].consolidated = true;
                            enchants[j].SetBonusStatText("");
                            enchants[j].rejected = true;
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    // Apply the enchants to the name
    public void SetEnchantedName()
    {
        // If there are no damage enchants, only put the first enchants name
        if (type_Damage == 0)
        {
            itemName = itemName + " Of " + enchants[0].GetEnchantName();
        }
        // If there is only one damage enchant, Set the damage enchant, and then the first other stats name if not damage
        else if (type_Damage == 1)
        {
            foreach (Enchant e in enchants)
            {
                if (e.type == Enchant.EnchantTypes.Damage_T1 || e.type == Enchant.EnchantTypes.Damage_T2 || e.type == Enchant.EnchantTypes.Damage_T3)
                {
                    itemName = itemName + " Of " + e.GetEnchantName(true) + " " + enchants[0].GetEnchantName();
                }
            }
        }
        else if (type_Damage == 2)
        {
            Enchant first  = null;
            Enchant second = null;

            foreach (Enchant e in enchants)
            {
                if (e.type == Enchant.EnchantTypes.Damage_T1 || e.type == Enchant.EnchantTypes.Damage_T2 || e.type == Enchant.EnchantTypes.Damage_T3)
                {
                    second = e;
                }
            }

            foreach (Enchant e in enchants)
            {
                if (e.type == Enchant.EnchantTypes.Damage_T1 || e.type == Enchant.EnchantTypes.Damage_T2 || e.type == Enchant.EnchantTypes.Damage_T3)
                {
                    if (second != e)
                    {
                        first = e;
                    }
                }
            }

            itemName = itemName + " Of " + first.GetEnchantName(true) + " " + second.GetEnchantName();
        }
    }