Example #1
0
    new private void Start()
    {
        base.Start();

        //Offensive bonuses

        _faithBonus = new FaithBonus(BuilderHelper.GetBuilderById(CreatorId), 100f, 0.5f);

        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>
        {
            _faithBonus,
        };

        //Defensive bonuses
        _block = new Block(10f, 1f);

        defensiveModifiers.Add(_block);

        _attack = new Attack(0, 1.0f, this, 10, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Modifiers = modifiers
        };

        Skills = new[] { _attack };
    }
Example #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));
    }
Example #3
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 #4
0
    new private void Start()
    {
        base.Start();

        attack  = new Attack(0.5f, 1, 0, 1.0f, 10, (Attackable attackable) => TargetingFunction.IsEnemy(this, attackable));
        _skills = new[] { attack };
    }
Example #5
0
 public override Targetable MoveTarget()
 {
     if (_harvest.IsFull)
     {
         return(CastleHelper.GetCastle(Allegiance));
     }
     return(TargetingFunction.GetClosestTarget(this, CastleHelper.GetCastle(Allegiance), TargetingFunction.IsCorpse, DetectionRange * DetectionRange));
 }
Example #6
0
 protected bool CheckForBreak()
 {
     if (!TargetingFunction.IsInRangeorMelee(Caster, _target, this.Range) || !IsValidTarget(_target))
     {
         Break();
         return(true);
     }
     return(false);
 }
Example #7
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);
            }
        }
    }
Example #8
0
    new private void Start()
    {
        base.Start();

        attack = new Attack(0, 1.0f, this, 10, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Effects = new List <Effect> {
                new FaithKill(new ResourceFaith(1), BuilderHelper.GetBuilderById(this.CreatorId), TargetingFunction.IsUnit)
            }
        };
        Skills = new[] { attack };
    }
Example #9
0
    new private void Start()
    {
        base.Start();

        _attack = new Attack(150, 1.0f, this, 14, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable));
        _heal   = new Heal(240, 1.0f, 0.2f, this, 60f, (Targetable attackable) => TargetingFunction.IsAllyUnit(this, attackable));

        Skills = new Skill[]
        {
            _attack,
            _heal
        };
    }
Example #10
0
    new private void Start()
    {
        base.Start();

        attack = new Attack(0.5f, 1, 150, 1.0f, 14, (Attackable attackable) => TargetingFunction.IsEnemy(this, attackable));
        heal   = new Heal(0f, 0.125f, 240, 1.0f, 60f, (Attackable attackable) => TargetingFunction.IsAlly(this, attackable));

        _skills = new Skill[]
        {
            attack,
            heal
        };
    }
Example #11
0
    new private void Start()
    {
        base.Start();
        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>();

        CriticalHit criticalHit = new CriticalHit(0.2f, 2.0f);

        modifiers.Add(criticalHit);
        _attack = new Attack(0, 1.0f, this, 45, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Modifiers = modifiers
        };

        Skills = new[] { _attack };
    }
Example #12
0
    new private void Start()
    {
        base.Start();
        _infest = new Infest(0, 0, 2.5f, this, 0.3f, TargetingFunction.IsCorpse);
        _attack = new Attack(0, 1.0f / 0.8f, this, 12, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Effects = new List <Effect> {
                new Neurotoxin(0.2f, 0.2f, 1, (Targetable attackable) => TargetingFunction.IsEnemyUnit(this, attackable))
                {
                    Duration = 3
                }
            }
        };

        Skills = new[] { _attack };
    }
Example #13
0
    new private void Start()
    {
        base.Start();

        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>();

        ArmorPierce armorPiercing = new ArmorPierce(0.5f);

        modifiers.Add(armorPiercing);
        attack = new Attack(0.0f, 1.0f / 0.8f, this, 40, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Modifiers = modifiers
        };

        Skills = new[] { attack };
    }
Example #14
0
    new private void Start()
    {
        base.Start();

        _attack       = new Attack(150, 1.0f, this, 25, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable));
        _massHeal     = new MassHeal(240, 1.0f, 0.2f, this, 60f, 75f, (Targetable attackable) => TargetingFunction.IsAllyUnit(this, attackable));
        _overtimeHeal = new OvertimeHeal(2f, (Attackable attackable) => TargetingFunction.IsAllyUnit(this, attackable));
        _healingAura  = new Aura(75f, _overtimeHeal);

        _healingAura.ApplyOnTarget(this);

        Skills = new Skill[]
        {
            _attack,
            _massHeal
        };
    }
    new private void Start()
    {
        base.Start();
        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>();

        Defense def       = new Defense(0.2f, (Attackable target) => TargetingFunction.IsAlly(this, target));
        Aura    armorAura = new Aura(80, def);

        armorAura.ApplyOnTarget(this);

        ArmorPierce armorPiercing = new ArmorPierce(0.5f);

        modifiers.Add(armorPiercing);
        attack = new Attack(0.5f, 1.0f, 0, 1.0f, 45, modifiers, (Attackable attackable) => TargetingFunction.IsEnemy(this, attackable));

        _skills = new[] { attack };
    }
Example #16
0
    protected virtual new void Update()
    {
        base.Update();
        if (isActive)
        {
            bool isAttacking = UseSkill();
            //animator.SetBool("isAttacking", isAttacking);

            if (isAttacking)
            {
                RefreshCooldown();
                StopMoving();
            }
            else
            {
                Move(TargetingFunction.GetClosestEnemy(this));
            }
        }
    }
Example #17
0
    new private void Start()
    {
        base.Start();
        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>
        {
            new ArmorPierce(0.5f)
        };

        Zeal       zeal       = new Zeal(0, _attack, 20, 0.03f);
        Surrounded surrounded = new Surrounded(150, this, zeal, (Targetable t) => t is Inquisitor);

        surrounded.ApplyOnTarget(this);

        _attack = new Attack(0f, 1.0f, this, 20, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Modifiers = modifiers
        };

        Skills = new[] { _attack };
    }
Example #18
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 #19
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));
    }
Example #20
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));
    }
Example #21
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);
    }
Example #22
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);
    }
Example #23
0
 public override ActiveSkill UseSkill()
 {
     return(TargetingFunction.UseAttack(this, _attack));
 }
Example #24
0
    new private void Start()
    {
        base.Start();
        _modifiers = new List <IOffensiveModifier>();

        ArmorPierce armorPiercing = new ArmorPierce(0.6f);

        _modifiers.Add(armorPiercing);

        _attack = new RangeAttack(100, 1f / 0.3f, this, 60, PooledEnum.THROWABLE_WEIGHT, (Targetable attackable) => TargetingFunction.IsEnemy(this, attackable))
        {
            Modifiers = _modifiers
        };

        Skills = new Skill[]
        {
            _attack,
        };
    }
Example #25
0
 public override bool UseSkill()
 {
     return(TargetingFunction.UseAttack(this, attack));
 }
Example #26
0
    new private void Start()
    {
        base.Start();
        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>();

        CriticalHit criticalHit = new CriticalHit(0.2f, 2.0f);

        modifiers.Add(criticalHit);
        attack  = new Attack(0.5f, 1.0f, 0, 1.0f, 45, modifiers, (Attackable attackable) => TargetingFunction.IsEnemy(this, attackable));
        _skills = new[] { attack };
    }
Example #27
0
 public bool IsUsable(Attackable attacker, Attackable target)
 {
     return((IsMelee(attacker, target) || TargetingFunction.IsInRangeorMelee(attacker, target, Range)) && IsValidTarget(target));
 }
Example #28
0
    new private void Start()
    {
        base.Start();
        _modifiers = new List <IOffensiveModifier>();

        ArmorPierce armorPiercing = new ArmorPierce(0.6f);

        _modifiers.Add(armorPiercing);

        _attack = new Attack(0.5f, 0.3f, 100, 1.0f, 60, _modifiers, (Attackable attackable) => TargetingFunction.IsEnemy(this, attackable));

        _skills = new Skill[]
        {
            _attack,
        };
    }
Example #29
0
    public static Attackable GetClosestEnemy(Unit attacker)
    {
        Attackable target = attacker.EnemyCastle;

        float closestDistanceSqr = attacker.DetectionRange;

        foreach (Attackable potentialTarget in DetectSurroundings(attacker, (Attackable attackable) => TargetingFunction.IsEnemy(attacker, attackable)))
        {
            Vector3 directionToTarget = potentialTarget.transform.position - attacker.transform.position;
            float   dSqrToTarget      = directionToTarget.sqrMagnitude;
            if (dSqrToTarget < closestDistanceSqr && potentialTarget.gameObject != attacker)
            {
                closestDistanceSqr = dSqrToTarget;
                target             = potentialTarget;
            }
        }

        return(target);
    }
Example #30
0
    new private void Start()
    {
        base.Start();

        //Offensive bonuses

        _faithBonus = new FaithBonus(Creator, 100f, 0.5f);

        List <IOffensiveModifier> modifiers = new List <IOffensiveModifier>
        {
            _faithBonus,
        };

        //Defensive bonuses
        _block = new Block(10f, 1f);

        defensiveModifiers.Add(_block);

        _attack = new Attack(1f, 1.0f, 0, 1.0f, 10, modifiers, (Attackable attackable) => TargetingFunction.IsEnemy(this, attackable));

        _skills = new[] { _attack };
    }