Beispiel #1
0
        public void killPlayer(Player p, tntExp tE)
        {
            if (p.lastDeath.AddSeconds(2) > DateTime.Now)
            {
                return;
            }
            pinfo pi = players.Find(pin => pin.p == p);

            if (pi == null)
            {
                return;
            }

            pi.lastKill     = 0;
            pi.nbWalls      = 4;
            pi.nbTnt        = 2;
            pi.puissanceTnt = 4;
            pi.nbDeaths++;
            pi.nbPoints--;

            p.addMessage("&eMurs : " + pi.nbWalls + " - Tnt : " + pi.nbTnt + " - Puissance : " + pi.puissanceTnt, true, 1);
            p.addMessage("&eKills : " + pi.nbKills + " - Morts : " + pi.nbDeaths + " - lastKills : " + pi.lastKill, true, 2);

            if (tE.pi == null)
            {
                p.HandleDeath(Block.stone, "&c explose.");
            }
            else
            {
                if (tE.pi.p == p)
                {
                    p.HandleDeath(Block.stone, "&c explose dans sa propre tnt !");
                }
                else
                {
                    p.HandleDeath(Block.stone, "&c explose dans la tnt de " + tE.pi.p.color + tE.pi.p.Name());
                }

                if (tE.pi.p != p)
                {
                    tE.pi.nbKills++;
                    tE.pi.lastKill++;
                    tE.pi.nbPoints += tE.pi.lastKill;
                    if (tE.pi.lastKill == 5)
                    {
                        Player.GlobalMessageLevel(lvl, tE.pi.p.color + tE.pi.p.Name() + Server.DefaultColor + " - quintuple kills !");
                    }
                    if (tE.pi.lastKill == 10)
                    {
                        Player.GlobalMessageLevel(lvl, tE.pi.p.color + tE.pi.p.Name() + Server.DefaultColor + " - expert ! 10 kills !");
                    }
                    if (tE.pi.lastKill == 20)
                    {
                        Player.GlobalMessageLevel(lvl, tE.pi.p.color + tE.pi.p.Name() + Server.DefaultColor + " - 20 kills ! Bomberman !");
                    }
                    tE.pi.p.addMessage("&eKills : " + tE.pi.nbKills + " - Morts : " + tE.pi.nbDeaths + " - lastKills : " + tE.pi.lastKill, true, 2);
                }
            }
        }
Beispiel #2
0
        public bool createExplosion(pinfo pi, ushort x, ushort z)
        {
            tntExp tE = new tntExp();

            tE.pi = pi; tE.x = x; tE.z = z;

            bool explodeNext = true;

            if (gameZone.xMin > tE.x || gameZone.xMax < tE.x || gameZone.zMin > tE.z || gameZone.zMax < tE.z)
            {
                return(false);
            }
            byte b = lvl.GetTile(tE.x, (ushort)(gameZone.y + 1), tE.z);

            if (b == Block.blackrock)
            {
                return(false);
            }

            if (b == Block.water)
            {
                removeBonus(tE.x, tE.z);
                explodeNext = false;
            }
            if (b == Block.wood)
            {
                lvl.Blockchange(tE.x, (ushort)(gameZone.y + 1), tE.z, Block.air);
                lvl.Blockchange(tE.x, (ushort)(gameZone.y + 2), tE.z, Block.air);
                lvl.Blockchange(tE.x, (ushort)(gameZone.y + 3), tE.z, Block.glass);
                explodeNext = false;
            }

            if (lvl.GetTile(tE.x, gameZone.y, tE.z) != Block.lava)
            {
                explose.Add(tE);
                lvl.Blockchange(tE.x, gameZone.y, tE.z, Block.lava);
            }

            if (b == Block.tnt)
            {
                for (int i = 0; i < players.Count; i++)
                {
                    if (players[i].tnts.Count == 0)
                    {
                        continue;
                    }

                    tnt ptnt = players[i].tnts.Find(t => t.x == tE.x && t.z == tE.z);
                    if (ptnt == null)
                    {
                        continue;
                    }
                    tntExplose(ptnt, players[i]);
                }
            }
            return(explodeNext);
        }
Beispiel #3
0
        public override bool checkPos(Player p, ushort x, ushort y, ushort z)
        {
            if (!gameOn)
            {
                return(true);
            }

            if (portails.Exists(po => po.x == x && po.y == y && po.z == z))
            {
                jumpPortail(p);
            }
            if (portails.Exists(po => po.x == x && po.y == y - 1 && po.z == z))
            {
                jumpPortail(p);
            }

            if (x > gameZone.xMax || x < gameZone.xMin || y > gameZone.y + 2 || y < gameZone.y || z > gameZone.zMax || z < gameZone.zMin)
            {
                return(true);
            }

            byte b  = lvl.GetTile(x, (ushort)(y - 1), z);
            byte b1 = lvl.GetTile(x, (ushort)(y - 2), z);

            if (b == Block.lava || b1 == Block.lava)
            {
                tntExp tExplose = explose.Find(tE => tE.x == x && tE.z == z);
                if (tExplose == null)
                {
                    lvl.Blockchange(x, gameZone.y, z, Block.darkgrey); return(true);
                }
                killPlayer(p, tExplose);
                return(false);
            }
            else if (b == Block.water || b1 == Block.water)
            {
                int boIndex = bonus.FindIndex(bo => bo.x == x && bo.z == z);
                if (boIndex == -1)
                {
                    lvl.Blockchange(x, gameZone.y, z, Block.darkgrey);
                    lvl.Blockchange(x, (ushort)(gameZone.y + 1), z, Block.air);
                    lvl.Blockchange(x, (ushort)(gameZone.y + 2), z, Block.air);
                    lvl.Blockchange(x, (ushort)(gameZone.y + 3), z, Block.glass);
                    return(true);
                }
                takeBonus(p, x, z, boIndex);
            }

            return(true);
        }