Exemple #1
0
        public void TestRangedWeaponAttack()
        {
            RangedWeapon longBow = new RangedWeapon()
            {
                Name           = "Longbow"
                , WeaponType   = "Martial Ranged",
                AmmunitionType = "Arrow",
                CloseRange     = 150,
                MaxRange       = 600,
                Cost           = new CoinPurse()
                {
                    Gold = 50
                },
                Weight     = 2,
                Properties = new [] { "heavy", "two-handed" }
            };

            longBow.WeaponDamages.Add(new Damage()
            {
                DefaultDamage  = 4,
                QuantityOfDice = 2,
                SidesOfDice    = 8,
                DamageType     = "piercing"
            });
            Ammunition basicArrows = new Ammunition()
            {
                AmmunitionType = "Arrow",
                Name           = "Basic Arrows",
                Quantity       = 20
            };
            DamageRealized attack = longBow.WeaponHit(ref basicArrows);

            Console.WriteLine(attack.DamageDescription);
            Assert.AreEqual(19, basicArrows.Quantity);
        }
Exemple #2
0
        public void TestWeaponDamage()
        {
            Weapon shortSword = new Weapon
            {
                Name       = "Short Sword",
                WeaponType = "Martial Melee",
                Weight     = 2,
                Cost       = new CoinPurse()
                {
                    Gold = 10
                },
                Properties = new [] { "Finesse", "light" }
            };

            shortSword.WeaponDamages.Add(new Damage()
            {
                DamageType     = "piercing",
                DefaultDamage  = 3,
                QuantityOfDice = 1,
                SidesOfDice    = 6
            });

            DamageRealized attack = shortSword.WeaponHit();

            Console.WriteLine(attack.DamageDescription);
        }
Exemple #3
0
        public void TestAttack()
        {
            Character talen = new Character(10, 17, 13, 15, 12, 8)
            {
                Alignment        = "Neutral",
                Name             = "Talen Il'Marin",
                ArmorClass       = 15,
                Class            = "Ranger: Horizon Walker",
                HitPoints        = 39,
                CurrentHitPoints = 39,
                Race             = "High Elf",
                ProficiencyBonus = 3,
                Speed            = 30,
                ExperiencePoints = 6500
            };
            RangedWeapon longBow = new RangedWeapon()
            {
                Name = "Longbow"
                ,
                WeaponType     = "Martial Ranged",
                AmmunitionType = "Arrow",
                CloseRange     = 150,
                MaxRange       = 600,
                Cost           = new CoinPurse()
                {
                    Gold = 50
                },
                Weight     = 2,
                Properties = new[] { "heavy", "two-handed" }
            };

            longBow.WeaponDamages.Add(new Damage()
            {
                DefaultDamage  = 4,
                QuantityOfDice = 1,
                SidesOfDice    = 8,
                DamageType     = "Piercing"
            });
            Ammunition arrows = new Ammunition()
            {
                AmmunitionType = "Arrow", Name = "Special Arrow", Quantity = 20
            };

            arrows.Damages.Add(new Damage()
            {
                DamageType     = "force",
                QuantityOfDice = 1,
                SidesOfDice    = 8
            });
            talen.Weapons.Add(longBow);
            talen.Ammunition.Add(arrows);
            var            ammo   = talen.Ammunition.ElementAt(0);
            DamageRealized attack = ((RangedWeapon)talen.Weapons.ElementAt(0)).WeaponHit(ref ammo);

            Console.WriteLine(attack.DamageDescription);
        }
Exemple #4
0
        public DamageRealized WeaponHit()
        {
            DamageRealized result = new DamageRealized();

            foreach (var weaponDamage in WeaponDamages)
            {
                result.Damages.Add(weaponDamage);
            }
            result.ResolveDamage();
            return(result);
        }
Exemple #5
0
        public DamageRealized  WeaponHit(ref Ammunition ammo)
        {
            ammo.Quantity -= 1;
            DamageRealized result = new DamageRealized();

            foreach (var weaponDamage in WeaponDamages)
            {
                result.Damages.Add(weaponDamage);
            }
            foreach (var ammoDamage in ammo.Damages)
            {
                result.Damages.Add(ammoDamage);
            }
            result.ResolveDamage();
            return(result);
        }