getCellToUseWeapon

getCellToUseWeapon([number weapon], number entity, [array<integer> ignoredCells]) → integer cell

Returns a cell from which your entity can use the weapon weapon on the entity entity. It is the closest one your entity can reach by moving, with no movement point limit: it may be several turns away. If no cell is reachable (for example if your entity is surrounded), the function returns -1, even when getCellsToUseWeapon finds some.

Example of using the Laser:

var cell = getCellToUseWeapon(WEAPON_LASER, enemy)
moveTowardCell(cell)
useWeapon(enemy)
const cell = Fight.me.weaponCell(enemy, Weapon.laser)
Fight.me.moveToward(cell)
Fight.me.useWeapon(enemy)
cell = Fight.me.weaponCell(enemy, Weapon.laser)
Fight.me.moveToward(cell)
Fight.me.useWeapon(enemy)
Parameters
Return