public class TimeBomb
{
	public int id;

	public int x;

	public int y;

	public int turn;

	public bool isExplore;

	public bool isFall;

	public bool falling;

	public static Image timeBomb;

	public sbyte percentRemove;

	private int dy;

	public TimeBomb(int id, int x, int y, int turn)
	{
		this.id = id;
		this.x = x;
		this.y = y;
		this.turn = turn;
		new Explosion(x, y, 1);
		if (timeBomb == null)
		{
			timeBomb = CCanvas.loadImage("/eff/thuocno.png");
		}
	}

	public void paint(mGraphics g)
	{
		int num = ((CCanvas.gameTick % 3 != 0) ? 1 : 0);
		g.drawRegion(timeBomb, 0, num * 15, 28, 15, 0, x, y, mGraphics.HCENTER | mGraphics.BOTTOM, false);
		if (CCanvas.gameTick % 10 > 5)
		{
			mFont.tahoma_7b_white.drawString(g, turn + string.Empty, x - 18, y - 10, 1, mFont.tahoma_7b_dark);
		}
		if (percentRemove != 0)
		{
			if (CCanvas.gameTick % 10 > 5)
			{
				SmallImage.drawSmallImage(g, 1698, x, y + 18, 0, 3, false);
			}
			else
			{
				SmallImage.drawSmallImage(g, 1699, x, y + 18, 0, 3, false);
			}
			g.setColor(16777215);
			g.fillRect(x - 10, y + 10, 20, 5, false);
			g.setColor(16711680);
			g.fillRect(x - 9, y + 11, 18, 3, false);
			g.setColor(16777215);
			int w = 18 * percentRemove / 100;
			g.fillRect(x - 9, y + 11, w, 3, false);
		}
	}

	public void update()
	{
		if (isExplore)
		{
			Camera.shaking = 2;
			int[][] pointAround = GameScr.getPointAround(this.x, this.y, 7);
			for (int i = 0; i < 7; i++)
			{
				new Explosion(pointAround[0][i], pointAround[1][i], 7);
			}
			mSystem.mNotify();
			GameScr.timeBombs.removeElement(this);
		}
		if (isFall)
		{
			falling = true;
			for (int j = 0; j < 14; j++)
			{
				if (GameScr.mm.isLand(this.x - 7 + j, this.y))
				{
					falling = false;
					dy = 0;
					break;
				}
			}
			isFall = false;
		}
		if (!falling)
		{
			return;
		}
		int x = this.x;
		int y = this.y;
		dy++;
		this.y += dy;
		for (int k = 0; k < 14; k++)
		{
			if (GameScr.mm.isLand(this.x - 7 + k, this.y))
			{
				falling = false;
				dy = 0;
				int[] collisionPoint = Bullet.getCollisionPoint(x, y, this.x, this.y);
				if (collisionPoint != null)
				{
					this.y = collisionPoint[1];
				}
				break;
			}
		}
	}
}
