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:
@@ -48,14 +48,14 @@ var addDam = [32]int{
|
||||
// setMname returns the monster name for the given monster (fight.c
|
||||
// set_mname).
|
||||
func (g *RogueGame) setMname(tp *Monster) string {
|
||||
if !g.seeMonst(tp) && !g.Player.On(SeeMonst) {
|
||||
if !g.seeMonst(tp) && !g.Player.On(SenseMonsters) {
|
||||
if g.Options.Terse {
|
||||
return "it"
|
||||
}
|
||||
return "something"
|
||||
}
|
||||
var mname string
|
||||
if g.Player.On(IsHalu) {
|
||||
if g.Player.On(Hallucinating) {
|
||||
ch := int(g.mvinch(tp.Pos.Y, tp.Pos.X))
|
||||
if !isUpper(byte(ch)) {
|
||||
ch = g.rnd(26)
|
||||
@@ -83,9 +83,9 @@ func (g *RogueGame) fight(mp Coord, weap *Object, thrown bool) bool {
|
||||
g.Quiet = 0
|
||||
g.runto(mp)
|
||||
// Let him know it was really a xeroc (if it was one).
|
||||
if tp.Type == 'X' && tp.Disguise != 'X' && !p.On(IsBlind) {
|
||||
if tp.Type == 'X' && tp.Disguise != 'X' && !p.On(Blind) {
|
||||
tp.Disguise = 'X'
|
||||
if p.On(IsHalu) {
|
||||
if p.On(Hallucinating) {
|
||||
g.mvaddch(tp.Pos.Y, tp.Pos.X, byte(g.rnd(26)+'A'))
|
||||
}
|
||||
g.msg("%s", g.chooseStr("heavy! That's a nasty critter!",
|
||||
@@ -104,17 +104,17 @@ func (g *RogueGame) fight(mp Coord, weap *Object, thrown bool) bool {
|
||||
} else {
|
||||
g.hit("", mname, g.Options.Terse)
|
||||
}
|
||||
if p.On(CanHuh) {
|
||||
if p.On(CanConfuse) {
|
||||
didHit = true
|
||||
tp.Flags.Set(IsHuh)
|
||||
p.Flags.Clear(CanHuh)
|
||||
tp.Flags.Set(Confused)
|
||||
p.Flags.Clear(CanConfuse)
|
||||
g.endmsg()
|
||||
g.HasHit = false
|
||||
g.msg("your hands stop glowing %s", g.pickColor("red"))
|
||||
}
|
||||
if tp.Stats.HP <= 0 {
|
||||
g.killed(tp, true)
|
||||
} else if didHit && !p.On(IsBlind) {
|
||||
} else if didHit && !p.On(Blind) {
|
||||
g.msg("%s appears confused", mname)
|
||||
}
|
||||
didHit = true
|
||||
@@ -137,13 +137,13 @@ func (g *RogueGame) attack(mp *Monster) int {
|
||||
g.Running = false
|
||||
g.Count = 0
|
||||
g.Quiet = 0
|
||||
if g.ToDeath && !mp.On(IsTarget) {
|
||||
if g.ToDeath && !mp.On(Targeted) {
|
||||
g.ToDeath = false
|
||||
g.Kamikaze = false
|
||||
}
|
||||
if mp.Type == 'X' && mp.Disguise != 'X' && !p.On(IsBlind) {
|
||||
if mp.Type == 'X' && mp.Disguise != 'X' && !p.On(Blind) {
|
||||
mp.Disguise = 'X'
|
||||
if p.On(IsHalu) {
|
||||
if p.On(Hallucinating) {
|
||||
g.mvaddch(mp.Pos.Y, mp.Pos.X, byte(g.rnd(26)+'A'))
|
||||
}
|
||||
}
|
||||
@@ -171,14 +171,14 @@ func (g *RogueGame) attack(mp *Monster) int {
|
||||
g.ToDeath = false
|
||||
}
|
||||
}
|
||||
if !mp.On(IsCanc) {
|
||||
if !mp.On(Cancelled) {
|
||||
switch mp.Type {
|
||||
case 'A':
|
||||
// If an aquator hits, you can lose armor class.
|
||||
g.rustArmor(p.CurArmor)
|
||||
case 'I':
|
||||
// The ice monster freezes you
|
||||
p.Flags.Clear(IsRun)
|
||||
p.Flags.Clear(Awake)
|
||||
if g.NoCommand == 0 {
|
||||
g.addmsg("you are frozen")
|
||||
if !g.Options.Terse {
|
||||
@@ -193,7 +193,7 @@ func (g *RogueGame) attack(mp *Monster) int {
|
||||
case 'R':
|
||||
// Rattlesnakes have poisonous bites
|
||||
if !g.save(VsPoison) {
|
||||
if !p.IsWearing(RSustStr) {
|
||||
if !p.IsWearing(RingSustainStrength) {
|
||||
g.chgStr(-1)
|
||||
if !g.Options.Terse {
|
||||
g.msg("you feel a bite in your leg and now feel weaker")
|
||||
@@ -243,7 +243,7 @@ func (g *RogueGame) attack(mp *Monster) int {
|
||||
}
|
||||
case 'F':
|
||||
// Venus Flytrap stops the poor guy from moving
|
||||
p.Flags.Set(IsHeld)
|
||||
p.Flags.Set(Held)
|
||||
p.VfHit++
|
||||
g.Monsters['F'-'A'].Stats.Dmg = fmt.Sprintf("%dx1", p.VfHit)
|
||||
if p.Stats.HP--; p.Stats.HP <= 0 {
|
||||
@@ -330,20 +330,20 @@ func (g *RogueGame) rollEm(thatt, thdef *Creature, weap *Object, hurl bool) bool
|
||||
hplus = weap.HPlus
|
||||
dplus = weap.DPlus
|
||||
if weap == p.CurWeapon {
|
||||
if p.IsRing(Left, RAddDam) {
|
||||
if p.IsRing(Left, RingIncreaseDamage) {
|
||||
dplus += p.CurRing[Left].Arm
|
||||
} else if p.IsRing(Left, RAddHit) {
|
||||
} else if p.IsRing(Left, RingDexterity) {
|
||||
hplus += p.CurRing[Left].Arm
|
||||
}
|
||||
if p.IsRing(Right, RAddDam) {
|
||||
if p.IsRing(Right, RingIncreaseDamage) {
|
||||
dplus += p.CurRing[Right].Arm
|
||||
} else if p.IsRing(Right, RAddHit) {
|
||||
} else if p.IsRing(Right, RingDexterity) {
|
||||
hplus += p.CurRing[Right].Arm
|
||||
}
|
||||
}
|
||||
cp = weap.Damage
|
||||
if hurl {
|
||||
if weap.Flags.Has(IsMissl) && p.CurWeapon != nil &&
|
||||
if weap.Flags.Has(Missile) && p.CurWeapon != nil &&
|
||||
p.CurWeapon.Which == weap.Launch {
|
||||
cp = weap.HurlDmg
|
||||
hplus += p.CurWeapon.HPlus
|
||||
@@ -355,7 +355,7 @@ func (g *RogueGame) rollEm(thatt, thdef *Creature, weap *Object, hurl bool) bool
|
||||
}
|
||||
// If the creature being attacked is not running (asleep or held) then
|
||||
// the attacker gets a plus four bonus to hit.
|
||||
if !thdef.Flags.Has(IsRun) {
|
||||
if !thdef.Flags.Has(Awake) {
|
||||
hplus += 4
|
||||
}
|
||||
defArm := def.Arm
|
||||
@@ -363,10 +363,10 @@ func (g *RogueGame) rollEm(thatt, thdef *Creature, weap *Object, hurl bool) bool
|
||||
if p.CurArmor != nil {
|
||||
defArm = p.CurArmor.Arm
|
||||
}
|
||||
if p.IsRing(Left, RProtect) {
|
||||
if p.IsRing(Left, RingProtection) {
|
||||
defArm -= p.CurRing[Left].Arm
|
||||
}
|
||||
if p.IsRing(Right, RProtect) {
|
||||
if p.IsRing(Right, RingProtection) {
|
||||
defArm -= p.CurRing[Right].Arm
|
||||
}
|
||||
}
|
||||
@@ -512,7 +512,7 @@ func (g *RogueGame) removeMon(mp Coord, tp *Monster, waskill bool) {
|
||||
g.Level.SetMonsterAt(mp.Y, mp.X, nil)
|
||||
g.mvaddch(mp.Y, mp.X, tp.OldCh)
|
||||
detachMon(&g.Level.Monsters, tp)
|
||||
if tp.On(IsTarget) {
|
||||
if tp.On(Targeted) {
|
||||
g.Kamikaze = false
|
||||
g.ToDeath = false
|
||||
if g.Options.FightFlush {
|
||||
@@ -529,7 +529,7 @@ func (g *RogueGame) killed(tp *Monster, pr bool) {
|
||||
// If the monster was a venus flytrap, un-hold him
|
||||
switch tp.Type {
|
||||
case 'F':
|
||||
p.Flags.Clear(IsHeld)
|
||||
p.Flags.Clear(Held)
|
||||
p.VfHit = 0
|
||||
g.Monsters['F'-'A'].Stats.Dmg = "000x0"
|
||||
case 'L':
|
||||
|
||||
Reference in New Issue
Block a user