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

            character.RecieveItem(item);
        }
        public void UseItemOn(Item item, Character character)
        {
            this.EnsureAlive();
            character.EnsureAlive();

            item.AffectCharacter(character);
        }
Пример #3
0
        public void Heal(Character character)
        {
            this.EnsureAlive();
            character.EnsureAlive();

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

            character.Health += this.AbilityPoints;
        }
Пример #4
0
        public void Heal(Character character)
        {
            base.EnsureAlive();
            character.EnsureAlive();

            if (base.Faction != character.Faction)
            {
                throw new InvalidOperationException(HealingEnemyCharacterExceptionMessage);
            }

            character.Health += base.AbilityPoints;
        }
        public void Attack(Character character)
        {
            this.EnsureAlive();
            character.EnsureAlive();

            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.ToString()} faction!");
            }

            character.TakeDamage(this.AbilityPoints);
        }
        public void Attack(Character character)
        {
            base.EnsureAlive();
            character.EnsureAlive();

            if (this == character)
            {
                throw new InvalidOperationException(AttackSelfExceptionMessage);
            }

            if (base.Faction == character.Faction)
            {
                throw new ArgumentException(string.Format(
                                                FriendlyFireExceptionMessage,
                                                base.Faction));
            }

            character.TakeDamage(base.AbilityPoints);
        }