Example #1
0
        public Zerd(Player player, List <Item> gear) : base(null, false)
        {
            Player       = player;
            ChestTexture = TextureCacheFactory.GetOnce(gear.First(g => g.Type == ItemTypes.Robe).AnimationFile);
            FeetTexture  = TextureCacheFactory.GetOnce(gear.First(g => g.Type == ItemTypes.Boots).AnimationFile);
            HandTexture  = TextureCacheFactory.GetOnce(gear.First(g => g.Type == ItemTypes.Glove).AnimationFile);
            HeadTexture  = TextureCacheFactory.GetOnce(gear.First(g => g.Type == ItemTypes.Hood).AnimationFile);
            gear.ForEach(i =>
            {
                i.AbilityUpgrades.ForEach(a => player.AbilityUpgrades[a.Type] += a.Amount);
                i.SkillUpgrades.ForEach(s =>
                {
                    var skill = player.Skills.AllSkillTrees.SelectMany(t => t.Items).FirstOrDefault(item => item.Type == s.Type);
                    if (skill != null)
                    {
                        skill.PointsSpent = Math.Min(skill.PointsSpent + s.UpgradeAmount, skill.MaxPoints);
                    }
                });
            });
            Inventory = gear;

            X              = Globals.Map.StartingPosition.X;
            Y              = Globals.Map.StartingPosition.Y;
            X             += (int)player.PlayerIndex % 2 == 0 ? 85 : -85;
            Y             += (int)player.PlayerIndex < 2 ? -60 : 60;
            Health         = GameplayConstants.ZerdStartingHealth;
            Health        *= 1 + Inventory.SelectMany(i => i.AbilityUpgrades).Where(i => i.Type == AbilityUpgradeType.MaxHealth).Sum(i => i.Amount) / 100f;
            MaxHealth      = Health;
            Mana           = GameplayConstants.ZerdStartingMana;
            Mana          *= 1 + Inventory.SelectMany(i => i.AbilityUpgrades).Where(i => i.Type == AbilityUpgradeType.MaxMana).Sum(i => i.Amount) / 100f;
            MaxMana        = Mana;
            HealthRegen    = GameplayConstants.ZerdStartingHealthRegen;
            ManaRegen      = GameplayConstants.ZerdStartingManaRegen;
            Width          = 64;
            Height         = 64;
            HitboxSize     = 0.7f;
            BaseSpeed      = BootItem.Speed;
            CriticalChance = GameplayConstants.ZerdCritChance;
            TreasureChests = new List <TreasureChest>();
            Keys           = new List <Key>();
            ZerdAnimations = ZerdAnimationHelpers.GetAnimations();
            Stats          = new Stats();

            Abilities = new List <Ability>
            {
                new Dash(this),
                new Fireball(this),
                new Wand(this),
                new Iceball(this)
            };
        }
Example #2
0
 public DragonBreath(Zerd zerd) : base(AbilityTypes.DragonsBreath, zerd, AbilityConstants.DragonBreathCooldown, TimeSpan.Zero, AbilityConstants.DragonBreathManaCost, "dragon-breath")
 {
     ZerdAnimationHelpers.AddDragonsBreathAnimation(zerd, Casted, Execute, MakeMissile);
 }
Example #3
0
 public void AddCastingAnimation(string name, TimeSpan castTime, TimeSpan followThroughTime, Func <bool> executeFunc, Func <bool> castedFunc)
 {
     ZerdAnimations.AddAnimation(ZerdAnimationHelpers.GetCastingAnimation(name, castTime, followThroughTime, executeFunc, castedFunc));
 }