public IcicleMissile(Zerd zerd, DamageInstance damageInstance, Point p, int index) : base("Missiles/icicle.png") { Damage = damageInstance; Width = 40; Height = 40; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.IcicleDistance; Speed = AbilityConstants.IcicleSpeed; Velocity = Creator.Facing.Normalized().Rotate(360f * index / 8); // Move the icicle away from the caster a bit X += Velocity.X * 45; Y -= Velocity.Y * 45; Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); }
public IceballMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/iceball.png") { Damage = damageInstance; Width = 64; Height = 64; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.IceballDistance; Speed = AbilityConstants.IceballSpeed; Velocity = Creator.Facing.Normalized(); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); var deathAnimation = new Animation(AnimationTypes.Death); deathAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.08)); deathAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.93f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.85f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.78f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.71f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.64f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.58f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.51f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 8, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.46f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 9, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.38f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 10, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.3f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 11, 0, 64, 64), TimeSpan.FromSeconds(0.08), DeathFunc); Animations.Add(deathAnimation); }
public Wand(Zerd zerd) : base(AbilityTypes.Wand, zerd, AbilityConstants.WandCooldown, AbilityConstants.WandCastTime, 0f, "fairy-wand") { if (zerd.Player.ChargeAbilities) { zerd.AddCastingAnimation(AnimationTypes.Attack, TimeSpan.Zero, AbilityConstants.WandFollowThroughTime, null, Casted); } else { zerd.AddCastingAnimation(AnimationTypes.Attack, AbilityConstants.WandCastTime, AbilityConstants.WandFollowThroughTime, Execute, Casted); } }
public BlazingSpeedBuff(Zerd zerd, TimeSpan length, float speedIncrease) : base(null, zerd, length, true, movementSpeedFactor: speedIncrease) { Applier = zerd; DamageType = DamageTypes.Fire; Texture = TextureCacheFactory.Get("Buffs/burn.png"); Animation = new Animation(""); Animation.AddFrame(Texture.Bounds, TimeSpan.FromSeconds(0.15)); if (zerd.SkillPoints(SkillType.BlazingSpeed) > 0) { DamagePerSecond = zerd.MaxHealth * PlayerSkills.BleedFireHealthPercent / (100 * (float)length.TotalSeconds); } }
public LavaBlastMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/lava_blast.png") { Damage = damageInstance; Width = 86; Height = 86; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.FireballDistance * (1 + zerd.Player.AbilityUpgrades[AbilityUpgradeType.LavaBlastDistance] / 100f); Speed = AbilityConstants.FireballSpeed; Velocity = Creator.Facing.Normalized(); TargetsHit = new List <Being>(); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); var deathAnimation = new Animation(AnimationTypes.Death); deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03)); deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.91f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.82f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.73f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.64f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.55f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.46f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.37f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.28f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.19f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.1f; return(true); }); deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), DeathFunc); Animations.Add(deathAnimation); }
public DragonBreathMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/dragons_breath.png") { Damage = damageInstance; Width = 26f; Height = 26f; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.FireballDistance; Speed = AbilityConstants.FireballSpeed; Velocity = Creator.Facing.Normalized().Rotate(Globals.Random.Next(11) - 5); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(32 * 0, 0, 32, 32), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(32 * 1, 0, 32, 32), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(32 * 2, 0, 32, 32), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); }
public FireballMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/fireball.png") { Damage = damageInstance; var size = 64f * zerd.SkillValue(SkillType.ImprovedFireball, true); Width = (int)size; Height = (int)size; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.FireballDistance; Speed = AbilityConstants.FireballSpeed; Velocity = Creator.Facing.Normalized(); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); var deathAnimation = new Animation(AnimationTypes.Death); deathAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.1)); deathAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.92f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 8, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.84f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 9, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.76f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 10, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.68f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 11, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.6f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 12, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.5f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 13, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.4f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 14, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.3f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 15, 0, 64, 64), TimeSpan.FromSeconds(0.1), DeathFunc); Animations.Add(deathAnimation); }
public static void AddDragonsBreathAnimation(Zerd zerd, Func <bool> casted, Func <bool> execute, Func <bool> makeMissile) { var animation = new Dictionary <BodyPartType, Animation>(); var animationLength = AbilityConstants.DragonBreathDuration; var headAnimation = new Animation(AnimationTypes.FireBreath, Head); headAnimation.AddFrame(0, 1, animationLength); animation[BodyPartType.Head] = headAnimation; var chestAnimation = new Animation(AnimationTypes.FireBreath, Chest); chestAnimation.AddFrame(0, 0, TimeSpan.FromSeconds(0.04)); chestAnimation.AddFrame(0, 0, TimeSpan.FromSeconds(0.04), execute); for (var i = 0; i < AbilityConstants.DragonBreathDuration.TotalSeconds / AbilityConstants.DragonBreathInterval.TotalSeconds; i++) { chestAnimation.AddFrame(0, 0, AbilityConstants.DragonBreathInterval, makeMissile); } chestAnimation.AddFrame(0, 0, TimeSpan.FromSeconds(0.04), casted); animation[BodyPartType.Chest] = chestAnimation; zerd.ZerdAnimations.AddAnimation(animation); }
public override void OnPickup(Zerd zerd) { IsActive = false; zerd.Health += zerd.MaxHealth * GameplayConstants.HealthPotionBonus; }
public Fireball(Zerd zerd) : base(AbilityTypes.Fireball, zerd, AbilityConstants.FireballCooldown, AbilityConstants.FireballCastTime, AbilityConstants.FireballManaCost, "fireball") { zerd.AddCastingAnimation(AnimationTypes.FireAttack, AbilityConstants.FireballCastTime, AbilityConstants.FireballFollowThroughTime, Execute, Casted); }
public override void OnPickup(Zerd zerd) { IsActive = false; zerd.Mana += zerd.MaxMana * GameplayConstants.ManaPotionBonus; }
public override void OnPickup(Zerd zerd) { IsActive = false; zerd.TreasureChests.Add(this); }
public abstract void OnPickup(Zerd zerd);
public Charm(Zerd zerd) : base(AbilityTypes.Charm, zerd, AbilityConstants.CharmCooldown, AbilityConstants.CharmCastTime, AbilityConstants.CharmManaCost, "chained-heart") { zerd.AddCastingAnimation(AnimationTypes.Charm, AbilityConstants.CharmCastTime, AbilityConstants.CharmFollowThroughTime, Execute, Casted); }
public static void SaveZerd(Zerd zerd) { }
public SerializableZerd(Zerd zerd) { }
public FrostPound(Zerd zerd) : base(AbilityTypes.FrostPound, zerd, AbilityConstants.FrostPoundCooldown, AbilityConstants.FrostPoundCastTime, AbilityConstants.FrostPoundManaCost, "ice-punch") { zerd.AddCastingAnimation(AnimationTypes.FrostPoundAttack, AbilityConstants.FrostPoundCastTime, AbilityConstants.FrostPoundFollowThroughTime, Execute, Casted); }
public DragonBreath(Zerd zerd) : base(AbilityTypes.DragonsBreath, zerd, AbilityConstants.DragonBreathCooldown, TimeSpan.Zero, AbilityConstants.DragonBreathManaCost, "dragon-breath") { ZerdAnimationHelpers.AddDragonsBreathAnimation(zerd, Casted, Execute, MakeMissile); }
public LavaBlast(Zerd zerd) : base(AbilityTypes.LavaBlast, zerd, AbilityConstants.LavaBlastCooldown, AbilityConstants.LavaBlastCastTime, AbilityConstants.LavaBlastManaCost, "lava_blast") { zerd.AddCastingAnimation(AnimationTypes.LavaBlastAttack, AbilityConstants.LavaBlastCastTime, AbilityConstants.LavaBlastFollowThroughTime, Execute, Casted); }
public override void OnPickup(Zerd zerd) { IsActive = false; zerd.Keys.Add(this); }
public void Update(GameTime gameTime) { if (Zerd == null || !Zerd.IsAlive) { return; } var controller = InputService.InputDevices[PlayerIndex]; Zerd.ControllerUpdate(controller.LeftTrigger, controller.RightTrigger, controller.LeftStickDirection, controller.RightStickDirection); var buttonsPressed = InputService.InputDevices[PlayerIndex].ButtonsPressed; var buttonsReleased = InputService.InputDevices[PlayerIndex].ButtonsReleased; if (Zerd.GetCurrentAnimationType() == AnimationTypes.Stand || Zerd.GetCurrentAnimationType() == AnimationTypes.Move) { if (ChargeAbilities) { if (InputService.InputDevices[PlayerIndex].LeftStickIn) { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.FrostPound)?.StartCharge(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.DragonsBreath)?.StartCharge(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Icicle)?.StartCharge(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.LavaBlast)?.StartCharge(); } if (buttonsReleased.Contains(Buttons.A)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.FrostPound)?.ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.B)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.DragonsBreath)?.ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.X)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Icicle)?.ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.Y)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.LavaBlast)?.ReleaseCharge(); } } else { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Wand).StartCharge(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Iceball).StartCharge(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Fireball).StartCharge(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Dash).StartCharge(); } if (buttonsPressed.Contains(Buttons.RightShoulder)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Charm)?.StartCharge(); } if (buttonsReleased.Contains(Buttons.A)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Wand).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.B)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Iceball).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.X)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Fireball).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.Y)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Dash).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.RightShoulder)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Charm)?.ReleaseCharge(); } } } else { if (InputService.InputDevices[PlayerIndex].LeftStickIn) { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.FrostPound)?.Cast(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.DragonsBreath)?.Cast(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Icicle)?.Cast(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.LavaBlast)?.Cast(); } } else { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Wand).Cast(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Iceball).Cast(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Fireball).Cast(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Dash).Cast(); } if (buttonsPressed.Contains(Buttons.RightShoulder)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Charm)?.Cast(); } } } } if (InputService.InputDevices[PlayerIndex].RightTrigger > CodingConstants.TriggerPress && Zerd.Mana > 1) { Zerd.Mana -= Zerd.BootItem.SprintManaPerSecond * (float)gameTime.ElapsedGameTime.TotalSeconds * Globals.GameState.GameSpeed * (1 - Zerd.SkillValue(SkillType.Sprinter, false) / 100); if (!Zerd.Buffs.Any(b => b is SprintBuff)) { Zerd.Buffs.Add(new SprintBuff(Zerd, Zerd.BootItem.SprintBonus)); } } else { if (Zerd.Buffs.Any(b => b is SprintBuff)) { Zerd.Buffs.Remove(Zerd.Buffs.First(b => b is SprintBuff)); } } }