示例#1
0
        public void Hit(Bullet b)
        {
            Vector2 veloc = new Vector2((float)Math.Cos(b.Angle),
                (float)Math.Sin(b.Angle));
            veloc.Normalize();
            veloc *= 3;
            velocity += veloc;

            // special potions
            if (World.PlayerHash[b.PlayerID].statusEffect == StatusEffect.vampire)
            {
                World.PlayerHash[b.PlayerID].Health += b.Damage / 3;
            }
            if (World.PlayerHash[b.PlayerID].statusEffect == StatusEffect.curse)
            {
                statusColor = Color.DarkGreen;
                statusEffect = MultiDungeon.StatusEffect.cursed;
                ResetStatusTimer();
            }

            if (World.PlayerHash[b.PlayerID].statusEffect == StatusEffect.invinsible)
            {
                b.Angle += (float)(Math.PI + ((GameConst.rand.NextDouble() * (Math.PI / 7)) - Math.PI / 14));
            }
            else
            {
                if (World.gameId == id)
                {
                    health -= b.Damage / Weakness;
                }
            }

            if (health <= 0 && alive)
            {
                Client.Send("kill\n" + id + "!");
                if (World.gameId == id)
                {

                    if (alive)
                    {
                        if (teamNum != World.PlayerHash[b.PlayerID].Team)
                        {
                            int bonus = World.PlayerHash[b.PlayerID].StatusEffect == MultiDungeon.StatusEffect.midas ? 100 : 50;
                            World.PlayerHash[b.PlayerID].Gold += 50 + bonus;
                            Client.Send("gold\n" + b.PlayerID + "\n" + "50!");
                        }
                        else
                        {
                            World.PlayerHash[b.PlayerID].Gold -= 50;
                            Client.Send("gold\n" + b.PlayerID + "\n" + "-50!");
                        }
                    }
                    Die();
                }
            }
            else
            {
                for (int i = 0; i < 4; i++)
                {
                    int x = DrawRect.Left + GameConst.rand.Next(DrawRect.Width);
                    int y = DrawRect.Top + GameConst.rand.Next(DrawRect.Height);
                    World.BulletManager.AddParticle(new BloodParticle(new
                        Vector2(x, y)));
                }
            }
        }
示例#2
0
 public void Remove(Bullet b)
 {
     toRemove.Add(b);
 }
示例#3
0
 public void Add(Bullet b)
 {
     toAdd.Add(b);
 }
示例#4
0
 public void HandleExplosion(Vector2 pos, Bullet b)
 {
     SoundManager.PlaySound("explosion");
     foreach (Player p in World.Players)
     {
         float dist = Vector2.Distance(p.Position, pos);
         if (dist < 130)
         {
             p.Hit(b);
         }
     }
 }