예제 #1
0
        public override MagicArmorAndShield Create(Enums.ItemQuality quality)
        {
            //1. Roll pour avoir l'alteration
            AbstractArmorAndShieldsTableLine secondRoll;

            do
            {
                int alteration = MagicItemCreation.Instance.Dices.d100();

                secondRoll = ArmorCreation.ArmorAndShieldsTable.GetLineFromDice(alteration, quality);
            } while (secondRoll.GetType() != typeof(ArmorTableLine) &&
                     secondRoll.GetType() != typeof(ShieldTableLine));   //On reroll tant qu'on a pas trouvé une ligne qu'on peut utiliser en tant que deuxième roll (si Create existe c'est un cas spécial et donc on ne peut pas l'utiliser)

            MagicArmorAndShield baseArmorAndShield = new MagicArmorAndShield(quality);

            //On ne devrait pas avoir de cas speciaux au deuxieme roll
            baseArmorAndShield.AlterationBonus = secondRoll.AlterationBonus;
            baseArmorAndShield.Type            = (secondRoll.GetType() == typeof(ArmorTableLine)) ? ItemType.Armor : ItemType.Shield;

            //2. Ajout de capa speciale
            //Roll sur la table des capa melee
            int capa = MagicItemCreation.Instance.Dices.d100();
            ArmorAndShieldSpecialAbilitiesTableLine ligne;

            if (baseArmorAndShield.Type == Enums.ItemType.Armor)
            {
                ligne = ArmorSpecialAbilitiesTable.GetLineFromDice(capa, quality);
            }
            else
            {
                ligne = ShieldSpecialAbilitiesTable.GetLineFromDice(capa, quality);
            }

            if (ligne.Modify != null) //Cas speciaux on appelle la fonction pour modifier
            {
                ligne.Modify(baseArmorAndShield);
            }
            else //Sinon on modifie a la main
            {
                baseArmorAndShield.Abilities = new List <String> {
                    ligne.Name
                };
                baseArmorAndShield.BasePriceModifier      = ligne.BasePriceModifier;
                baseArmorAndShield.BaseAlterationModifier = ligne.BaseAlterationModifier;
            }

            //3. On trouve le prix
            baseArmorAndShield.Price  = ArmorCreation.ArmorAndShieldsTable.GetLineFromAlterationBonus(baseArmorAndShield.AlterationBonus + baseArmorAndShield.BaseAlterationModifier).Price;
            baseArmorAndShield.Price += baseArmorAndShield.BasePriceModifier;

            return(baseArmorAndShield);
        }
예제 #2
0
        private static void RollArmorAbilityTwice(MagicArmorAndShield baseArmorAndShield)
        {
            int abilityRoll = MagicItemCreation.Instance.Dices.d100();

            ArmorAndShieldSpecialAbilitiesTableLine firstAbility = ArmorSpecialAbilitiesTable.GetLineFromDice(abilityRoll, baseArmorAndShield.Quality);

            if (baseArmorAndShield.Abilities == null)
            {
                baseArmorAndShield.Abilities = new List <String>();
            }

            baseArmorAndShield.Abilities.Add(firstAbility.Name);
            baseArmorAndShield.BasePriceModifier      = firstAbility.BaseAlterationModifier;
            baseArmorAndShield.BaseAlterationModifier = firstAbility.BaseAlterationModifier;

            ArmorAndShieldSpecialAbilitiesTableLine secondAbility;

            do
            {
                abilityRoll = MagicItemCreation.Instance.Dices.d100();

                secondAbility = ArmorSpecialAbilitiesTable.GetLineFromDice(abilityRoll, baseArmorAndShield.Quality);
            } while (secondAbility.Modify != null || //On reroll tant qu'on tombe sur un cas particulier
                     (baseArmorAndShield.AlterationBonus + firstAbility.BaseAlterationModifier + secondAbility.BaseAlterationModifier) > 10);    //ou encore que le total des alterations dépasse +10

            if (secondAbility == firstAbility)
            {
                return;
            }

            if (secondAbility.IsABetterVersionOf(firstAbility.Name))
            {
                baseArmorAndShield.Abilities.Remove(firstAbility.Name);
                baseArmorAndShield.Abilities.Add(secondAbility.Name);
                baseArmorAndShield.BasePriceModifier      = secondAbility.BasePriceModifier;
                baseArmorAndShield.BaseAlterationModifier = secondAbility.BaseAlterationModifier;
            }
            else
            {
                baseArmorAndShield.Abilities.Add(secondAbility.Name);
                baseArmorAndShield.BasePriceModifier      += secondAbility.BasePriceModifier;
                baseArmorAndShield.BaseAlterationModifier += secondAbility.BaseAlterationModifier;
            }
        }