示例#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);
    }
示例#2
0
    public override ActiveSkill UseSkill()
    {
        bool atLeastOneTargetInRange = false;

        IEnumerable <Attackable> targets = TargetingFunction.DetectSurroundings(this, _massHeal.IsValidTarget).Cast <Attackable>();

        foreach (Attackable target in targets)
        {
            bool targetInRange = _massHeal.IsUsable(this, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (_massHeal.Cooldown <= 0 && target.MaxHp - target.Hp > _massHeal.heal)
                {
                    foreach (Attackable ally in targets)
                    {
                        bool IsInAoe = Vector3.Distance(ally.transform.position, target.transform.position) < _massHeal.aoe;
                        if (IsInAoe)
                        {
                            _massHeal.ApplyOnTarget(target);
                        }
                    }
                    _massHeal.Cooldown = 1.0f;
                    return(_massHeal);
                }
            }
        }

        return(TargetingFunction.UseAttack(this, _attack));
    }
示例#3
0
    public override void OnTick(Targetable target)
    {
        IEnumerable <Targetable> targetables = TargetingFunction.DetectSurroundings(_caster, IsValidTarget);

        foreach (Targetable t in targetables)
        {
            if (IsValidTarget(target))
            {
                _caster.AddEffect(_effect);
            }
        }
    }
示例#4
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));
    }
示例#5
0
    public static ActiveSkill UseAttack(Unit attacker, Attack attack)
    {
        bool atLeastOneTargetInRange = false;

        IEnumerable <Attackable> targets = TargetingFunction.DetectSurroundings(attacker, attack.IsValidTarget).Cast <Attackable>();

        foreach (Attackable target in targets)
        {
            bool targetInRange = attack.IsUsable(attacker, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (attack.Cooldown <= 0)
                {
                    attack.ApplyOnTarget(target);
                    attack.Cooldown = 1.0f;
                    return(attack);
                }
            }
        }

        return(null);
    }
示例#6
0
    public override ActiveSkill UseSkill()
    {
        bool atLeastOneTargetInRange = false;

        IEnumerable <Attackable> targets = TargetingFunction.DetectSurroundings(this, _heal.IsValidTarget).Cast <Attackable>();

        foreach (Attackable target in targets)
        {
            bool targetInRange = _heal.IsUsable(this, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (_heal.Cooldown <= 0 && target.MaxHp - target.Hp > _heal.heal)
                {
                    _heal.ApplyOnTarget(target);
                    _heal.Cooldown = 1.0f;
                    return(_heal);
                }
            }
        }

        return(TargetingFunction.UseAttack(this, _attack));
    }
示例#7
0
    public static bool UseAttack(Unit attacker, Attack attack)
    {
        bool atLeastOneTargetInRange = false;

        List <Attackable> targets = TargetingFunction.DetectSurroundings(attacker, attack.isValidTarget);

        foreach (Attackable target in targets)
        {
            bool targetInRange = attack.IsUsable(attacker, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (attack.cooldown <= 0)
                {
                    attack.ApplyOnTarget(target);
                    attack.cooldown = 1.0f;
                    return(true);
                }
            }
        }

        return(atLeastOneTargetInRange);
    }
示例#8
0
    public override bool UseSkill()
    {
        bool atLeastOneTargetInRange = false;

        List <Attackable> targets = TargetingFunction.DetectSurroundings(this, heal.isValidTarget);

        foreach (Attackable target in targets)
        {
            bool targetInRange = heal.IsUsable(this, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (heal.cooldown <= 0 && target.MaxHp - target.Hp > heal.heal)
                {
                    heal.ApplyOnTarget(target);
                    heal.cooldown = 1.0f;
                    return(true);
                }
            }
        }

        return(TargetingFunction.UseAttack(this, attack));
    }