DEADSOFTWARE

Add food
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / model / item / Item.kt
index bf2a55cd6a9d164870c6d4ebb8339310a0bece86..9b2c62de4794111b4edab8bb332af7a0a99f5809 100644 (file)
@@ -50,6 +50,11 @@ sealed class Item {
         return this is Usable
     }
 
+    fun isFood(): Boolean {
+        contract { returns(true) implies (this@Item is Food) }
+        return this is Food
+    }
+
     @JvmOverloads
     fun toInventoryItem(amount: Int = 1): InventoryItem {
         return InventoryItem(this, amount)
@@ -137,4 +142,10 @@ sealed class Item {
         override val level: Int,
     ) : Tool()
 
+    data class Food(
+        override val params: CommonItemParams,
+        override val sprite: Sprite,
+        val heal: Int,
+    ) : Item()
+
 }
\ No newline at end of file