Permalink
Browse files

Generalize gold to currency

  • Loading branch information...
Mikolaj committed Dec 9, 2012
1 parent 0a85b7c commit 9c843f164faea7c05e9cb0ba2b031c3af1012b14
Showing with 20 additions and 12 deletions.
  1. +14 −6 Game/LambdaHack/EffectAction.hs
  2. +1 −1 Game/LambdaHack/ItemAction.hs
  3. +4 −4 LambdaHack/Content/ItemKind.hs
  4. +1 −1 PLAYING.md
@@ -360,7 +360,7 @@ switchLevel nln = do
-- | The player leaves the dungeon.
fleeDungeon :: Action ()
fleeDungeon = do
- Kind.COps{coitem} <- getCOps
+ Kind.COps{coitem=coitem@Kind.Ops{oname, ouniqGroup}} <- getCOps
s <- get
go <- displayYesNo "This is the way out. Really leave now?"
recordHistory -- Prevent repeating the ending msgs.
@@ -377,8 +377,12 @@ fleeDungeon = do
"This time try to grab some loot before escape!"
when (not go2) $ abortWith "Here's your chance!"
else do
- let winMsg = "Congratulations, you won! Here's your loot, worth" <+>
- showT total <+> "gold." -- TODO: use the name of the '$' item instead and pluralise correctly
+ let currencyName = MU.Text $ oname $ ouniqGroup "currency"
+ winMsg = makePhrase
+ [ "Congratulations, you won!"
+ , "Here's your loot, worth"
+ , MU.NWs total currencyName
+ , "." ]
io <- itemOverlay True True items
tryIgnore $ displayOverAbort winMsg io
modify (\ st -> st {squit = Just (True, Victor)})
@@ -535,7 +539,7 @@ gameOver showEndingScreens = do
slid <- gets slid
modify (\ st -> st {squit = Just (False, Killed slid)})
when showEndingScreens $ do
- Kind.COps{coitem} <- getCOps
+ Kind.COps{coitem=coitem@Kind.Ops{oname, ouniqGroup}} <- getCOps
s <- get
dng <- gets sdungeon
time <- gets stime
@@ -554,8 +558,12 @@ gameOver showEndingScreens = do
"That is your name. 'Almost'."
| otherwise =
"Dead heroes make better legends."
- loseMsg = failMsg <+> "You left" <+>
- showT total <+> "gold and some junk." -- TODO: use the name of the '$' item instead and pluralise correctly
+ currencyName = MU.Text $ oname $ ouniqGroup "currency"
+ loseMsg = makePhrase
+ [ failMsg
+ , "You left"
+ , MU.NWs total currencyName
+ , "and some junk." ]
if null items
then modify (\ st -> st {squit = Just (True, Killed slid)})
else do
@@ -445,7 +445,7 @@ pickupItem = do
-- that messages are printed to the player only if the
-- hero can perceive the action.
--- TODO: you can drop an item already the floor, which works correctly,
+-- TODO: you can drop an item already on the floor, which works correctly,
-- but is weird and useless.
allObjectsName :: Text
@@ -16,9 +16,9 @@ cdefs = CDefs
, getFreq = ifreq
, validate = ivalidate
, content =
- [amulet, dart, gem1, gem2, gem3, gold, harpoon, potion1, potion2, potion3, ring, scroll1, scroll2, scroll3, sword, wand, fist, foot, tentacle, weight]
+ [amulet, dart, gem1, gem2, gem3, currency, harpoon, potion1, potion2, potion3, ring, scroll1, scroll2, scroll3, sword, wand, fist, foot, tentacle, weight]
}
-amulet, dart, gem1, gem2, gem3, gold, harpoon, potion1, potion2, potion3, ring, scroll1, scroll2, scroll3, sword, wand, fist, foot, tentacle, weight :: ItemKind
+amulet, dart, gem1, gem2, gem3, currency, harpoon, potion1, potion2, potion3, ring, scroll1, scroll2, scroll3, sword, wand, fist, foot, tentacle, weight :: ItemKind
gem, potion, scroll :: ItemKind -- generic templates
@@ -72,10 +72,10 @@ gem2 = gem
gem3 = gem
{ icount = (RollDice 0 0, RollDice 1 3) -- appears on max depth
}
-gold = ItemKind
+currency = ItemKind
{ isymbol = '$'
, iname = "gold piece"
- , ifreq = [("dng", 80)]
+ , ifreq = [("dng", 80), ("currency", 1)]
, iflavour = zipPlain [BrYellow]
, ieffect = NoEffect
, icount = (RollDice 0 0, RollDice 10 10)
View
@@ -154,7 +154,7 @@ On Winning and Dying
--------------------
You win the game if you escape the dungeon alive. Your score is
-the sum of all gold you've plundered plus 100gp for each gem.
+the sum of all gold you've plundered plus 100 gold pieces for each gem.
Only the loot in possession of the party members on the current level
counts (the rest of the party is considered MIA).

0 comments on commit 9c843f1

Please sign in to comment.