useWeaponOnCell

useWeaponOnCell

> Funções

Usa a arma equipada na célula cell.

Exemplo: usar a pistola no inimigo mais próximo:

var enemyCell = getCell(getNearestEnemy())
setWeapon(WEAPON_PISTOL)
useWeaponOnCell(enemyCell)
const enemyCell = Fight.getNearestEnemy().cell
Fight.me.setWeapon(Weapon.pistol)
Fight.me.useWeaponOnCell(enemyCell)
enemyCell = Fight.getNearestEnemy().cell
Fight.me.setWeapon(Weapon.pistol)
Fight.me.useWeaponOnCell(enemyCell)
Parâmetros
Retorno

Como USE_SUCCESS e USE_CRITICAL valem 1 e 2 respectivamente, e os outros valores são 0 ou negativos, é possível saber se a arma foi usada com sucesso com este teste:

if (useWeaponOnCell(cell) > 0) {
	// Funcionou!
} else {
	// Falhou!
}
if (Fight.me.useWeaponOnCell(cell) > 0) {
	// Funcionou!
} else {
	// Falhou!
}
if Fight.me.useWeaponOnCell(cell) > 0:
	pass  # Funcionou!
else:
	pass  # Falhou!
Veja também