fix: bombs are making NaN amount of damage

This commit is contained in:
minjaesong
2024-02-15 17:35:56 +09:00
parent 2363a5c51f
commit 84dcc95fc0
4 changed files with 64 additions and 15 deletions

View File

@@ -645,6 +645,8 @@ open class GameWorld(
* @return true if block is broken
*/
fun inflictTerrainDamage(x: Int, y: Int, damage: Double): ItemID? {
if (damage.isNaN()) throw IllegalArgumentException("Cannot inflict NaN amount of damage at($x, $y)")
val damage = damage.toFloat()
val addr = LandUtil.getBlockAddr(this, x, y)
@@ -679,6 +681,8 @@ open class GameWorld(
* @return true if block is broken
*/
fun inflictWallDamage(x: Int, y: Int, damage: Double): ItemID? {
if (damage.isNaN()) throw IllegalArgumentException("Cannot inflict NaN amount of damage at($x, $y)")
val damage = damage.toFloat()
val addr = LandUtil.getBlockAddr(this, x, y)