Permalink
Browse files

add some magical jewelery

  • Loading branch information...
Mikolaj committed Mar 30, 2011
1 parent e194de9 commit 899ffb3fbd1dd8048219d94b0cba3d3ddf5924f1
Showing with 49 additions and 34 deletions.
  1. +16 −7 src/Actions.hs
  2. +1 −1 src/Dungeon.hs
  3. +4 −0 src/Effect.hs
  4. +7 −1 src/EffectAction.hs
  5. +19 −23 src/ItemKind.hs
  6. +2 −2 src/MovableKind.hs
View
@@ -402,10 +402,14 @@ cycleHero =
search :: Action ()
search =
do
- lmap <- gets (lmap . slevel)
- ploc <- gets (mloc . getPlayerBody)
- let searchTile (Tile (Door hv (Just n)) x, t') =
- (Tile (Door hv (Just (max (n - 1) 0))) x, t')
+ lmap <- gets (lmap . slevel)
+ ploc <- gets (mloc . getPlayerBody)
+ pitems <- gets (mitems . getPlayerBody)
+ let delta = case strongestItem pitems "ring" of
+ Just i -> 1 + ipower i
+ Nothing -> 1
+ searchTile (Tile (Door hv (Just n)) x, t') =
+ (Tile (Door hv (Just (max (n - delta) 0))) x, t')
searchTile t = t
f l m = M.adjust searchTile (shift ploc m) l
slmap = foldl' f lmap moves
@@ -588,9 +592,14 @@ regenerateLevelHP :: Action ()
regenerateLevelHP =
do
time <- gets stime
- let upd m = if time `mod` (nregen (mkind m)) /= 0
- then m
- else m { mhp = min (nhpMax (mkind m)) (mhp m + 1) }
+ let upd m =
+ let regen = nregen (mkind m) `div`
+ case strongestItem (mitems m) "amulet" of
+ Just i -> ipower i
+ Nothing -> 1
+ in if time `mod` regen /= 0
+ then m
+ else m { mhp = min (nhpMax (mkind m)) (mhp m + 1) }
-- We really want hero selection to be a purely UI distinction,
-- so all heroes need to regenerate, not just the player.
-- Only the heroes on the current level regenerate (others are frozen
View
@@ -278,7 +278,7 @@ rogueRoom cfg nm =
rs <- if ro then return Nothing
else do rsc <- doorSecretChance cfg
fmap Just
- (if rsc then randomR (1, doorSecretMax cfg)
+ (if rsc then randomR (doorSecretMax cfg `div` 2, doorSecretMax cfg)
else return 0)
if rb
then return ((y,x),newTile (Door hv rs))
View
@@ -10,6 +10,8 @@ data Effect =
| SummonFriend
| SummonEnemy
| ApplyPerfume
+ | Regneration
+ | Searching
deriving (Show, Eq, Ord)
effectToName :: Effect -> String
@@ -22,3 +24,5 @@ effectToName Dominate = "of domination"
effectToName SummonFriend = "of aid calling"
effectToName SummonEnemy = "of summoning"
effectToName ApplyPerfume = "of rose water"
+effectToName Regneration = "of regeneration"
+effectToName Searching = "of searching"
View
@@ -55,7 +55,7 @@ effectToAction Effect.Heal source target power msg = do
let upd m = m { mhp = min (nhpMax (mkind m)) (mhp m + power) }
updateAnyActor target upd
pl <- gets splayer
- when (target == pl) $ messageAdd "You feel better." -- TODO: use msg, if perceived, etc.
+ when (target == pl) $ messageAdd "You feel better." -- TODO: use msg, if perceived, etc. Eliminate "you" in singular, but keep it in plural.
return True
effectToAction (Effect.Wound nDm) source target power msg = do
n <- liftIO $ rndToIO $ rollDice nDm
@@ -122,6 +122,12 @@ effectToAction Effect.ApplyPerfume source target _ _ = do
modify (updateLevel upd)
messageAdd "The fragrance quells all scents."
return True
+effectToAction Effect.Regneration source target power msg =
+ effectToAction Effect.Heal source target power msg
+effectToAction Effect.Searching source target power msg = do
+ pl <- gets splayer
+ when (source == pl) $ messageAdd "It gets lost and you search in vain."
+ return True
-- | The source actor affects the target actor, with a given item.
-- If either actor is a hero, the item may get identified.
View
@@ -45,26 +45,25 @@ loot =
dart,
gem1, gem2, gem3, gem4,
gold,
- potion_water, potion_healing, potion_wounding,
+ potion1, potion2, potion3,
ring,
scroll1, scroll2,
sword,
- wand_domination]
+ wand]
-- rollQuad (a, b, x, y) = a * d b + (lvl * x * d y) / 10
-amulet, dart, gem, gem1, gem2, gem3, gold :: ItemKind
-potion, potion_water, potion_healing, potion_wounding :: ItemKind
-ring, scroll, scroll1, scroll2, sword :: ItemKind
-wand, wand_domination :: ItemKind
+amulet, dart, gem, gem1, gem2, gem3, gem4, gold :: ItemKind
+potion, potion1, potion2, potion3 :: ItemKind
+ring, scroll, scroll1, scroll2, sword, wand :: ItemKind
amulet = ItemKind
{ jsymbol = '"'
- , jflavour = [(BrWhite, True)]
+ , jflavour = [(BrGreen, True)]
, jname = "amulet"
- , jeffect = NoEffect
+ , jeffect = Regneration
, jcount = intToQuad 1
- , jfreq = 20
- , jpower = intToQuad 0
+ , jfreq = 10
+ , jpower = (2, 1, 2, 2)
}
dart = ItemKind
{ jsymbol = ')'
@@ -85,10 +84,10 @@ gem = ItemKind
, jpower = intToQuad 0
}
gem1 = gem
- { jcount = (0, 0, 5, 1) -- appears on lvl 2
+ { jcount = (1, 1, 0, 0) -- appears on lvl 1
}
gem2 = gem
- { jcount = (0, 0, 2, 1) -- appears on lvl 5
+ { jcount = (0, 0, 2, 1) -- appears on lvl 5, doubled on lvl 10
}
gem3 = gem
{ jcount = (0, 0, 1, 1) -- appears on lvl 10
@@ -114,25 +113,25 @@ potion = ItemKind
, jfreq = 10 -- x3
, jpower = intToQuad 0
}
-potion_water = potion
+potion1 = potion
{ jeffect = ApplyPerfume
}
-potion_healing = potion
+potion2 = potion
{ jeffect = Heal
, jpower = (10, 1, 0, 0)
}
-potion_wounding = potion
+potion3 = potion
{ jeffect = Wound (0, 0)
, jpower = (10, 1, 0, 0)
}
ring = ItemKind
{ jsymbol = '='
- , jflavour = [(BrWhite, False)]
+ , jflavour = [(White, False)]
, jname = "ring"
- , jeffect = NoEffect
+ , jeffect = Searching
, jcount = intToQuad 1
- , jfreq = 20
- , jpower = intToQuad 0
+ , jfreq = 10
+ , jpower = (1, 1, 2, 2)
}
scroll = ItemKind
{ jsymbol = '?'
@@ -162,11 +161,8 @@ wand = ItemKind
{ jsymbol = '/'
, jflavour = [(BrRed, True)]
, jname = "wand"
- , jeffect = NoEffect
+ , jeffect = Dominate
, jcount = intToQuad 1
, jfreq = 20
, jpower = intToQuad 0
}
-wand_domination = wand
- { jeffect = Dominate
- }
View
@@ -79,7 +79,7 @@ eye = MovableKind
nname = "the reducible eye",
nsight = True,
nsmell = False,
- niq = 10,
+ niq = 12,
nregen = 1500,
nfreq = 6
}
@@ -92,7 +92,7 @@ fastEye = MovableKind
nname = "the super-fast eye",
nsight = True,
nsmell = False,
- niq = 3,
+ niq = 8,
nregen = 1500,
nfreq = 1
}

0 comments on commit 899ffb3

Please sign in to comment.