Esempio n. 1
0
        public void tntExplose(tnt tInfo, pinfo pi)
        {
            lvl.Blockchange(tInfo.x, (ushort)(gameZone.y + 1), tInfo.z, Block.air);

            bool canExplode = true;

            for (int i = 0; i < pi.puissanceTnt && canExplode; i++)
            {
                canExplode = createExplosion(pi, (ushort)(tInfo.x + i), tInfo.z);
            }

            canExplode = true;
            for (int i = 1; i < pi.puissanceTnt && canExplode; i++)
            {
                canExplode = createExplosion(pi, (ushort)(tInfo.x - i), tInfo.z);
            }

            canExplode = true;
            for (int i = 1; i < pi.puissanceTnt && canExplode; i++)
            {
                canExplode = createExplosion(pi, tInfo.x, (ushort)(tInfo.z + i));
            }

            canExplode = true;
            for (int i = 1; i < pi.puissanceTnt && canExplode; i++)
            {
                canExplode = createExplosion(pi, tInfo.x, (ushort)(tInfo.z - i));
            }
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public override bool changebloc(Player p, byte type, ushort x, ushort y, ushort z, byte action)
        {
            if (!gameOn)
            {
                return(true);
            }

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

            byte b = lvl.GetTile(x, y, z);

            if (y != gameZone.y + 1 || action == 0)
            {
                p.SendBlockchange(x, y, z, b); return(false);
            }

            if (type != Block.tnt && type != Block.wood)
            {
                p.SendBlockchange(x, y, z, b); return(false);
            }

            if (b != Block.air)
            {
                p.SendBlockchange(x, y, z, b); return(false);
            }

            if (lvl.GetTile(x, (ushort)(y - 1), z) == Block.lava)
            {
                p.SendBlockchange(x, y, z, b); return(false);
            }

            pinfo pi = players.Find(pin => pin.p == p);

            if (pi == null)
            {
                p.SendBlockchange(x, y, z, b); return(false);
            }

            if (type == Block.tnt)
            {
                if (pi.tnts.Count >= pi.nbTnt)
                {
                    p.SendBlockchange(x, y, z, b); return(false);
                }

                tnt tInfo = new tnt(x, z);
                pi.tnts.Add(tInfo);
                lvl.Blockchange(x, y, z, Block.tnt);
            }
            else if (type == Block.wood)
            {
                if (pi.nbWalls <= 0)
                {
                    p.SendBlockchange(x, y, z, b); return(false);
                }
                pi.nbWalls--;
                pi.overAllWalls++;

                p.addMessage("&eMurs : " + pi.nbWalls + " - Tnt : " + pi.nbTnt + " - Puissance : " + pi.puissanceTnt, true, 1);

                lvl.Blockchange(x, (ushort)(gameZone.y + 1), z, Block.wood);
                lvl.Blockchange(x, (ushort)(gameZone.y + 2), z, Block.wood);
                lvl.Blockchange(x, (ushort)(gameZone.y + 3), z, Block.wood);
            }
            else
            {
                p.SendBlockchange(x, y, z, b);
            }

            return(false);
        }