Skip to content

Commit

Permalink
✨ Prompt to dispose of leftover monsters
Browse files Browse the repository at this point in the history
When combat ends, we used to just dump all the monsters that were in the
current combat group. This leads to losing NPCs or similar friendlies
that we might want to stick around for a subsequent encounter.

Now we prompt for each "leftover" monster that still remains at the end
of combat to let the user decide to keep them in the combat group, stash
them, or remove them entirely from play.

Sort of kind of addresses the need in #29 without directly implementing
full on NPCs that need special data modeling etc.
  • Loading branch information
mpirnat committed Jun 29, 2019
1 parent 524b67a commit f0f67ae
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion dndme/commands/end_combat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import math
from dndme.commands import Command
from dndme.commands.remove_combatant import RemoveCombatant
from dndme.commands.show import Show
from dndme.commands.stash_combatant import StashCombatant


class EndCombat(Command):
Expand All @@ -24,7 +26,20 @@ def do_command(self, *args):
combat.tm = None
Show.show_defeated(self)
combat.defeated = []
combat.monsters = {}

# Allow some leftover monsters to remain in the combat group;
# perhaps some are friendly NPCs along for the ride?
for monster in list(combat.monsters.values()):
choice = self.session.prompt(
f"What should we do with {monster.name}? "
"[R]emove [S]tash [K]eep (default: Keep) "
).lower()
if choice in ('r', 'remove'):
RemoveCombatant.do_command(self, monster.name)
elif choice in ('s', 'stash'):
StashCombatant.do_command(self, monster.name)
else:
print(f"Okay, keeping {monster.name}")

if cur_turn:
rounds = cur_turn[0]
Expand Down

0 comments on commit f0f67ae

Please sign in to comment.