Esempio n. 1
0
        public ForgedWeapon(ForgedWeapon weapon, IMaterialComponent component)
        {
            ComponentName         = string.Format("{0}, {1}", weapon.ComponentName, component.ComponentName);
            GivenName             = weapon.GivenName;
            WeaponName            = string.Format("{0} {1}", component.ComponentName, weapon.WeaponName);
            Proficiency           = weapon.Proficiency;
            WeaponCategory        = weapon.WeaponCategory;
            WeaponSubCategory     = weapon.WeaponSubCategory;
            WeaponUse             = weapon.WeaponUse;
            Damage                = weapon.Damage;
            CriticalDamage        = weapon.CriticalDamage;
            DamageType            = weapon.DamageType;
            MaxRange              = weapon.MaxRange;
            RangeIncrement        = weapon.RangeIncrement;
            ThreatRange           = weapon.ThreatRange;
            ThreatRangeLowerBound = weapon.ThreatRangeLowerBound;
            WeaponSize            = weapon.WeaponSize;
            Hardness              = weapon.Hardness;
            HitPoints             = weapon.HitPoints;

            WeaponCost = component.ApplyCostModifier(weapon);
            AdditionalEnchantmentCost = weapon.AdditionalEnchantmentCost;
            ToHitModifier             = component.ApplyToHitModifier();
            DamageBonus  = weapon.DamageBonus;
            Weight       = component.ApplyWeightModifer(weapon);
            SpecialInfo  = component.AppendSpecialInfo(weapon);
            IsMasterwork = component.VerifyMasterwork(weapon);
        }
Esempio n. 2
0
 public void TestForgedAlchemicalSilverWeapon()
 {
     var dagger = new PhbWeapon("Dagger");
     var silver = new AlchemicalSilver();
     var forgedDagger = new ForgedWeapon(dagger, silver);
     Approvals.Verify(forgedDagger.ToString());
 }
Esempio n. 3
0
        public ForgedWeapon(ForgedWeapon weapon, IMaterialComponent component)
        {
            ComponentName = string.Format("{0}, {1}",weapon.ComponentName, component.ComponentName);
            GivenName = weapon.GivenName;
            WeaponName = string.Format("{0} {1}", component.ComponentName, weapon.WeaponName);
            Proficiency = weapon.Proficiency;
            WeaponCategory = weapon.WeaponCategory;
            WeaponSubCategory = weapon.WeaponSubCategory;
            WeaponUse = weapon.WeaponUse;
            Damage = weapon.Damage;
            CriticalDamage = weapon.CriticalDamage;
            DamageType = weapon.DamageType;
            MaxRange = weapon.MaxRange;
            RangeIncrement = weapon.RangeIncrement;
            ThreatRange = weapon.ThreatRange;
            ThreatRangeLowerBound = weapon.ThreatRangeLowerBound;
            WeaponSize = weapon.WeaponSize;
            Hardness = weapon.Hardness;
            HitPoints = weapon.HitPoints;

            WeaponCost = component.ApplyCostModifier(weapon);
            AdditionalEnchantmentCost = weapon.AdditionalEnchantmentCost;
            ToHitModifier = component.ApplyToHitModifier();
            DamageBonus = weapon.DamageBonus;
            Weight = component.ApplyWeightModifer(weapon);
            SpecialInfo = component.AppendSpecialInfo(weapon);
            IsMasterwork = component.VerifyMasterwork(weapon);
        }
Esempio n. 4
0
 public void TestForgeColdIronWeapon()
 {
     var dagger = new PhbWeapon("Dagger");
     var coldIron = new ColdIron();
     var forgedDagger = new ForgedWeapon(dagger, coldIron);
     forgedDagger.NameWeapon("Krus Hakhar");
     Approvals.Verify(forgedDagger.ToString());
 }
        public PlusEnhancedWeapon(IWeapon weapon, double plusEnhancement)
        {
            forgedWeapon        = QualifyWeapon(weapon);
            PlusEnhancement     = ValidatePlusEnhancement(plusEnhancement);
            BaseEnhancementCost = PlusEnhancement;

            BaseItemCost = forgedWeapon.WeaponCost;

            GivenName                 = forgedWeapon.GivenName;
            WeaponName                = TrimMasterworkFromName();
            ComponentName             = forgedWeapon.ComponentName;
            Proficiency               = forgedWeapon.Proficiency;
            WeaponUse                 = forgedWeapon.WeaponUse;
            WeaponCategory            = forgedWeapon.WeaponCategory;
            WeaponSubCategory         = forgedWeapon.WeaponSubCategory;
            WeaponSize                = forgedWeapon.WeaponSize;
            AdditionalEnchantmentCost = forgedWeapon.AdditionalEnchantmentCost;
            WeaponCost                = forgedWeapon.WeaponCost;
            ToHitModifier             = string.Format("+{0}", PlusEnhancement);
            Damage                = forgedWeapon.Damage;
            DamageBonus           = forgedWeapon.DamageBonus;
            ThreatRangeLowerBound = forgedWeapon.ThreatRangeLowerBound;
            ThreatRange           = forgedWeapon.ThreatRange;
            CriticalDamage        = forgedWeapon.CriticalDamage;
            RangeIncrement        = forgedWeapon.RangeIncrement;
            MaxRange              = forgedWeapon.MaxRange;
            DamageType            = forgedWeapon.DamageType;
            Weight                = forgedWeapon.Weight;
            Hardness              = CalculateHardness();
            HitPoints             = CalculateHitPoints();
            SpecialInfo           = forgedWeapon.SpecialInfo;
            IsMasterwork          = forgedWeapon.IsMasterwork;
            IsBow = forgedWeapon.IsBow;

            // Creation
            MinimumCasterLevel = PlusEnhancement;
            TotalCost          = CalculateWeaponCost();
        }
Esempio n. 6
0
 public void TestForgeMithralWeapon()
 {
     var dagger = new PhbWeapon("Dagger");
     var mithral = new Mithral();
     var forgedDagger = new ForgedWeapon(dagger, mithral);
     forgedDagger.NameWeapon("Carlyle's Special Greeting");
     Approvals.Verify(forgedDagger.ToString());
 }
Esempio n. 7
0
 public void TestMasterworkColdIronWeapon()
 {
     var dagger = new PhbWeapon("Dagger");
     var coldIron = new ColdIron();
     var forgedDagger = new ForgedWeapon(dagger, coldIron);
     var masterwork = new Masterwork();
     var masterworkColdIronDagger = new ForgedWeapon(forgedDagger, masterwork);
     Approvals.Verify(masterworkColdIronDagger.ToString());
 }
Esempio n. 8
0
 public void TestMasterworkAlchemicalSilverWeapon()
 {
     var dagger = new PhbWeapon("Dagger");
     var silver = new AlchemicalSilver();
     var forgedDagger = new ForgedWeapon(dagger, silver);
     var masterwork = new Masterwork();
     var masterworkSilverDagger = new ForgedWeapon(forgedDagger, masterwork);
     Approvals.Verify(masterworkSilverDagger.ToString());
 }
Esempio n. 9
0
        public void TestBlah()
        {
            var dagger = new PhbWeapon("Dagger");
            var forgedDagger = new ForgedWeapon(new ForgedWeapon(dagger, new ColdIron()), new Masterwork());
            var distance = new WeaponEnchantment("Distance");
            var anarchic = new WeaponEnchantment("Anarchic");
            var keen = new WeaponEnchantment("Keen");
            var flameBurst = new WeaponEnchantment("Flaming Burst");
            //var flameBurst1 = new WeaponEnchantment("Flaming Burst");
            //var flameBurst2 = new WeaponEnchantment("Flaming Burst");
            var plusEnhancement = 4;
            List<WeaponEnchantment> enchantmentClump = new List<WeaponEnchantment>();
            enchantmentClump.Add(distance);
            enchantmentClump.Add(anarchic);
            enchantmentClump.Add(keen);
            enchantmentClump.Add(flameBurst);
            //enchantmentClump.Add(flameBurst1);
            //enchantmentClump.Add(flameBurst2);

            //var enchantmentTotals = from clump in enchantmentClump
            //                        select clump.CostModifier;

            var enchantmentTotals = enchantmentClump.Select(c => c.CostModifier).ToList();

            //var totalEnchantmentModifier = enchantmentTotals.ToList();
            enchantmentTotals.Add(plusEnhancement);

            var enchantmentTotal = enchantmentTotals.Sum();

            var prefixes = from clump in enchantmentClump
                           where clump.Affix.Contains("Pre")
                           select clump;

            var prefixCount = prefixes.Count();

            var suffixes = from clump in enchantmentClump
                           where clump.Affix.Contains("Suf")
                           select clump;

            var suffixCount = suffixes.Count();

            var casterLevels = from clump in enchantmentClump
                               select clump.MinimumCasterLevel;

            var highestCasterLevel = casterLevels.ToList();
            highestCasterLevel.Add((plusEnhancement * 3));

            var criticalDamage = from clump in enchantmentClump
                                 where clump.DoesCriticalDamage == true
                                 select clump;

            var critCount = criticalDamage.Count();

            var rangeMod = from clump in enchantmentClump
                           where clump.RangeIncrementModifier != 1
                           select clump.RangeIncrementModifier;
            double greatestRangeIncrease = rangeMod.Max();

            var sb = new StringBuilder();

            sb.Append(string.Format("+{0} ", plusEnhancement));

            foreach (var prefix in prefixes)
            {
                if (prefixCount > 1)
                {
                    sb.Append(string.Format("{0} (+{1} bonus)", prefix.EnchantmentName, prefix.CostModifier));
                    sb.Append(", ");
                    prefixCount--;
                }
                else
                {
                    sb.Append(string.Format("{0} (+{1} bonus)", prefix.EnchantmentName, prefix.CostModifier));
                }

            }

            sb.Append(string.Format(" {0}", forgedDagger.WeaponName));

            foreach (var suffix in suffixes)
            {

                while (suffixCount > 0)
                {
                    sb.Append(" of ");
                    sb.Append(string.Format("{0} (+{1} bonus)", suffix.EnchantmentName, suffix.CostModifier));
                    suffixCount--;
                }

            }

            var critSb = new StringBuilder();

            foreach (var critDie in criticalDamage)
            {
                while (critCount > 0)
                {
                    string critDice = string.Empty;
                    if (forgedDagger.CriticalDamage == "x2")
                    {
                        critDice = "1d10";
                    }
                    else if (forgedDagger.CriticalDamage == "x3")
                    {
                        critDice = "2d10";
                    }
                    else
                    {
                        critDice = "3d10";
                    }
                    critSb.Append(string.Format(" '+{0} ({1})'", critDice, critDie.DamageType));

                    critCount--;
                }
            }

            sb.Append(string.Format("{0}Total enchantment modifier: '{1}'", Environment.NewLine, enchantmentTotal));
            sb.Append(string.Format("{0}Total enhancement cost: '{1}'", Environment.NewLine, ((Math.Pow(enchantmentTotal, 2) * 2000) + forgedDagger.WeaponCost + forgedDagger.AdditionalEnchantmentCost)));
            sb.Append(string.Format("{0}Required caster level: {1}", Environment.NewLine, highestCasterLevel.Max()));
            sb.Append(string.Format("{0}Critical damage dice:{1}", Environment.NewLine, critSb));
            sb.Append(string.Format("{0}Range increment: {1} feet for {2} (was {3} feet for {4} feet)", Environment.NewLine, (forgedDagger.RangeIncrement * greatestRangeIncrease), (dagger.MaxRange * greatestRangeIncrease), dagger.RangeIncrement, dagger.MaxRange));

            Approvals.Verify(sb.ToString());
        }
Esempio n. 10
0
 public void TestPlusEnhancementWeapon()
 {
     // A weapon must be masterwork before it can be magical.
     // A magic weapon:
     //		Has a plus enhancement from 1 to 5
     //		Adds the plus enhancement to attack and damage
     //		Has a cost that is: Square the plus enhancement and then multiply by 2
     //		Adjusts the hardness and hit points based on plus modifier
     //		Must be a plus 1 before any special qualities can be added
     //		... more here to add
     //		PhbWeapon => ForgedWeapon => PlusWeapon => EnchantedWeapon
     var weaopn = new PhbWeapon("Dagger");
     weaopn.NameWeapon("My Magic Friend!");
     var silver = new AlchemicalSilver();
     var forgedWeapon = new ForgedWeapon(weaopn, silver);
     var plusWeapon = new PlusEnhancedWeapon(forgedWeapon, 1);
     plusWeapon.EnableLightGeneration();
     Approvals.Verify(plusWeapon.ToString());
 }