Exemple #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);
    }