mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 00:38:46 +00:00
Remove minor repetition in potions.rb.
This commit is contained in:
@@ -13,12 +13,12 @@ class Potion < Consumable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def consume(player)
|
def consume(player)
|
||||||
index = @doses.find_index(id)
|
index = @doses.find_index(id) + 1
|
||||||
|
|
||||||
unless index + 1 == @doses.length
|
unless index == @doses.length
|
||||||
player.inventory.add(@doses[index + 1])
|
player.inventory.add(@doses[index])
|
||||||
player.send_message("You drink some of your #{name} potion.", true)
|
player.send_message("You drink some of your #{name} potion.", true)
|
||||||
player.send_message("You have #{@doses.length - index - 1} dose#{"s" unless index == 2} 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.')
|
player.send_message('You drink the last of your potion.')
|
||||||
player.inventory.add(EMPTY_VIAL_ID)
|
player.inventory.add(EMPTY_VIAL_ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user