Ejemplo n.º 1
0
        public void OnDeath(PlayingScreen p)
        {
            if (IsPlayer)
            {
                //addScreen.DeathScreen();
                IsTriggeredDeath = true;
                return;
            }
            Nemesis.ModifyResourceValue("xp", MaxExp);
            var rnd = Rng.Noxt(3);

            if (rnd == 1)
            {
                p.ScreenManager.GetScreen <PlayingScreen>().items.Add(new Usable(UsableType.HealthPot, PlayingScreen.itemSheet)
                {
                    Position = new Vector2(Position.X + Rng.Noxt(-10, 10), Position.Y + Rng.Noxt(-10, 10))
                });
            }
            if (rnd == 2)
            {
                p.ScreenManager.GetScreen <PlayingScreen>().items.Add(new Usable(UsableType.ManaPot, PlayingScreen.itemSheet)
                {
                    Position = new Vector2(Position.X + Rng.Noxt(-10, 10), Position.Y + Rng.Noxt(-10, 10))
                });
            }

            IsTriggeredDeath = true;
        }
Ejemplo n.º 2
0
        public void Use(Item item, LivingObject o)
        {
            var i = item.GetItem <Usable>();

            switch (i.type)
            {
            case UsableType.HealthPot:
                if (o.Health >= o.MaxHealth)
                {
                    Console.WriteLine("full hp");
                    return;
                }
                Console.WriteLine("hp restored: " + i.Value);
                o.ModifyResourceValue("hp", i.Value);
                break;

            case UsableType.ManaPot:
                o.Mana += i.Value;
                break;
            }
            i.Exist = false;
        }