예제 #1
0
    public void ActivateSpecificEffect(int effectID)
    {
        Effect targetEffect = GetEffectByID(effectID);

        if (targetEffect != null)
        {
            targetEffect.Activate();
        }
    }
예제 #2
0
    public void ActivateSpecificEffect(string effectName)
    {
        Effect targetEffect = GetEffectByName(effectName);

        if (targetEffect != null)
        {
            targetEffect.Activate();
        }
    }
예제 #3
0
    protected virtual void CleanUp()
    {
        StatusManager.RemoveStatus(Target, this);

        if (onCompleteEffect != null)
        {
            //Debug.Log("Sending On Complete effect");
            onCompleteEffect.Activate();
        }
    }
예제 #4
0
    private void _Explode()
    {
        if (_Exploded)
        {
            return;
        }

        DeathEffect.Activate();

        Die();
    }
예제 #5
0
    protected virtual void CleanUp()
    {
        //Debug.Log("Cleaning " + sourceAbility.abilityName);
        //Destroy(this);
        StatusManager.RemoveStatus(targetEntity, this);

        if (onCompleteEffect != null)
        {
            //Debug.Log("Sending On Complete effect");
            onCompleteEffect.Activate();
        }
    }
예제 #6
0
        private void listBoxEffects_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Effect is IBarrelEffect)
            {
                Effect.Deactivate(BarrelPixels);
            }
            if (Effect is ITreadEffect)
            {
                Effect.Deactivate(TreadPixels);
            }
            if (Effect is IPanelEffect)
            {
                Effect.Deactivate(PanelPixels);
            }

            Effect = effects[(string)listBoxEffects.SelectedItem];

            if (Effect.IsSensorDriven)
            {
                _timer.Interval = 10 * Speed;
            }
            else
            {
                _timer.Interval = 10;
            }

            if (Effect is IBarrelEffect)
            {
                Effect.Activate(BarrelPixels);
            }
            if (Effect is ITreadEffect)
            {
                Effect.Activate(TreadPixels);
            }
            if (Effect is IPanelEffect)
            {
                Effect.Activate(PanelPixels);
            }
        }
예제 #7
0
파일: Status.cs 프로젝트: Alarack/2DSandbox
    protected virtual void CleanUp()
    {
        StatusManager.RemoveStatus(Target, this);

        if (activeVFX != null)
        {
            activeVFX.transform.SetParent(null, true);
            ParticleSystem p = activeVFX.GetComponent <ParticleSystem>();
            if (p != null)
            {
                p.Stop();
            }

            GameObject.Destroy(activeVFX, 2f);
        }


        if (onCompleteEffect != null)
        {
            //Debug.Log("Sending On Complete effect");
            onCompleteEffect.Activate();
        }
    }
예제 #8
0
        public Immortal()
        {
            Name  = "Immortal";
            Image = Graphics.resources.Res.Immortal;
            SetMaxHp(333);
            SetEnergyRegen(5);
            SetMaxEnergy(333);
            SetArmor(10);
            SetResist(10);
            SetMovementSpeed(9);
            SetAttackDamage(50);
            SetAttackRange(8);


            Shield = new Perk
            {
                Name        = "Shield",
                Number      = (h) => Math.Floor(ShieldEnergyRegen * (h.GetMaxEnergy() - h.GetEnergy())),
                Explanation = (h) => "When taking damage up to " + ShieldMaxDamage + " of it goes in to HP, others goes energy;" +
                              " And in end of turn restore " + ShieldEnergyRegen * 100 + "% of lost energy",
                GetDamage = (a) => (d) =>
                {
                    var h = d.HeroValue;

                    var damage = d.DamageValue;

                    var arm       = h.GetArmor();
                    var res       = h.GetResist();
                    var armored   = damage.Phys > arm ? arm : damage.Phys;
                    var resisted  = damage.Magic > arm ? arm : damage.Magic;
                    var resDamage = new Damage(h, h.P, damage.Phys - armored,
                                               damage.Magic - resisted,
                                               damage.Pure);
                    var damageShould = resDamage.Sum();
                    if (damageShould > ShieldMaxDamage)
                    {
                        var over       = damageShould - ShieldMaxDamage;
                        var energyLeft = h.GetEnergy();
                        var absorbed   = energyLeft >= over ? over : energyLeft;
                        var damageLeft = over - absorbed + ShieldMaxDamage;
                        var coeff      = damageLeft / damageShould;
                        resDamage.Phys  *= coeff;
                        resDamage.Magic *= coeff;
                        resDamage.Pure  *= coeff;
                        h.AddEnergy(-absorbed);
                        d.PlayerValue.AllDamage += absorbed * ShieldEnergyExpCoeff;
                    }
                    resDamage.Phys  += armored;
                    resDamage.Magic += resisted;
                    d.DamageValue    = resDamage;
                    return(a(d));
                },

                EndTurn = (a) => (d) =>
                {
                    var h = d.HeroValue;
                    h.AddEnergy(ShieldEnergyRegen * (h.GetMaxEnergy() - h.GetEnergy()));
                    return(a(d));
                }
            };
            Perks.Add(Shield);

            Reflection = new Perk
            {
                Name        = "Reflection",
                Number      = (h) => Math.Floor(StormMaxEnergyScale * h.GetMaxEnergy() + StormAPScale * h.GetAbilityPower()),
                Explanation = (h) => "Everybody who attacks you or stay within " + StormRange +
                              " radius at the end of your turn gets" +
                              (StormMaxEnergyScale * h.GetMaxEnergy() + StormAPScale * h.GetAbilityPower()) + " spell damage",
                GetDamage = (a) => (d) =>
                {
                    var h = d.HeroValue;
                    if (h.P.Heroes.Contains(d.DamageValue.Creator))
                    {
                        return(a(d));
                    }
                    var maxEnergy = h.GetMaxEnergy();
                    var ap        = h.GetAbilityPower();
                    d.DamageValue.Creator
                    .GetDamage(new Damage(h, h.P,
                                          magic: maxEnergy * StormMaxEnergyScale
                                          + ap * StormAPScale));
                    return(a(d));
                },


                EndTurn = (a) => (d) =>
                {
                    var h         = d.HeroValue;
                    var maxEnergy = h.GetMaxEnergy();
                    var ap        = h.GetAbilityPower();
                    var damage    = new Damage(h, h.P,
                                               magic: maxEnergy * StormMaxEnergyScale
                                               + ap * StormAPScale);
                    var targets = GetEnemiesInRange(h, StormRange);
                    foreach (var target in targets)
                    {
                        target.GetDamage(damage);
                    }
                    return(a(d));
                },
            };

            Storm = new Skill
            {
                Name        = "Storm",
                Explanation = () => "For next " + StormDuration
                              + " turns all enemies in " + StormRange
                              + " units from you and each time they do damage to" +
                              " this hero they take " + StormMaxEnergyScale * 100 +
                              "% MaxEnergy + " + StormAPScale * 100 + "%AP ("
                              + (StormMaxEnergyScale * GetMaxEnergy() + StormAPScale * GetAbilityPower()) +
                              ") magic damage. Cost " + StormCost + "%Energy. CD " +
                              StormCD,
                CoolDown = StormCD,
                Job      = (h) =>
                {
                    var ef = new Effect(h, StormDuration - 1)
                    {
                        Activate    = (eh) => eh.Perks.Add(Reflection),
                        Disactivate = (eh) => eh.Perks.Remove(Reflection),
                    };
                    h.M.Effects.Add(ef);
                    ef.Activate(h);
                    h.SetEnergy(h.GetEnergy() * (1 - StormCost));
                    return(true);
                }
            };

            Storm.SkillTypes.Add(SkillType.Special);
            Skills.Add(Storm);
        }
예제 #9
0
        public Geneva()
        {
            Name  = "Geneva";
            Image = Graphics.resources.Res.Geneva;
            SetMaxHp(808);
            SetMaxEnergy(300);
            SetMovementSpeed(8);
            SetArmor(15);
            SetAttackRange(5);
            SetEnergyRegen(15);

            Keeping = false;

            Impulse = new Skill()
            {
                Name        = "Impulse",
                Explanation = () => "Creates an impulse, centered "
                              + ImpulseRange + " units from you, that explodes in "
                              + ImpulseRadius + " units radius dealing "
                              + ImpulseDamage + " + " + ImpulseApScale * 100 + "%AP ("
                              + (ImpulseDamage + ImpulseApScale * GetAbilityPower()) + ") " +
                              "magic damage to enemies and slowing them by "
                              + ImpulseSlow * 100 + "% MS for " + ImpulseSlowTime + " turns. CD "
                              + ImpulseCD + ". Cost " + ImpulseCost + ".",
                EnergyCost = ImpulseCost,
                CoolDown   = ImpulseCD,
                Job        = (h) =>
                {
                    var points = h.GetPosition().GetPointsInDistance(0, ImpulseRange).Select(p => p.Key).ToList();
                    if (points.Count == 0)
                    {
                        return(false);
                    }
                    var center = ChoosePoint(points, h.P);
                    if (center == null)
                    {
                        return(false);
                    }
                    var targets = h.M.GetHeroPositions().Where(u => u.Value.GetStepsTo(center) <= ImpulseRadius)
                                  .Select(p => p.Key)
                                  .Where(u => h.P != u.P)
                                  .ToList();
                    var damage = new Damage(h, h.P, magic: ImpulseDamage + ImpulseApScale * GetAbilityPower());

                    foreach (var t in targets)
                    {
                        h.Targets.Add(t);
                        t.GetDamage(damage);
                    }

                    var slowPerk = new Perk
                    {
                        GetMovementSpeed = (g) => () => g() * (1 - ImpulseSlow),
                        SetMovementSpeed = (g) => (v) => g(v / (1 - ImpulseSlow)),
                    };

                    foreach (var t in targets)
                    {
                        t.Perks.Add(slowPerk);
                    }
                    var slowEffect = new Effect(h)
                    {
                        Activate = (he) =>
                        {
                        },
                        Disactivate = (he) =>
                        {
                            foreach (var t in targets)
                            {
                                t.Perks.Remove(slowPerk);
                            }
                        },
                        Timer = (int)ImpulseSlowTime,
                    };
                    h.M.Effects.Add(slowEffect);
                    slowEffect.Activate(h);
                    (h as Geneva).Keeping = false;
                    return(true);
                },
            };
            Impulse.SkillTypes.Add(SkillType.Special);
            Impulse.SkillTypes.Add(SkillType.Mag);
            Skills.Add(Impulse);


            BeamPerk = new Perk
            {
                Name    = "Beam",
                EndTurn = (f) => (d) =>
                {
                    var me = d.HeroValue as Geneva;
                    if (me.Keeping)
                    {
                        if (me.BeamTarget != null &&
                            me.M.GetHeroes().Contains(me.BeamTarget) &&
                            me.BeamTarget.GetPosition().GetStepsTo(me.GetPosition()) <= BeamRadius)
                        {
                            me.BeamTarget.GetHeal(BeamRegen + BeamRegenApScale * me.GetAbilityPower());
                        }
                        else
                        {
                            me.Keeping = false;
                        }
                    }
                    return(f(d));
                },

                SkillFix = (s) =>
                {
                    var prev = s.Job;
                    if (s.Name == "Beam" || s.Name == "Impulse")
                    {
                        return(s);
                    }
                    var newSkill = new Skill
                    {
                        Name        = s.Name,
                        Explanation = s.Explanation,
                        CoolDown    = s.CoolDown,
                        EnergyCost  = s.EnergyCost,
                        SkillTypes  = s.SkillTypes,
                        Job         = (h) =>
                        {
                            var res = prev(h);
                            if (res)
                            {
                                (h as Geneva).Keeping = false;
                            }
                            return(res);
                        },
                        Timer = s.CoolDown,
                    };
                    return(newSkill);
                }
            };
            Perks.Add(BeamPerk);

            Beam = new Skill
            {
                Name        = "Beam",
                Explanation = () => "Heales chosen hero in "
                              + BeamRadius + " units from you for "
                              + BeamHeal + " + " + BeamHealApScale * 100 + "%AP ("
                              + (BeamHeal + BeamHealApScale * GetAbilityPower()) + ") HP and "
                              + " continues healing him at the end of every your turn fro " +
                              +BeamRegen + " + " + BeamRegenApScale * 100 + "%AP (" +
                              (BeamRegen + BeamRegenApScale * GetAbilityPower()) + ") HP" +
                              " while you dont use any other skills and target stays in range of skill. CD "
                              + BeamCD + ". Cost " + BeamCost + ".",
                EnergyCost = BeamCost,
                CoolDown   = BeamCD,
                Job        = (h) =>
                {
                    var allys = GetAlliesInRange(h, BeamRadius);
                    if (allys.Count == 0)
                    {
                        return(false);
                    }
                    var target = ChooseTarget(allys, h.P);
                    if (target == null)
                    {
                        return(false);
                    }
                    h.Targets.Add(target);


                    target.GetHeal(BeamHeal + BeamHealApScale * h.GetAbilityPower());
                    (h as Geneva).Keeping    = true;
                    (h as Geneva).BeamTarget = target;
                    return(true);
                }
            };
            Beam.SkillTypes.Add(SkillType.Special);
            Skills.Add(Beam);
        }
예제 #10
0
 public void Activate()
 {
     Effect.Activate(LedStrip.Pixels);
     LedStrip.Show();
 }
예제 #11
0
        public Sniper()
        {
            Name  = "Sniper";
            Image = Graphics.resources.Res.Sniper;

            SetMaxHp(550);
            SetAttackDamage(66);
            SetAbilityPower(100);
            SetAttackRange(13);
            SetRegen(7);
            SetMaxEnergy(400);
            SetEnergyRegen(10);
            SetMovementSpeed(9);


            Snipe = new Skill
            {
                Name        = "Snipe",
                Explanation = () => "Deals to enemy " + SnipeDamage
                              + " + " + SnipeApScale * 100 + "% AP ("
                              + (SnipeDamage + SnipeApScale * GetAbilityPower())
                              + ") physycal damage and root for " + SnipeRootTime + "turn. Range " + SnipeRange +
                              ". Energy cost " + SnipeEnergyCost + ". Cooldown " + SnipeCooldown + ".",
                Job = (h) =>
                {
                    var enemiesInRange = GetEnemiesInRange(h, SnipeRange);
                    if (enemiesInRange.Count != 0)
                    {
                        var tg = ChooseTarget(enemiesInRange, h.P);
                        if (tg == null)
                        {
                            return(false);
                        }
                        h.Targets.Add(tg);
                        var damage = new Damage(h, h.P, phys: SnipeDamage + SnipeApScale * h.GetAbilityPower());
                        foreach (var t in h.Targets)
                        {
                            t.GetDamage(damage);
                        }

                        var enemyMoveSkills = h.Targets[0].Skills.Where(s => s.SkillTypes.Contains(SkillType.Move)).ToList();
                        var target          = h.Targets[0];

                        var perk = new Perk();
                        perk.Name = "Rooted";

                        var root = new Effect(target)
                        {
                            Timer    = SnipeRootTime - 1,
                            Activate = (eh) =>
                            {
                                eh.Perks.Add(perk);
                                foreach (var sk in enemyMoveSkills)
                                {
                                    eh.Skills.Remove(sk);
                                }
                            },
                            Disactivate = (eh) =>
                            {
                                eh.Perks.Remove(perk);
                                foreach (var sk in enemyMoveSkills)
                                {
                                    eh.Skills.Add(sk);
                                }
                            },
                        };

                        perk.Number = (eh) => root.Timer + 1;

                        h.M.Effects.Add(root);
                        root.Activate(target);
                        return(true);
                    }
                    return(false);
                },
                CoolDown   = SnipeCooldown,
                EnergyCost = SnipeEnergyCost,
            };
            Snipe.SkillTypes.Add(SkillType.Special);
            Skills.Add(Snipe);
        }
예제 #12
0
    protected IEnumerator <object> HandleEffectTask(Effect effect)
    {
        activeEffects.Add(effect);
        System.Action action;
        switch (effect.TargetField)
        {
        case TargetField.DealPhysicalDamage:
            action = () => {
                SetHPPhysical = (int)effect.Activate(SetHPPhysical);
            };
            break;

        case TargetField.DealMagicalDamage:
            action = () => {
                SetHPMagical = (int)effect.Activate(SetHPMagical);
            };
            break;

        case TargetField.Heal:
            action = () => {
                CurrentHealth = (int)effect.Activate(CurrentHealth);
            };
            break;

        case TargetField.Mana:
            action = () => {
                CurrentMana = (int)effect.Activate(CurrentMana);
            };
            break;

        case TargetField.PhysicalArmor:
            action = () => {
                CurrentPhysicalArmor = (int)effect.Activate(CurrentPhysicalArmor);
            };
            break;

        case TargetField.MagicalArmor:
            action = () => {
                CurrentMagicalArmor = (int)effect.Activate(CurrentMagicalArmor);
            };
            break;

        case TargetField.MoveSpeed:
            action = () => {
                CurrentSpeed = effect.Activate(CurrentSpeed);
            };
            break;

        default:
            throw new Exception($"Не туда");
        }
        while (true)
        {
            action.Invoke();
            yield return(new WaitForSeconds(effect.Periodicity));

            effect.CurrentTicksCount--;
            if (effect.CurrentTicksCount == 0)
            {
                effect.CurrentTicksCount = effect.BaseTicksCount;
                effect.CurrentValueDelta = effect.BaseValueDelta;
                activeEffects.Remove(effect);
                yield break;
            }
            effect.CurrentValueDelta += effect.ValueDeltaDeltaPerTick;
        }
    }
예제 #13
0
        public Fe11()
        {
            Name  = "Fe11";
            Image = Graphics.resources.Res.Fe11;
            SetMaxHp(900);
            SetAttackDamage(30);
            SetResist(5);
            SetMovementSpeed(11);
            SetAttackRange(4);
            SetAttackSpeed(2);
            SetMaxEnergy(120);
            SetEnergyRegen(6);

            Stacks     = 0;
            WallStacks = 0;

            Rage = new Perk
            {
                Name        = "Rage",
                Explanation = (h) => "AD increased by " + RageADBuff * Stacks + " and armor by "
                              + RageArmorBuff * Stacks + ".",
                Number = (h) => (h as Fe11).Stacks,

                GetArmor        = (g) => () => g() + Stacks * RageArmorBuff,
                SetArmor        = (s) => (v) => s(v - Stacks * RageArmorBuff),
                GetAttackDamage = (g) => () => g() + Stacks * RageADBuff,
                SetAttackDamage = (s) => (v) => s(v - Stacks * RageADBuff),

                SkillFix = (sf) => {
                    if (sf.SkillTypes.Contains(SkillType.Attack))
                    {
                        var newSkill = new Skill()
                        {
                            SkillTypes = sf.SkillTypes,
                            Job        = (h) =>
                            {
                                var prev = sf.Job(h);
                                if (prev)
                                {
                                    (h as Fe11).Stacks++;
                                }
                                return(prev);
                            }
                        };

                        return(newSkill);
                    }
                    return(sf);
                },

                //Stuff from Wall skill
                EndTurn = (i) => (d) =>
                {
                    var h = (d.HeroValue as Fe11);
                    var a = i(d);
                    if (h.WallOn)
                    {
                        var wallCost = (WallBaseManaPerTurnCost * Math.Pow(WallTurnManaMultiplier, h.WallStacks));
                        if (h.GetEnergy() < wallCost)
                        {
                            WallControl.Disactivate(h);
                            h.M.Effects.Remove(WallControl);
                            h.WallStacks--;
                        }
                        else
                        {
                            h.AddEnergy(-wallCost);
                            h.WallStacks++;
                        }
                    }
                    else
                    {
                        if (h.WallStacks > 0)
                        {
                            h.WallStacks--;
                        }
                    }

                    return(a);
                },
            };
            Perks.Add(Rage);

            Skills.Remove(Attack);
            BuffedAttack = new Skill
            {
                Name        = Attack.Name,
                Explanation = () => Attack.Explanation() + "On attack increases you AD by " + RageADBuff + " and armor by " + RageArmorBuff + ".",
                Job         = Attack.Job
            };
            BuffedAttack.SkillTypes.Add(SkillType.Attack);
            Skills.Add(BuffedAttack);

            WallControl = new Effect(this, int.MaxValue)
            {
                Activate = (h) =>
                {
                    (h as Fe11).BuildWall(h);
                },
                Disactivate = (h) =>
                {
                    (h as Fe11).DestroyWall(h.M);
                },
            };

            Wall = new Skill
            {
                Name        = "YouShallNotPass",
                Explanation = () => WallOn ? "Destroyes the wall builded by this skill. (current cost " + WallBaseManaPerTurnCost * Math.Pow(WallTurnManaMultiplier, WallStacks) + ")"
                    : "Builds a wall in " + WallMinDist + "-" + WallMaxDist +
                              " range around you. On next use destroyes it. At the end of turn eats " + WallBaseManaPerTurnCost * Math.Pow(WallTurnManaMultiplier, WallStacks)
                              + " energy and increase its next cost by " +
                              WallTurnManaMultiplier * 100 + "% (when disactivated - decrease). energy at the end of turn (if not enough - turnes off).",

                Job = (h) =>
                {
                    if (WallOn)
                    {
                        WallControl.Disactivate(h);
                        h.M.Effects.Remove(WallControl);
                    }
                    else
                    {
                        h.M.Effects.Add(WallControl);
                        WallControl.Activate(h);
                    }

                    return(WallOn);
                },
            };
            Wall.SkillTypes.Add(SkillType.Special);
            Skills.Add(Wall);
        }
예제 #14
0
        public Micro()
        {
            Name  = "Micro";
            Image = Graphics.resources.Res.Micro;
            SetAttackDamage(60);
            SetMaxHp(1100);
            SetMaxEnergy(350);
            SetEnergyRegen(10);
            SetMovementSpeed(10);
            SetRegen(15);

            Defence = new Perk
            {
                Name        = "Defence",
                Number      = (h) => (h as Micro).GetEnemiesInRange(h, DefenceRadius).Count,
                Explanation = (h) => "Gets " + (DefenceADScale * 100) + "% AD (" + DefenceADScale * h.GetAttackDamage()
                              + ") armor and resist from every enemy in " + DefenceRadius + "units ("
                              + (h as Micro).GetEnemiesInRange(h, DefenceRadius).Count + " enemies), total "
                              + (h.GetAttackDamage() * DefenceADScale * GetEnemiesInRange(this, DefenceRadius).Count),

                GetArmor = (g) => () =>
                           g() + GetAttackDamage() * DefenceADScale * GetEnemiesInRange(this, DefenceRadius).Count,
                SetArmor = (s) => (v) =>
                           s(v - GetAttackDamage() * DefenceADScale * GetEnemiesInRange(this, DefenceRadius).Count),
                GetResist = (g) => () =>
                            g() + GetAttackDamage() * DefenceADScale * GetEnemiesInRange(this, DefenceRadius).Count,
                SetResist = (s) => (v) =>
                            s(v - GetAttackDamage() * DefenceADScale * GetEnemiesInRange(this, DefenceRadius).Count),
            };
            Perks.Add(Defence);

            Drop = new Skill
            {
                Name        = "Drop",
                Explanation = () => "Get any hero in " + DropCatchRadius + " units and throw in any free place in "
                              + DropRaduis + " units from you."
                              + " CD " + DropCD + ". Cost " + DropCost + ".",
                CoolDown   = DropCD,
                EnergyCost = DropCost,
                Job        = (h) =>
                {
                    var targets = GetHeroesInRange(h, DropCatchRadius).Where(t => t != h).ToList();
                    if (targets.Count == 0)
                    {
                        return(false);
                    }
                    var target = ChooseTarget(targets, h.P);
                    if (target == null)
                    {
                        return(false);
                    }
                    h.Targets.Add(target);
                    var points = h.GetPosition().GetPointsInDistance(0, DropRaduis).Keys
                                 .Where(p => h.M.CellIsFree(p)).ToList();
                    if (points.Count == 0)
                    {
                        return(false);
                    }
                    var point = ChoosePoint(points, h.P);
                    if (point == null)
                    {
                        return(false);
                    }
                    h.M.UnitPositions[Targets[0]] = point;
                    return(true);
                }
            };
            Drop.SkillTypes.Add(SkillType.Special);
            Skills.Add(Drop);


            RestoreRegenBuff = new Perk
            {
                Name     = "Restore",
                Number   = (h) => Math.Floor(RestoreRegen * h.GetMaxHp()),
                GetRegen = (g) => () => g() + RestoreRegen * GetMaxHp(),
                SetRegen = (s) => (v) => s(v - RestoreRegen * GetMaxHp()),
            };

            Restore = new Skill
            {
                Name        = "Restore",
                Explanation = () => "Heal you for "
                              + RestoreHeal + "% MaxHp (" + RestoreHeal * GetMaxHp() + ") and give "
                              + RestoreRegen + "% MaxHp (" + RestoreRegen * GetMaxHp() + ") Regen for "
                              + RestoreRegenDuration + " turns. CD"
                              + RestoreCooldown + ". Cost " + RestoreCost + ".",
                CoolDown   = RestoreCooldown,
                EnergyCost = RestoreCost,
                Job        = (h) =>
                {
                    var effect = new Effect(h, RestoreRegenDuration)
                    {
                        Activate = (eh) =>
                        {
                            eh.Perks.Add(RestoreRegenBuff);
                        },
                        Disactivate = (eh) =>
                        {
                            eh.Perks.Remove(RestoreRegenBuff);
                        }
                    };
                    effect.Activate(h);
                    h.M.Effects.Add(effect);
                    h.GetHeal(RestoreHeal * h.GetMaxHp());
                    return(true);
                }
            };
            Restore.SkillTypes.Add(SkillType.Special);
            Skills.Add(Restore);
        }
예제 #15
0
        public Cyprys()
        {
            Name  = "Cyprys";
            Image = Graphics.resources.Res.Cyprus;
            SetMaxHp(750);
            SetMaxEnergy(400);
            SetEnergyRegen(10);
            SetAttackDamage(40);
            SetMovementSpeed(10);
            SetAttackRange(11);

            PlacedRocks = new List <Tuple <Point, Effect> >();

            Rock = new Skill
            {
                Name        = "Rock",
                Explanation = () => "Places a rock in range " + RockRange + " on " + RockSustain
                              + " turns, dealing " + RockDamage + " + " + RockDamageAPscale * 100 + "%AP (" +
                              (RockDamage + RockDamageAPscale * GetAbilityPower()) + ") magical damage. " +
                              "Cooldown " + RockCooldown + ". Cost " + RockEnergyCost,
                Job = (h) =>
                {
                    var damage = new Damage(this, h.P, magic: RockDamage + RockDamageAPscale * h.GetAbilityPower());
                    var pos    = h.M.UnitPositions[h].GetPointsInDistance(0, RockRange).Keys.Where(pp => h.M.IsInBounds(pp)).ToList();
                    var point  = ChoosePoint(pos, h.P);
                    if (point == null)
                    {
                        return(false);
                    }

                    var RockEffect = new Effect(h, (int)RockSustain);
                    RockEffect.Activate = (eh) =>
                    {
                        if (eh.M.MapTiles[point.X, point.Y].Type != TileType.Solid)
                        {
                            PlacedRocks.Add(Tuple.Create(point, RockEffect));
                            eh.M.MapTiles[point.X, point.Y].Type = TileType.Solid;
                        }
                    };

                    RockEffect.Disactivate = (eh) =>
                    {
                        PlacedRocks.Remove(Tuple.Create(point, RockEffect));
                        eh.M.MapTiles[point.X, point.Y].Type = TileType.Empty;
                    };

                    RockEffect.Activate(h);
                    h.M.Effects.Add(RockEffect);
                    var p       = point.GetPointsInDistance(0, RockDamageRadius).Keys;
                    var victims = new List <KeyValuePair <Hero, Point> >(h.M.GetHeroPositions().Where(s => p.Contains(s.Value)).ToList());
                    foreach (var victim in victims)
                    {
                        if (!h.P.Heroes.Contains(victim.Key))
                        {
                            victim.Key.GetDamage(damage);
                        }
                    }
                    return(true);
                },
                CoolDown   = RockCooldown,
                EnergyCost = RockEnergyCost,
            };

            EarthPower = new Skill
            {
                Name        = "Earth Power",
                Explanation = () => "Get all Rocks in " + EarthRangeReq + " units and throw in enemy in "
                              + EarthRange + " units dealing " + EarthDamage + " + " + EarthDamageAPscale * 100
                              + "%AP  +  for each Rock thrown " + EarthRockDamage + " + " + EarthRockDamageAPscale * 100
                              + "%AP (" + (EarthDamage + EarthDamageAPscale * GetAbilityPower() +
                                           M.UnitPositions[this].GetPointsInDistance(0, EarthRangeReq).Keys
                                           .Where(a => PlacedRocks.Select(f => f.Item1).Contains(a)).Count()
                                           * (EarthRockDamage + EarthRockDamageAPscale * GetAbilityPower()))
                              + ")spell damage.\n CD " + EarthCooldown + ". Cost " + EarthEnergyCost,
                Job = (h) =>
                {
                    var targets = GetEnemiesInRange(h, EarthRange);
                    if (targets.Count == 0)
                    {
                        return(false);
                    }
                    var target = ChooseTarget(targets, h.P);
                    if (target == null)
                    {
                        return(false);
                    }
                    h.Targets.Add(target);
                    var    rocks       = PlacedRocks.Where(p => p.Item1.GetStepsTo(h.M.UnitPositions[h]) <= EarthRangeReq);
                    var    rocksNumber = rocks.Count();
                    Effect maxLifeRock = null;
                    foreach (var r in rocks.ToList())
                    {
                        if (maxLifeRock == null || maxLifeRock.Timer < r.Item2.Timer)
                        {
                            maxLifeRock = r.Item2;
                        }
                        h.M.Effects.Remove(r.Item2);
                        r.Item2.Disactivate(h);
                    }
                    var damage = new Damage(h, h.P, magic: EarthDamage + EarthDamageAPscale * h.GetAbilityPower() +
                                            rocksNumber * (EarthRockDamage + EarthRockDamageAPscale * h.GetAbilityPower()));
                    var tgPoint = h.M.GetHeroPositions().FirstOrDefault(a => a.Key == Targets[0]).Value + new Point(0, 0);
                    h.Targets[0].GetDamage(damage);
                    if (rocksNumber > 0)
                    {
                        var point      = tgPoint;
                        var RockEffect = new Effect(h, maxLifeRock.Timer);
                        RockEffect.Activate = (eh) =>
                        {
                            if (eh.M.MapTiles[point.X, point.Y].Type != TileType.Solid)
                            {
                                PlacedRocks.Add(Tuple.Create(point, RockEffect));
                                eh.M.MapTiles[point.X, point.Y].Type = TileType.Solid;
                            }
                        };

                        RockEffect.Disactivate = (eh) =>
                        {
                            PlacedRocks.Remove(Tuple.Create(point, RockEffect));
                            eh.M.MapTiles[point.X, point.Y].Type = TileType.Empty;
                        };

                        RockEffect.Activate(h);
                        h.M.Effects.Add(RockEffect);
                    }
                    return(true);
                },
                CoolDown   = EarthCooldown,
                EnergyCost = EarthEnergyCost,
            };
            EarthPower.SkillTypes.Add(SkillType.Special);
            Skills.Add(EarthPower);
            Skills.Add(Rock);
            Rock.SkillTypes.Add(SkillType.Special);
        }
예제 #16
0
        public DeathScythe()
        {
            Name = "Death Scythe";
            Cost = 777;
            Tier = 2;
            HP   = 100;
            A    = 5;
            AD   = 45;
            HR   = 8;

            Explanation = (h) => "Every attack deales bonus " + APScale * 100 + "% AP(" + h.GetAbilityPower() * APScale + ") magic damage after " + DamageDelay + " turns.";

            Effect = new Perk()
            {
                Name        = this.Name,
                Explanation = this.Explanation,
                SkillFix    = (s) =>
                {
                    if (!s.SkillTypes.Contains(SkillType.Attack))
                    {
                        return(s);
                    }
                    var newSkill = new Skill()
                    {
                        Name       = s.Name,
                        CoolDown   = s.CoolDown,
                        SkillTypes = s.SkillTypes,
                        Job        = (h) =>
                        {
                            var res = s.Job(h);
                            if (res)
                            {
                                var tgts   = h.Targets;
                                var effect = new Effect(h)
                                {
                                    Activate    = (he) => { },
                                    Disactivate = (he) =>
                                    {
                                        var damage = new Damage(he, he.P, magic: h.GetAbilityPower() * APScale);
                                        foreach (var t in tgts)
                                        {
                                            t.GetDamage(damage);
                                        }
                                    },
                                    Timer = DamageDelay,
                                };
                                h.M.Effects.Add(effect);
                                effect.Activate(h);
                                return(true);
                            }
                            return(false);
                        },
                        Explanation = s.Explanation,
                    };

                    return(newSkill);
                }
            };


            //300

            Parts = new List <Item> {
                new XPeke(),
                new Razor(),
            };
        }