public void GiveCharacterItem(Item item, Character character)
        {
            this.AliveCheck();
            character.AliveCheck();

            character.Bag.AddItem(item);
        }
        public void UseItemOn(Item item, Character character)
        {
            this.AliveCheck();
            character.AliveCheck();

            item.AffectCharacter(character);
        }
Beispiel #3
0
        public void Heal(Character character)
        {
            this.AliveCheck();
            character.AliveCheck();

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

            character.Health += this.AbilityPoints;

            if (character.Health >= character.BaseHealth)
            {
                character.Health = character.BaseHealth;
            }
        }
        public void Attack(Character character)
        {
            this.AliveCheck();
            character.AliveCheck();

            if (character == this)
            {
                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);
        }