예제 #1
0
        public void Heal(float healthPoints, Character healer,
                         Character target)
        {
            FactionService factionService = new FactionService();

            if (!factionService.IsAllies(healer, target))
            {
                return;
            }

            target.SetRegeneration(healthPoints);
        }
예제 #2
0
        public void Attack(float damagePoints, Character attacker,
                           ILivingThing target)
        {
            PositionService positionService = new PositionService();
            FactionService  factionService  = new FactionService();

            if (target is Character enemy)
            {
                if (attacker.Equals(target) ||
                    !positionService.IsInRange(attacker, enemy) ||
                    factionService.IsAllies(attacker, enemy))
                {
                    return;
                }

                damagePoints *= CalculateThreshold(attacker, enemy);
            }

            target.SetDamage(damagePoints);
        }