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:
@@ -21,13 +21,13 @@ func (g *RogueGame) doZap() {
|
||||
return
|
||||
}
|
||||
switch obj.Which {
|
||||
case WsLight:
|
||||
case WandLight:
|
||||
// Reddy Kilowatt wand. Light up the room
|
||||
g.Items.Sticks[WsLight].Know = true
|
||||
if p.Room.Flags.Has(IsGone) {
|
||||
g.Items.Sticks[WandLight].Know = true
|
||||
if p.Room.Flags.Has(Gone) {
|
||||
g.msg("the corridor glows and then fades")
|
||||
} else {
|
||||
p.Room.Flags.Clear(IsDark)
|
||||
p.Room.Flags.Clear(Dark)
|
||||
// Light the room and put the player back up
|
||||
g.enterRoom(p.Pos)
|
||||
g.addmsg("the room is lit")
|
||||
@@ -36,7 +36,7 @@ func (g *RogueGame) doZap() {
|
||||
}
|
||||
g.endmsg()
|
||||
}
|
||||
case WsDrain:
|
||||
case WandDrainLife:
|
||||
// take away 1/2 of hero's hit points, then take it away evenly
|
||||
// from the monsters in the room (or next to hero if he is in a
|
||||
// passage)
|
||||
@@ -45,7 +45,7 @@ func (g *RogueGame) doZap() {
|
||||
return
|
||||
}
|
||||
g.drain()
|
||||
case WsInvis, WsPolymorph, WsTelAway, WsTelTo, WsCancel:
|
||||
case WandInvisibility, WandPolymorph, WandTeleportAway, WandTeleportTo, WandCancellation:
|
||||
y := p.Pos.Y
|
||||
x := p.Pos.X
|
||||
for stepOk(g.Level.VisibleChar(y, x)) {
|
||||
@@ -55,15 +55,15 @@ func (g *RogueGame) doZap() {
|
||||
if tp := g.Level.MonsterAt(y, x); tp != nil {
|
||||
monster := tp.Type
|
||||
if monster == 'F' {
|
||||
p.Flags.Clear(IsHeld)
|
||||
p.Flags.Clear(Held)
|
||||
}
|
||||
switch obj.Which {
|
||||
case WsInvis:
|
||||
tp.Flags.Set(IsInvis)
|
||||
case WandInvisibility:
|
||||
tp.Flags.Set(Invisible)
|
||||
if g.cansee(y, x) {
|
||||
g.mvaddch(y, x, tp.OldCh)
|
||||
}
|
||||
case WsPolymorph:
|
||||
case WandPolymorph:
|
||||
pp := tp.Pack
|
||||
detachMon(&g.Level.Monsters, tp)
|
||||
if g.seeMonst(tp) {
|
||||
@@ -80,18 +80,18 @@ func (g *RogueGame) doZap() {
|
||||
tp.OldCh = oldch
|
||||
tp.Pack = pp
|
||||
if g.seeMonst(tp) {
|
||||
g.Items.Sticks[WsPolymorph].Know = true
|
||||
g.Items.Sticks[WandPolymorph].Know = true
|
||||
}
|
||||
case WsCancel:
|
||||
tp.Flags.Set(IsCanc)
|
||||
tp.Flags.Clear(IsInvis | CanHuh)
|
||||
case WandCancellation:
|
||||
tp.Flags.Set(Cancelled)
|
||||
tp.Flags.Clear(Invisible | CanConfuse)
|
||||
tp.Disguise = tp.Type
|
||||
if g.seeMonst(tp) {
|
||||
g.mvaddch(y, x, tp.Disguise)
|
||||
}
|
||||
case WsTelAway, WsTelTo:
|
||||
case WandTeleportAway, WandTeleportTo:
|
||||
var newPos Coord
|
||||
if obj.Which == WsTelAway {
|
||||
if obj.Which == WandTeleportAway {
|
||||
for {
|
||||
newPos, _ = g.findFloor(nil, 0, true)
|
||||
if newPos != p.Pos {
|
||||
@@ -103,18 +103,18 @@ func (g *RogueGame) doZap() {
|
||||
newPos.X = p.Pos.X + g.Delta.X
|
||||
}
|
||||
tp.Dest = &p.Pos
|
||||
tp.Flags.Set(IsRun)
|
||||
tp.Flags.Set(Awake)
|
||||
g.relocate(tp, newPos)
|
||||
}
|
||||
}
|
||||
case WsMissile:
|
||||
g.Items.Sticks[WsMissile].Know = true
|
||||
case WandMagicMissile:
|
||||
g.Items.Sticks[WandMagicMissile].Know = true
|
||||
bolt := newObject()
|
||||
bolt.Type = '*'
|
||||
bolt.HurlDmg = "1x4"
|
||||
bolt.HPlus = 100
|
||||
bolt.DPlus = 1
|
||||
bolt.Flags = IsMissl
|
||||
bolt.Flags = Missile
|
||||
if p.CurWeapon != nil {
|
||||
bolt.Launch = p.CurWeapon.Which
|
||||
}
|
||||
@@ -127,7 +127,7 @@ func (g *RogueGame) doZap() {
|
||||
} else {
|
||||
g.msg("the missle vanishes with a puff of smoke")
|
||||
}
|
||||
case WsHasteM, WsSlowM:
|
||||
case WandHasteMonster, WandSlowMonster:
|
||||
y := p.Pos.Y
|
||||
x := p.Pos.X
|
||||
for stepOk(g.Level.VisibleChar(y, x)) {
|
||||
@@ -135,17 +135,17 @@ func (g *RogueGame) doZap() {
|
||||
x += g.Delta.X
|
||||
}
|
||||
if tp := g.Level.MonsterAt(y, x); tp != nil {
|
||||
if obj.Which == WsHasteM {
|
||||
if tp.On(IsSlow) {
|
||||
tp.Flags.Clear(IsSlow)
|
||||
if obj.Which == WandHasteMonster {
|
||||
if tp.On(Slowed) {
|
||||
tp.Flags.Clear(Slowed)
|
||||
} else {
|
||||
tp.Flags.Set(IsHaste)
|
||||
tp.Flags.Set(Hasted)
|
||||
}
|
||||
} else {
|
||||
if tp.On(IsHaste) {
|
||||
tp.Flags.Clear(IsHaste)
|
||||
if tp.On(Hasted) {
|
||||
tp.Flags.Clear(Hasted)
|
||||
} else {
|
||||
tp.Flags.Set(IsSlow)
|
||||
tp.Flags.Set(Slowed)
|
||||
}
|
||||
tp.Turn = true
|
||||
}
|
||||
@@ -153,19 +153,19 @@ func (g *RogueGame) doZap() {
|
||||
g.Delta.X = x
|
||||
g.runto(g.Delta)
|
||||
}
|
||||
case WsElect, WsFire, WsCold:
|
||||
case WandLightning, WandFire, WandCold:
|
||||
var name string
|
||||
switch obj.Which {
|
||||
case WsElect:
|
||||
case WandLightning:
|
||||
name = "bolt"
|
||||
case WsFire:
|
||||
case WandFire:
|
||||
name = "flame"
|
||||
default:
|
||||
name = "ice"
|
||||
}
|
||||
g.fireBolt(p.Pos, &g.Delta, name)
|
||||
g.Items.Sticks[obj.Which].Know = true
|
||||
case WsNop:
|
||||
case WandNothing:
|
||||
}
|
||||
obj.SetCharges(obj.Charges() - 1)
|
||||
}
|
||||
@@ -176,14 +176,14 @@ func (g *RogueGame) drain() {
|
||||
// First count how many things we need to spread the hit points among
|
||||
var corp *Room
|
||||
if g.Level.Char(p.Pos.Y, p.Pos.X) == Door {
|
||||
corp = &g.Level.Passages[*g.Level.FlagsAt(p.Pos.Y, p.Pos.X)&FPNum]
|
||||
corp = &g.Level.Passages[*g.Level.FlagsAt(p.Pos.Y, p.Pos.X)&FPassNum]
|
||||
}
|
||||
inpass := p.Room.Flags.Has(IsGone)
|
||||
inpass := p.Room.Flags.Has(Gone)
|
||||
var drainee []*Monster
|
||||
for _, mp := range g.Level.Monsters {
|
||||
if mp.Room == p.Room || mp.Room == corp ||
|
||||
(inpass && g.Level.Char(mp.Pos.Y, mp.Pos.X) == Door &&
|
||||
&g.Level.Passages[*g.Level.FlagsAt(mp.Pos.Y, mp.Pos.X)&FPNum] == p.Room) {
|
||||
&g.Level.Passages[*g.Level.FlagsAt(mp.Pos.Y, mp.Pos.X)&FPassNum] == p.Room) {
|
||||
drainee = append(drainee, mp)
|
||||
}
|
||||
}
|
||||
@@ -212,11 +212,11 @@ func (g *RogueGame) fireBolt(start Coord, dir *Coord, name string) {
|
||||
|
||||
bolt := newObject()
|
||||
bolt.Type = Weapon
|
||||
bolt.Which = Flame
|
||||
bolt.Which = WeaponFlame
|
||||
bolt.HurlDmg = "6x6"
|
||||
bolt.HPlus = 100
|
||||
bolt.DPlus = 0
|
||||
g.Items.Weapons[Flame].Name = name
|
||||
g.Items.Weapons[WeaponFlame].Name = name
|
||||
var dirch byte
|
||||
switch dir.Y + dir.X {
|
||||
case 0:
|
||||
@@ -329,7 +329,7 @@ func (g *RogueGame) fixStick(cur *Object) {
|
||||
cur.HurlDmg = "1x1"
|
||||
|
||||
switch cur.Which {
|
||||
case WsLight:
|
||||
case WandLight:
|
||||
cur.SetCharges(g.rnd(10) + 10)
|
||||
default:
|
||||
cur.SetCharges(g.rnd(5) + 3)
|
||||
@@ -339,7 +339,7 @@ func (g *RogueGame) fixStick(cur *Object) {
|
||||
// chargeStr returns the charge-count suffix for an identified stick
|
||||
// (sticks.c charge_str).
|
||||
func chargeStr(g *RogueGame, obj *Object) string {
|
||||
if !obj.Flags.Has(IsKnow) {
|
||||
if !obj.Flags.Has(Known) {
|
||||
return ""
|
||||
}
|
||||
if g.Options.Terse {
|
||||
|
||||
Reference in New Issue
Block a user