mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
@@ -6,15 +6,22 @@ CONSUMABLES = {}
|
||||
# The id of the food consumption animation.
|
||||
CONSUME_ANIMATION_ID = 829
|
||||
|
||||
# Contains the different types of consumables
|
||||
module ConsumableType
|
||||
FOOD = 1
|
||||
POTION = 2
|
||||
end
|
||||
|
||||
# An item that can be consumed to produce a skill effect.
|
||||
class Consumable
|
||||
attr_reader :name, :id, :sound, :delay
|
||||
attr_reader :name, :id, :sound, :delay, :type
|
||||
|
||||
def initialize(name, id, sound, delay)
|
||||
def initialize(name, id, sound, delay, type)
|
||||
@name = name.to_s.gsub(/_/, ' ')
|
||||
@id = id
|
||||
@sound = sound
|
||||
@delay = delay
|
||||
@type = type
|
||||
end
|
||||
|
||||
def consume(_player)
|
||||
@@ -55,7 +62,7 @@ class ConsumeAction < Action
|
||||
end
|
||||
|
||||
def equals(other)
|
||||
mob == other.mob
|
||||
mob == other.mob && @consumable.type == other.consumable.type
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ EAT_FOOD_SOUND = 317
|
||||
class Food < Consumable
|
||||
|
||||
def initialize(name, id, restoration, replace, delay)
|
||||
super(name, id, EAT_FOOD_SOUND, delay)
|
||||
super(name, id, EAT_FOOD_SOUND, delay, ConsumableType::FOOD)
|
||||
@restoration = restoration
|
||||
@replace = replace
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ end
|
||||
class Potion < Consumable
|
||||
|
||||
def initialize(id, name, doses)
|
||||
super(name, id, Constants::DRINK_POTION_SOUND, Constants::POTION_DELAY)
|
||||
super(name, id, Constants::DRINK_POTION_SOUND, Constants::POTION_DELAY, ConsumableType::POTION)
|
||||
@doses = doses
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user