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

            double power = 3;

            foreach (var item in items)
            {
                if (item is Tool)
                {
                    power += item.GetPower();
                    if (item is Axe)
                    {
                        power += 3;
                    }
                }
            }
            return(power);
        }
Beispiel #2
0
        public double Visit(IViking unit)
        {
            List <IItem> items = unit.GetItems();
            double       power = 2;

            //give viking extra power if he has axes and calc power
            foreach (var item in items)
            {
                if (item is IWeapon || item is IDefence)
                {
                    power += item.GetPower();
                }
                if (item is IAxe)
                {
                    power = power * 1.2;
                }
            }

            return(power);
        }