diff --git a/core/src/ru/deadsoftware/cavedroid/game/model/item/Item.kt b/core/src/ru/deadsoftware/cavedroid/game/model/item/Item.kt
index 2b6b5fcd2498e82c29e925a685473dafd1d0e360..9b2c62de4794111b4edab8bb332af7a0a99f5809 100644 (file)
return this is Slab
}
-
fun isTool(): Boolean {
contract { returns(true) implies (this@Item is Tool) }
return this is Tool
}
+ fun isShears(): Boolean {
+ contract { returns(true) implies (this@Item is Shears) }
+ return this is Shears
+ }
+
fun isUsable(): Boolean {
- contract { returns(true) implies (this@Item is Placeable) }
- return this is Placeable
+ contract { returns(true) implies (this@Item is Usable) }
+ 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)
}
-
+
+ data class Normal(
+ override val params: CommonItemParams,
+ override val sprite: Sprite
+ ) : Item()
+
sealed class Tool : Item() {
abstract val mobDamageMultiplier: Float
abstract val blockDamageMultiplier: Float
abstract val level: Int
}
- sealed class Usable : Item() {
- abstract val useActionKey: String
- }
-
sealed class Placeable : Item() {
abstract val block: BlockModel
override val sprite: Sprite get() = block.sprite
get() = throw IllegalAccessException("Trying to get sprite of None")
}
+ data class Usable(
+ override val params: CommonItemParams,
+ override val sprite: Sprite,
+ val useActionKey: String
+ ) : Item()
+
data class Block(
override val params: CommonItemParams,
override val block: BlockModel
override val blockDamageMultiplier: Float,
override val level: Int,
) : Tool()
-
- data class Bucket(
+
+ data class Food(
override val params: CommonItemParams,
override val sprite: Sprite,
- override val useActionKey: String
- ) : Usable()
+ val heal: Int,
+ ) : Item()
}
\ No newline at end of file