Esempio n. 1
0
        public override void Hurt(Creature whoToHurt)
        {
            if (whoToHurt == null)
            {
                throw new ArgumentNullException(nameof(whoToHurt));
            }

            if (CurrentItem.GetType() == typeof(Weapon))
            {
                if (whoToHurt.GetDamage(((Weapon)CurrentItem).Damage) <= 0)
                {
                    Heal(20);

                    Inventory.Items.Concat(LootController.GetCreatureLoot(whoToHurt));

                    KilledTheCreatureEventArgs args = new KilledTheCreatureEventArgs(whoToHurt);
                    OnKilledTheCreature(args);
                }
            }
            else
            {
                if (whoToHurt.GetDamage(1) <= 0)
                {
                    Heal(25);

                    Inventory.Items.Concat(LootController.GetCreatureLoot(whoToHurt));

                    KilledTheCreatureEventArgs args = new KilledTheCreatureEventArgs(whoToHurt);
                    OnKilledTheCreature(args);
                }
            }
        }
Esempio n. 2
0
        protected virtual void OnKilledTheCreature(KilledTheCreatureEventArgs e)
        {
            EventHandler <KilledTheCreatureEventArgs> handler = KilledTheCreature;

            if (handler != null)
            {
                handler(this, e);
            }
        }