 		], "should update indexes if participant has gone"
 
 
-	res = game._leaveBattle(tx, 1, 3, 'user')
+	res = game._leaveBattle(conn, 1, 3, 'user')
 	test.strictEqual res.battleEnded, true, 'should return true if battle was ended'
 
 	test.strictEqual query.val("SELECT autoinvolved_fm FROM characters WHERE id=2"), false,

		maxDmg = (power - 50) / 2 * 1.2
		victim_id = 1

		tx = transaction(conn)

		damages = {}
		prevHP = 1000

		for i in [0..100]
			hp = game._hitAndGetHealth tx, victim_id, power
			hpActual = query.val "SELECT health FROM characters WHERE id=$1", [victim_id]
			test.strictEqual hp, hpActual, "should return current characters's health"


		damages = null

		userHP = -> query.val 'SELECT health FROM characters WHERE id=1'
		totalStr = -> query.val 'SELECT SUM(strength) FROM items'

		performSomeAttacks = ->
			damages = {}
			tx = transaction(conn)
			for i in [0..20]
				prevHP = userHP()
				prevSt = totalStr()

				hp = game._hitAndGetHealth tx, 1, power
				dmg = prevHP - hp
				damages[dmg] = true

				if dmg is 0
					test.ok prevSt > totalStr(), 'should reduce armor strength if damage was blocked'
			tx.rollback.sync(tx)


