Skip to content
This repository has been archived by the owner on Jul 4, 2020. It is now read-only.

Commit

Permalink
allow taking a duplicate item from the room if you already carry one. f…
Browse files Browse the repository at this point in the history
…ixes #34
  • Loading branch information
irmen committed Nov 27, 2018
1 parent c5d4452 commit 1fca1f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tale/cmds/normal.py
Expand Up @@ -357,7 +357,7 @@ def do_loot(player: Player, parsed: base.ParseResult, ctx: util.Context) -> None

@cmd("take", "get", "steal", "rob")
def do_take(player: Player, parsed: base.ParseResult, ctx: util.Context) -> None:
"""Take something (or all things) from something or someone else.
"""Take something (or all things) from the room, or something or someone else.
Keep in mind that stealing and robbing is frowned upon, to say the least."""
p = player.tell
if len(parsed.args) == 0:
Expand Down Expand Up @@ -440,7 +440,12 @@ def do_take(player: Player, parsed: base.ParseResult, ctx: util.Context) -> None
raise ActionRefused("You can't pick that up.")
elif item not in player.location.livings:
if item in player:
p("You've already got it.")
other_item = player.search_item(item.name, False, True, False) # look outside of inventory
if other_item:
p("There's another one here!")
items_to_take.append(other_item)
else:
p("You've already got it.")
else:
p("There's no %s here." % item.name)
take_stuff(player, items_to_take, player.location)
Expand Down

0 comments on commit 1fca1f8

Please sign in to comment.