mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Move potion constants into a module.
This commit is contained in:
@@ -4,14 +4,21 @@ java_import 'org.apollo.game.model.entity.Skill'
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
DRINK_POTION_SOUND = 334
|
module Constants
|
||||||
EMPTY_VIAL_ID = 229
|
|
||||||
|
# The sound made when drinking a potion.
|
||||||
|
DRINK_POTION_SOUND = 334
|
||||||
|
|
||||||
|
# The id of an empty vial.
|
||||||
|
EMPTY_VIAL_ID = 229
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# A drinkable potion.
|
# A drinkable potion.
|
||||||
class Potion < Consumable
|
class Potion < Consumable
|
||||||
|
|
||||||
def initialize(id, name, doses)
|
def initialize(id, name, doses)
|
||||||
super(name, id, DRINK_POTION_SOUND)
|
super(name, id, Constants::DRINK_POTION_SOUND)
|
||||||
@doses = doses
|
@doses = doses
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24,7 +31,7 @@ class Potion < Consumable
|
|||||||
player.send_message("You have #{ @doses.length - index } dose#{ "s" unless index == 3 } of potion left.", true)
|
player.send_message("You have #{ @doses.length - index } dose#{ "s" unless index == 3 } of potion left.", true)
|
||||||
else
|
else
|
||||||
player.send_message('You drink the last of your potion.', true)
|
player.send_message('You drink the last of your potion.', true)
|
||||||
player.inventory.add(EMPTY_VIAL_ID)
|
player.inventory.add(Constants::EMPTY_VIAL_ID)
|
||||||
end
|
end
|
||||||
|
|
||||||
drink(player)
|
drink(player)
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ java_import 'org.apollo.game.model.def.ItemDefinition'
|
|||||||
java_import 'org.apollo.game.model.inter.EnterAmountListener'
|
java_import 'org.apollo.game.model.inter.EnterAmountListener'
|
||||||
java_import 'org.apollo.game.model.inter.dialogue.DialogueAdapter'
|
java_import 'org.apollo.game.model.inter.dialogue.DialogueAdapter'
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
WATER_VIAL_ID = 227
|
WATER_VIAL_ID = 227
|
||||||
EMPTY_VIAL_ID = 229
|
EMPTY_VIAL_ID = 229
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user