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:
@@ -23,7 +23,7 @@ func TestQuaffHealingPotion(t *testing.T) {
|
||||
g := mkGameInput(t, 5, "")
|
||||
pot := newObject()
|
||||
pot.Type = Potion
|
||||
pot.Which = PHealing
|
||||
pot.Which = PotionHealing
|
||||
ch := give(g, pot)
|
||||
g.scr.term.(*testTerm).input = []byte{ch}
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestQuaffHealingPotion(t *testing.T) {
|
||||
if g.Player.Stats.HP <= 1 {
|
||||
t.Error("healing potion did not heal")
|
||||
}
|
||||
if !g.Items.Potions[PHealing].Know {
|
||||
if !g.Items.Potions[PotionHealing].Know {
|
||||
t.Error("healing potion not identified after drinking")
|
||||
}
|
||||
if len(g.Player.Pack) != 5 {
|
||||
@@ -44,12 +44,12 @@ func TestQuaffConfusionSetsFlagAndFuse(t *testing.T) {
|
||||
g := mkGameInput(t, 5, "")
|
||||
pot := newObject()
|
||||
pot.Type = Potion
|
||||
pot.Which = PConfuse
|
||||
pot.Which = PotionConfusion
|
||||
ch := give(g, pot)
|
||||
g.scr.term.(*testTerm).input = []byte{ch}
|
||||
|
||||
g.quaff()
|
||||
if !g.Player.On(IsHuh) {
|
||||
if !g.Player.On(Confused) {
|
||||
t.Error("confusion potion did not confuse")
|
||||
}
|
||||
if g.findSlot(DUnconfuse) == nil {
|
||||
@@ -59,7 +59,7 @@ func TestQuaffConfusionSetsFlagAndFuse(t *testing.T) {
|
||||
for range 30 {
|
||||
g.DoFuses(After)
|
||||
}
|
||||
if g.Player.On(IsHuh) {
|
||||
if g.Player.On(Confused) {
|
||||
t.Error("confusion never wore off")
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ func TestReadEnchantArmor(t *testing.T) {
|
||||
g := mkGameInput(t, 5, "")
|
||||
scr := newObject()
|
||||
scr.Type = Scroll
|
||||
scr.Which = SArmor
|
||||
scr.Which = ScrollEnchantArmor
|
||||
ch := give(g, scr)
|
||||
g.scr.term.(*testTerm).input = []byte{ch}
|
||||
|
||||
@@ -88,16 +88,16 @@ func TestReadHoldMonsterFreezesAdjacent(t *testing.T) {
|
||||
// TestHoldScrollGreedyMonsterQuirk.
|
||||
g := mkGameInput(t, 5, "")
|
||||
tp := spawnAdjacent(g, 'Z')
|
||||
tp.Flags.Set(IsRun)
|
||||
tp.Flags.Set(Awake)
|
||||
scr := newObject()
|
||||
scr.Type = Scroll
|
||||
scr.Which = SHold
|
||||
scr.Which = ScrollHoldMonster
|
||||
ch := give(g, scr)
|
||||
g.scr.term.(*testTerm).input = []byte{ch}
|
||||
|
||||
g.readScroll()
|
||||
t.Logf("after scroll: flags=%o huh=%q", tp.Flags, g.Msgs.Huh)
|
||||
if tp.On(IsRun) || !tp.On(IsHeld) {
|
||||
if tp.On(Awake) || !tp.On(Held) {
|
||||
t.Error("hold monster scroll did not hold the adjacent monster")
|
||||
}
|
||||
}
|
||||
@@ -109,20 +109,20 @@ func TestReadHoldMonsterFreezesAdjacent(t *testing.T) {
|
||||
func TestHoldScrollGreedyMonsterQuirk(t *testing.T) {
|
||||
g := mkGameInput(t, 5, "")
|
||||
tp := spawnAdjacent(g, 'O')
|
||||
tp.Flags.Set(IsRun)
|
||||
tp.Flags.Set(Awake)
|
||||
scr := newObject()
|
||||
scr.Type = Scroll
|
||||
scr.Which = SHold
|
||||
scr.Which = ScrollHoldMonster
|
||||
ch := give(g, scr)
|
||||
g.scr.term.(*testTerm).input = []byte{ch}
|
||||
|
||||
g.readScroll()
|
||||
t.Logf("orc after scroll: flags=%o (IsRun=%v IsHeld=%v)",
|
||||
tp.Flags, tp.On(IsRun), tp.On(IsHeld))
|
||||
if !tp.On(IsHeld) {
|
||||
t.Error("orc lost IsHeld entirely")
|
||||
t.Logf("orc after scroll: flags=%o (Awake=%v Held=%v)",
|
||||
tp.Flags, tp.On(Awake), tp.On(Held))
|
||||
if !tp.On(Held) {
|
||||
t.Error("orc lost Held entirely")
|
||||
}
|
||||
if !tp.On(IsRun) {
|
||||
if !tp.On(Awake) {
|
||||
t.Error("quirk changed: greedy monster stayed held; if this is a " +
|
||||
"deliberate fix, update this test and ARCHITECTURE.md")
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func TestZapSlowMonster(t *testing.T) {
|
||||
tp := spawnAdjacent(g, 'Z')
|
||||
stick := newObject()
|
||||
stick.Type = Stick
|
||||
stick.Which = WsSlowM
|
||||
stick.Which = WandSlowMonster
|
||||
g.fixStick(stick)
|
||||
ch := give(g, stick)
|
||||
g.scr.term.(*testTerm).input = []byte{ch}
|
||||
@@ -141,7 +141,7 @@ func TestZapSlowMonster(t *testing.T) {
|
||||
|
||||
charges := stick.Charges()
|
||||
g.doZap()
|
||||
if !tp.On(IsSlow) {
|
||||
if !tp.On(Slowed) {
|
||||
t.Error("slow monster wand did not slow")
|
||||
}
|
||||
if stick.Charges() != charges-1 {
|
||||
|
||||
Reference in New Issue
Block a user