示例#1
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);
        }