Exemplo n.º 1
0
        public void UseItemOn(Item item, Character character)
        {
            this.CheckAlive();
            character.CheckAlive();

            item.AffectCharacter(character);
        }
Exemplo n.º 2
0
        public void GiveCharacterItem(Item item, Character character)
        {
            this.CheckAlive();
            character.CheckAlive();

            character.ReceiveItem(item);
        }
Exemplo n.º 3
0
        public void Heal(Character character)
        {
            this.CheckAlive();
            character.CheckAlive();

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

            character.IncreaseHealth(this.AbilityPoints);
        }
Exemplo n.º 4
0
        public void Attack(Character character)
        {
            this.CheckAlive();
            character.CheckAlive();

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