Rename constants to descriptive names (refactor step 1)
Pure rename, no behavior change; the full suite (RNG goldens,
generation invariants, scripted sessions, save round trip) is
unchanged and green.
- Creature flags: IsHuh→Confused, IsHalu→Hallucinating,
CanHuh→CanConfuse, CanSee→CanSeeInvisible, IsRun→Awake,
SeeMonst→SenseMonsters, IsCanc→Cancelled, IsLevit→Levitating,
IsBlind/IsGreed/IsHaste/IsTarget/IsHeld/IsInvis/IsMean/IsRegen/
IsFly/IsSlow → Blind/Greedy/Hasted/Targeted/Held/Invisible/Mean/
Regenerates/Flying/Slowed, IsFound→Found
- Object flags: IsCursed→Cursed, IsKnow→Known, IsMissl→Missile,
IsMany→Stackable, ObjIsFound→WasFound, IsProt→Protected
- Room flags: IsDark/IsGone/IsMaze → Dark/Gone/Maze; place flags:
FPass→FPassage, FPNum→FPassNum, FTMask→FTrapMask
- Trap types: TDoor→TrapDoor ... TMyst→TrapMystery
- Item subtypes: P*→Potion* (PLSD→PotionLSD, PMFind→
PotionDetectMonsters, ...), S*→Scroll* (SIDRorS→
ScrollIdentifyRingOrStick, ...), R*→Ring* (RAddHit→RingDexterity,
RNop→RingAdornment, ...), Ws*→Wand* (WsElect→WandLightning, ...),
weapons (TwoSword→WeaponTwoHandedSword, Shiraken→WeaponShuriken,
...), armor (RingMail→ArmorRingMail, ...)
- Counts: Max{Potions,Scrolls,Rings,Sticks,Weapons,Armors} →
Num{Potion,Scroll,Ring,Wand,Weapon,Armor}Types; NTraps→NumTrapTypes
- Level.NTraps field → TrapCount (also in the save snapshot)
- Original C constant names preserved as comment breadcrumbs in
types.go so the lineage stays greppable
TODO.md: step 1 moved to Completed, step 2 (typed kinds) promoted to
Next Step.
This commit is contained in:
@@ -4,12 +4,12 @@ package game
|
||||
|
||||
// idType maps identify scrolls to the type they identify (scrolls.c
|
||||
// static id_type).
|
||||
var idType = [SIDRorS + 1]int{
|
||||
SIDPotion: int(Potion),
|
||||
SIDScroll: int(Scroll),
|
||||
SIDWeapon: int(Weapon),
|
||||
SIDArmor: int(Armor),
|
||||
SIDRorS: RorS,
|
||||
var idType = [ScrollIdentifyRingOrStick + 1]int{
|
||||
ScrollIdentifyPotion: int(Potion),
|
||||
ScrollIdentifyScroll: int(Scroll),
|
||||
ScrollIdentifyWeapon: int(Weapon),
|
||||
ScrollIdentifyArmor: int(Armor),
|
||||
ScrollIdentifyRingOrStick: RorS,
|
||||
}
|
||||
|
||||
// readScroll reads a scroll from the pack and does the appropriate thing
|
||||
@@ -36,17 +36,17 @@ func (g *RogueGame) readScroll() {
|
||||
g.leavePack(obj, false, false)
|
||||
|
||||
switch obj.Which {
|
||||
case SConfuse:
|
||||
case ScrollMonsterConfusion:
|
||||
// Scroll of monster confusion. Give him that power.
|
||||
p.Flags.Set(CanHuh)
|
||||
p.Flags.Set(CanConfuse)
|
||||
g.msg("your hands begin to glow %s", g.pickColor("red"))
|
||||
case SArmor:
|
||||
case ScrollEnchantArmor:
|
||||
if p.CurArmor != nil {
|
||||
p.CurArmor.Arm--
|
||||
p.CurArmor.Flags.Clear(IsCursed)
|
||||
p.CurArmor.Flags.Clear(Cursed)
|
||||
g.msg("your armor glows %s for a moment", g.pickColor("silver"))
|
||||
}
|
||||
case SHold:
|
||||
case ScrollHoldMonster:
|
||||
// Hold monster scroll. Stop all monsters within two spaces from
|
||||
// chasing after the hero.
|
||||
held := 0
|
||||
@@ -58,9 +58,9 @@ func (g *RogueGame) readScroll() {
|
||||
if y < 0 || y > NumLines-1 {
|
||||
continue
|
||||
}
|
||||
if mp := g.Level.MonsterAt(y, x); mp != nil && mp.On(IsRun) {
|
||||
mp.Flags.Clear(IsRun)
|
||||
mp.Flags.Set(IsHeld)
|
||||
if mp := g.Level.MonsterAt(y, x); mp != nil && mp.On(Awake) {
|
||||
mp.Flags.Clear(Awake)
|
||||
mp.Flags.Set(Held)
|
||||
held++
|
||||
}
|
||||
}
|
||||
@@ -75,17 +75,17 @@ func (g *RogueGame) readScroll() {
|
||||
g.addmsg("s")
|
||||
}
|
||||
g.endmsg()
|
||||
g.Items.Scrolls[SHold].Know = true
|
||||
g.Items.Scrolls[ScrollHoldMonster].Know = true
|
||||
} else {
|
||||
g.msg("you feel a strange sense of loss")
|
||||
}
|
||||
case SSleep:
|
||||
case ScrollSleep:
|
||||
// Scroll which makes you fall asleep
|
||||
g.Items.Scrolls[SSleep].Know = true
|
||||
g.Items.Scrolls[ScrollSleep].Know = true
|
||||
g.NoCommand += g.rnd(g.spread(5)) + 4 // SLEEPTIME
|
||||
p.Flags.Clear(IsRun)
|
||||
p.Flags.Clear(Awake)
|
||||
g.msg("you fall asleep")
|
||||
case SCreate:
|
||||
case ScrollCreateMonster:
|
||||
// Create a monster: first look in a circle around him, next try
|
||||
// his room, otherwise give up
|
||||
i := 0
|
||||
@@ -99,7 +99,7 @@ func (g *RogueGame) readScroll() {
|
||||
// Or anything else nasty
|
||||
if ch := g.Level.VisibleChar(y, x); stepOk(ch) {
|
||||
if ch == Scroll {
|
||||
if fo := g.findObj(y, x); fo != nil && fo.Which == SScare {
|
||||
if fo := g.findObj(y, x); fo != nil && fo.Which == ScrollScareMonster {
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -115,14 +115,14 @@ func (g *RogueGame) readScroll() {
|
||||
tp := &Monster{}
|
||||
g.newMonster(tp, g.randMonster(false), mp)
|
||||
}
|
||||
case SIDPotion, SIDScroll, SIDWeapon, SIDArmor, SIDRorS:
|
||||
case ScrollIdentifyPotion, ScrollIdentifyScroll, ScrollIdentifyWeapon, ScrollIdentifyArmor, ScrollIdentifyRingOrStick:
|
||||
// Identify, let him figure something out
|
||||
g.Items.Scrolls[obj.Which].Know = true
|
||||
g.msg("this scroll is an %s scroll", g.Items.Scrolls[obj.Which].Name)
|
||||
g.whatis(true, idType[obj.Which])
|
||||
case SMap:
|
||||
case ScrollMagicMapping:
|
||||
// Scroll of magic mapping.
|
||||
g.Items.Scrolls[SMap].Know = true
|
||||
g.Items.Scrolls[ScrollMagicMapping].Know = true
|
||||
g.msg("oh, now this scroll has a map on it")
|
||||
// take all the things we want to keep hidden out of the window
|
||||
for y := 1; y < NumLines-1; y++ {
|
||||
@@ -141,7 +141,7 @@ func (g *RogueGame) readScroll() {
|
||||
case ' ':
|
||||
if pp.Flags.Has(FReal) {
|
||||
// def: hidden things in walls stay hidden
|
||||
if pp.Flags.Has(FPass) {
|
||||
if pp.Flags.Has(FPassage) {
|
||||
pass = true
|
||||
} else {
|
||||
ch = ' '
|
||||
@@ -162,7 +162,7 @@ func (g *RogueGame) readScroll() {
|
||||
pp.Flags.Set(FSeen | FReal)
|
||||
}
|
||||
default:
|
||||
if pp.Flags.Has(FPass) {
|
||||
if pp.Flags.Has(FPassage) {
|
||||
pass = true
|
||||
} else {
|
||||
ch = ' '
|
||||
@@ -178,7 +178,7 @@ func (g *RogueGame) readScroll() {
|
||||
if ch != ' ' {
|
||||
if tp := pp.Monst; tp != nil {
|
||||
tp.OldCh = ch
|
||||
if !p.On(SeeMonst) {
|
||||
if !p.On(SenseMonsters) {
|
||||
g.mvaddch(y, x, ch)
|
||||
}
|
||||
} else {
|
||||
@@ -187,7 +187,7 @@ func (g *RogueGame) readScroll() {
|
||||
}
|
||||
}
|
||||
}
|
||||
case SFDet:
|
||||
case ScrollFoodDetection:
|
||||
// Food detection
|
||||
found := false
|
||||
g.scr.Hw.Clear()
|
||||
@@ -198,23 +198,23 @@ func (g *RogueGame) readScroll() {
|
||||
}
|
||||
}
|
||||
if found {
|
||||
g.Items.Scrolls[SFDet].Know = true
|
||||
g.Items.Scrolls[ScrollFoodDetection].Know = true
|
||||
g.showWin("Your nose tingles and you smell food.--More--")
|
||||
} else {
|
||||
g.msg("your nose tingles")
|
||||
}
|
||||
case STelep:
|
||||
case ScrollTeleportation:
|
||||
// Scroll of teleportation: make him disappear and reappear
|
||||
curRoom := p.Room
|
||||
g.teleport()
|
||||
if curRoom != p.Room {
|
||||
g.Items.Scrolls[STelep].Know = true
|
||||
g.Items.Scrolls[ScrollTeleportation].Know = true
|
||||
}
|
||||
case SEnch:
|
||||
case ScrollEnchantWeapon:
|
||||
if p.CurWeapon == nil || p.CurWeapon.Type != Weapon {
|
||||
g.msg("you feel a strange sense of loss")
|
||||
} else {
|
||||
p.CurWeapon.Flags.Clear(IsCursed)
|
||||
p.CurWeapon.Flags.Clear(Cursed)
|
||||
if g.rnd(2) == 0 {
|
||||
p.CurWeapon.HPlus++
|
||||
} else {
|
||||
@@ -223,25 +223,25 @@ func (g *RogueGame) readScroll() {
|
||||
g.msg("your %s glows %s for a moment",
|
||||
g.Items.Weapons[p.CurWeapon.Which].Name, g.pickColor("blue"))
|
||||
}
|
||||
case SScare:
|
||||
case ScrollScareMonster:
|
||||
// Reading it is a mistake and produces laughter at her poor boo
|
||||
// boo.
|
||||
g.msg("you hear maniacal laughter in the distance")
|
||||
case SRemove:
|
||||
case ScrollRemoveCurse:
|
||||
uncurse(p.CurArmor)
|
||||
uncurse(p.CurWeapon)
|
||||
uncurse(p.CurRing[Left])
|
||||
uncurse(p.CurRing[Right])
|
||||
g.msg("%s", g.chooseStr("you feel in touch with the Universal Onenes",
|
||||
"you feel as if somebody is watching over you"))
|
||||
case SAggr:
|
||||
case ScrollAggravateMonsters:
|
||||
// This scroll aggravates all the monsters on the current level
|
||||
// and sets them running towards the hero
|
||||
g.aggravate()
|
||||
g.msg("you hear a high pitched humming noise")
|
||||
case SProtect:
|
||||
case ScrollProtectArmor:
|
||||
if p.CurArmor != nil {
|
||||
p.CurArmor.Flags.Set(IsProt)
|
||||
p.CurArmor.Flags.Set(Protected)
|
||||
g.msg("your armor is covered by a shimmering %s shield",
|
||||
g.pickColor("gold"))
|
||||
} else {
|
||||
@@ -257,6 +257,6 @@ func (g *RogueGame) readScroll() {
|
||||
// uncurse uncurses an item (scrolls.c uncurse).
|
||||
func uncurse(obj *Object) {
|
||||
if obj != nil {
|
||||
obj.Flags.Clear(IsCursed)
|
||||
obj.Flags.Clear(Cursed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user