Decompose remaining effects-file hot spots (refactor step 7)
drain gains drainReaches; zapSpeed gains hasteTarget/slowTarget; readHoldMonster gains holdMonstersNear; readCreateMonster gains createMonsterSpot; revealSpot splits into revealChar/revealWall/ revealSolid/revealFloor; turnSee gains showSensed. potions.go, scrolls.go, and sticks.go are complexity-clean. Behavior and RNG call order unchanged.
This commit is contained in:
@@ -298,22 +298,8 @@ func (g *RogueGame) turnSee(turnOff bool) bool {
|
||||
if !canSee {
|
||||
g.addch(mp.OldCh)
|
||||
}
|
||||
} else {
|
||||
if !canSee {
|
||||
g.standout()
|
||||
}
|
||||
|
||||
if !g.Player.On(Hallucinating) {
|
||||
g.addch(mp.Type)
|
||||
} else {
|
||||
g.addch(g.randomMonsterLetter())
|
||||
}
|
||||
|
||||
if !canSee {
|
||||
g.standend()
|
||||
|
||||
addNew = true
|
||||
}
|
||||
} else if g.showSensed(mp, canSee) {
|
||||
addNew = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +312,29 @@ func (g *RogueGame) turnSee(turnOff bool) bool {
|
||||
return addNew
|
||||
}
|
||||
|
||||
// showSensed draws one monster for monster sense, standout when it is
|
||||
// otherwise invisible; it reports whether the monster was newly revealed
|
||||
// (the turn-on arm of the C turn_see loop).
|
||||
func (g *RogueGame) showSensed(mp *Monster, canSee bool) bool {
|
||||
if !canSee {
|
||||
g.standout()
|
||||
}
|
||||
|
||||
if !g.Player.On(Hallucinating) {
|
||||
g.addch(mp.Type)
|
||||
} else {
|
||||
g.addch(g.randomMonsterLetter())
|
||||
}
|
||||
|
||||
if !canSee {
|
||||
g.standend()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// seenStairs reports whether the player has seen the stairs (potions.c
|
||||
// seen_stairs).
|
||||
func (g *RogueGame) seenStairs() bool {
|
||||
|
||||
Reference in New Issue
Block a user