Esempio n. 1
0
        public void GiveCharacterItem(Item item, Character character)
        {
            CheckIfAlive();
            character.CheckIfAlive();

            character.ReceiveItem(item);
        }
Esempio n. 2
0
        public void Heal(Character character)
        {
            this.CheckIfAlive();
            character.CheckIfAlive();

            if (this.Faction != character.Faction)
            {
                throw new InvalidOperationException("Cannot heal enemy character!");
            }

            character.IncreaseHealth(this.AbilityPoints);
        }
Esempio n. 3
0
        public void Attack(Character character)
        {
            base.CheckIfAlive();

            character.CheckIfAlive();
            if (this.Name == character.Name)
            {
                throw new InvalidOperationException("Cannot attack self!");
            }

            if (this.Faction == character.Faction)
            {
                throw new ArgumentException($"Friendly fire! Both characters are from {this.Faction} faction!");
            }

            character.TakeDamage(this.AbilityPoints);
        }
Esempio n. 4
0
 public void UseItemOn(Item item, Character character)
 {
     CheckIfAlive();
     character.CheckIfAlive();
     item.AffectCharacter(character);
 }