Example #1
0
    public override ActiveSkill UseSkill()
    {
        if (BuilderHelper.GetBuilderById(this.CreatorId) is HalfOnesBuilder)
        {
            if (TargetingFunction.IsInRangeorMelee(this, CastleHelper.GetCastle(Allegiance), _range))
            {
                _harvest.Deliver();
            }
            else if (_harvest.IsFull)
            {
                return(null);
            }
            else
            {
                bool atLeastOneTargetInRange = false;

                IEnumerable <Corpse> targets = TargetingFunction.DetectSurroundings(this, _harvest.IsValidTarget).Cast <Corpse>();

                foreach (Corpse target in targets)
                {
                    bool targetInRange = TargetingFunction.IsInRangeorMelee(this, target, _harvest.Range);
                    atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
                    if (targetInRange)
                    {
                        _harvest.ApplyOnTarget(target);
                        return(_harvest);
                    }
                }
            }
        }
        return(null);
    }
Example #2
0
 protected bool CheckForBreak()
 {
     if (!TargetingFunction.IsInRangeorMelee(Caster, _target, this.Range) || !IsValidTarget(_target))
     {
         Break();
         return(true);
     }
     return(false);
 }
Example #3
0
    public override ActiveSkill UseSkill()
    {
        bool atLeastOneTargetInRange = false;

        IEnumerable <Corpse> targets = TargetingFunction.DetectSurroundings(this, _infest.IsValidTarget).Cast <Corpse>();

        foreach (Corpse target in targets)
        {
            bool targetInRange = TargetingFunction.IsInRangeorMelee(this, target, _infest.Range);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (target.DecompositionTime > _infest.BaseExecutionTime)
                {
                    _infest.ApplyOnTarget(target);
                    return(_infest);
                }
            }
        }

        return(TargetingFunction.UseAttack(this, _attack));
    }
Example #4
0
 public bool IsUsable(Attackable attacker, Attackable target)
 {
     return((IsMelee(attacker, target) || TargetingFunction.IsInRangeorMelee(attacker, target, Range)) && IsValidTarget(target));
 }