public override void OnInventoryUse()
        {
            float original = Game.PlayerCharacter.terminalVelocity.X;

            if (Game.PlayerCharacter.Buffs.AddBuff(new SpeedBuff(1, GameMathHelper.TimeToFrames(10), Game.PlayerCharacter)))
            {
                Game.PlayerManager.Inventory.DeleteItem(this);
            }
        }
        private void WindEarth(AnimatedSprite target)
        {
            List <AnimatedSprite> sp = CollisionDetection.GetNearby(target.SpriteRectangle, 75);

            foreach (AnimatedSprite i in sp)
            {
                if (i != Game.PlayerCharacter)
                {
                    i.Buffs.AddBuff(new WindyBuff(GameMathHelper.TimeToFrames(6), 2, i));
                }
            }
        }
Exemple #3
0
 public BurningBuff(int dur, int lvl, AnimatedSprite target) :
     base("Burning", dur, lvl, "You're burning!", texture: TextureHelper.Blank(Color.Red))
 {
     Target  = target;
     OnStart = () =>
     {
         if (timer == null)
         {
             timer = new TimerHelper(
                 GameMathHelper.TimeToFrames(0.3f - (0.3f / 20f * (lvl - 1f))),
                 () => { Target.AddHealthIgnoreInvincibility(-(1 + (lvl / 2))); }
                 );
         }
     };
     OnEnd = () =>
     {
         timer?.Delete();
         timer = null;
     };
 }
 public RegenerationBuff(int dur, int lvl, AnimatedSprite target) :
     base("Regeneration", dur, lvl, "Your wounds are healing", texture: TextureHelper.Blank(Color.LightPink))
 {
     Target  = target;
     OnStart = () =>
     {
         if (timer == null)
         {
             timer = new TimerHelper(
                 GameMathHelper.TimeToFrames(0.3f - (0.3f / 20f * (lvl - 1f))),
                 () => { Target.AddHealth(1 + (lvl / 2)); }
                 );
         }
     };
     OnEnd = () =>
     {
         timer?.Delete();
         timer = null;
     };
 }
Exemple #5
0
 public FrostbittenBuff(int dur, int lvl, AnimatedSprite target) : base("Frostbitten", dur, lvl, "You're really, really cold", texture: TextureHelper.Blank(Color.DarkBlue))
 {
     Target  = target;
     OnStart = () =>
     {
         if (timer == null)
         {
             target.terminalVelocity.X -= lvl * 30;
             timer = new TimerHelper(
                 GameMathHelper.TimeToFrames(1f - (1f / 100f * (lvl - 1f))),
                 () => { Target.AddHealthIgnoreInvincibility(-(1 + (lvl))); }
                 );
         }
     };
     OnEnd = () =>
     {
         target.terminalVelocity.X = AnimatedSprite.DefaultTerminalVelocity.X;
         timer?.Delete();
         timer = null;
     };
 }
Exemple #6
0
        public CathedralRuinsFBoss()
        {
            maxBounds = new Rectangle(0, 0, 10000, 10000);
            ContentManager Content = Game.GameContent;

            BackgroundLayer = new MapObject[]
            {
            };
            InteractableLayer = new MapInteractable[]
            {
                new MapInteractable(TextureHelper.Blank(Color.LightGreen), new Vector2(600, 2500), 50, 50, false, () => {
                    List <AnimatedSprite> sp = CollisionDetection.GetNearby(new Rectangle(600, 2500, 50, 50), 100);
                    foreach (AnimatedSprite i in sp)
                    {
                        i.Buffs.AddBuff(new RegenerationBuff(GameMathHelper.TimeToFrames(2), 10, i));
                    }
                }),

                new MapInteractable(TextureHelper.Blank(Color.Orange), new Vector2(500, 2800), 50, 50, false, () => {
                    List <AnimatedSprite> sp = CollisionDetection.GetNearby(new Rectangle(500, 2800, 50, 50), 100);
                    if (sp.Contains(Game.PlayerCharacter))
                    {
                        Game.PlayerCharacter.Buffs.AddBuff(new AttackSpeedBuff(-1, 5));
                        sp.Clear();
                    }
                }),

                new MapInteractable(TextureHelper.Blank(Color.LightBlue), new Vector2(600, 2800), 50, 50, true, () => {
                    List <AnimatedSprite> sp = CollisionDetection.GetNearby(new Rectangle(600, 2800, 50, 50), 100);
                    if (sp.Contains(Game.PlayerCharacter))
                    {
                        Game.PlayerCharacter.Buffs.AddBuff(new SpeedBuff(GameMathHelper.TimeToFrames(10), 2, Game.PlayerCharacter));
                    }
                }),

                new MapInteractable(TextureHelper.Blank(Color.White), new Vector2(700, 2800), 50, 50, true, () => {
                    AnimatedSprite temp;
                    temp = new AnimatedSprite(TextureHelper.Sprites.EnemySprite, 1, 1, 700, 2800,
                                              new BasicAI(Game.PlayerCharacter), new DefaultManager(10));
                    temp.AI.SupplyAI(temp);
                    temp.Load();
                    temp.SpriteRectangle.Width  = 50;
                    temp.SpriteRectangle.Height = 50;
                    RenderHandler.allCharacterSprites.Add(temp);
                }),

                new MapInteractable(TextureHelper.Blank(Color.DeepSkyBlue), new Vector2(800, 2800), 50, 50, true, () => {
                    List <AnimatedSprite> sp = CollisionDetection.GetNearby(new Rectangle(800, 2800, 50, 50), 100);
                    foreach (AnimatedSprite i in sp)
                    {
                        i.Buffs.AddBuff(new WindyBuff(GameMathHelper.TimeToFrames(10), 10, i));
                    }
                })
            };
            ActiveLayer = new MapObject[]
            {
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(0, 0), 1600, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(0, 0), 100, 500),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(0, 500), 800, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1200, 500), 500, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1600, 0), 100, 500),

                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(700, 600), 100, 1000),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1200, 600), 100, 1000),

                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(0, 1600), 800, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1200, 1600), 600, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(0, 1600), 100, 1500),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1700, 1600), 100, 900),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1700, 2800), 100, 300),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(0, 3100), 1800, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(300, 2925), 1400, 50),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(100, 2600), 700, 50),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1000, 2750), 400, 50),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(300, 2200), 1200, 50),

                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1800, 2800), 800, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(1800, 2400), 800, 100),

                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(2600, 2800), 100, 300),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(2600, 3100), 400, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(3200, 3100), 400, 100),
                new MapObject(TextureHelper.Blank(Color.DarkGray), new Vector2(3600, 1200), 100, 2000),
            };
            ForegroundLayer = new MapObject[]
            {
            };
        }
Exemple #7
0
        public WindyBuff(int dur, int lvl, AnimatedSprite target) : base("Windy", dur, lvl, "It's too windy to control!", texture: TextureHelper.Blank(Color.Tan))
        {
            Random rand = new Random();

            OnStart = () =>
            {
                if (timer == null)
                {
                    timer = new TimerHelper(
                        GameMathHelper.TimeToFrames(1f - (1f / 20f * (lvl - 1f))),
                        () => {
                        int bounds = lvl * 300;
                        int x      = rand.Next(-bounds, bounds);
                        int y      = rand.Next(-bounds, bounds);
                        if (y < 0 && target.North)
                        {
                            y = 0;
                        }
                        else if (y > 0 && target.South)
                        {
                            y = 0;
                        }

                        if (x > 0 && target.East)
                        {
                            x = 0;
                        }
                        else if (x < 0 && target.West)
                        {
                            x = 0;
                        }

                        if (y < -target.terminalVelocity.Y)
                        {
                            y = (int)-target.terminalVelocity.Y;
                        }
                        else if (y > target.terminalVelocity.Y)
                        {
                            y = (int)target.terminalVelocity.Y;
                        }

                        if (x < -target.terminalVelocity.X)
                        {
                            x = (int)-target.terminalVelocity.X;
                        }
                        else if (x > target.terminalVelocity.X)
                        {
                            x = (int)target.terminalVelocity.X;
                        }

                        target.velocity += new Vector2(x, y);
                    }
                        );
                }
            };
            OnEnd = () =>
            {
                timer?.Delete();
                timer = null;
            };
        }
        public override void ProjectileAction(AnimatedSprite source, AnimatedSprite target)
        {
            switch (spellType)
            {
            // Fire Attack
            case Caster.SpellType.FIRE:
                target.AddHealth(-Damage);

                // Fire + Ice
                if (target.Buffs.HasBuff(typeof(SlowBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(SlowBuff));
                    FireIce(target);
                }

                // Fire + Wind
                else if (target.Buffs.HasBuff(typeof(DamageReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DamageReductionBuff));
                    FireWind(target);
                }

                // Fire + Earth
                else if (target.Buffs.HasBuff(typeof(DefenseReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DefenseReductionBuff));
                    FireEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new BurningBuff(GameMathHelper.TimeToFrames(3), 1, target));
                }
                break;

            // Ice Attack
            case Caster.SpellType.ICE:
                target.AddHealth(-Damage);

                // Fire + Ice
                if (target.Buffs.HasBuff(typeof(BurningBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(BurningBuff));
                    FireIce(target);
                }

                // Ice + Wind
                else if (target.Buffs.HasBuff(typeof(DamageReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DamageReductionBuff));
                    IceWind(target);
                }

                // Ice + Earth
                else if (target.Buffs.HasBuff(typeof(DefenseReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DefenseReductionBuff));
                    IceEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new SlowBuff(GameMathHelper.TimeToFrames(3), 2, target));
                }
                break;

            // Wind Attack
            case Caster.SpellType.WIND:
                target.AddHealth(-Damage);

                // Fire + Wind
                if (target.Buffs.HasBuff(typeof(BurningBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(BurningBuff));
                    FireWind(target);
                }

                // Ice + Wind
                else if (target.Buffs.HasBuff(typeof(SlowBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(SlowBuff));
                    IceWind(target);
                }

                // Wind + Earth
                else if (target.Buffs.HasBuff(typeof(DefenseReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DefenseReductionBuff));
                    WindEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new DamageReductionBuff(GameMathHelper.TimeToFrames(3), 1, target));
                }
                break;

            // Earth Attack
            case Caster.SpellType.EARTH:
                target.AddHealth(-Damage);

                // Fire + Earth
                if (target.Buffs.HasBuff(typeof(BurningBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(BurningBuff));
                    FireEarth(target);
                }

                // Ice + Earth
                else if (target.Buffs.HasBuff(typeof(SlowBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(SlowBuff));
                    IceEarth(target);
                }

                // Wind + Earth
                else if (target.Buffs.HasBuff(typeof(DamageReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DamageReductionBuff));
                    WindEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new DefenseReductionBuff(GameMathHelper.TimeToFrames(3), 1, target));
                }
                break;

            default:
                target.AddHealth(-Damage);
                break;
            }

            Delete();
        }