Beispiel #1
0
        public double Visit(IRomanSoldier unit)
        {
            List <IItem> items = unit.GetItems();

            double power         = 2;
            bool   onespear      = false;
            bool   onesBigShield = false;

            //check for spear and shield and calc power
            foreach (var item in items)
            {
                if (item is IWeapon || item is IDefence)
                {
                    power += item.GetPower();
                }

                if (item is Spear)
                {
                    onespear = true;
                }
                if (item is BigSheld)
                {
                    onesBigShield = true;
                }
            }

            //give ekstra power if one BigSheild and spear present
            if (onesBigShield && onespear)
            {
                power = power * 1.5;
            }

            return(power);
        }
Beispiel #2
0
        public double Visit(IRomanSoldier unit)
        {
            List <IItem> items = unit.GetItems();

            double power = 2;

            foreach (var item in items)
            {
                if (item is Tool)
                {
                    power += item.GetPower();
                }
            }
            return(power);
        }