go: port dungeon generation, items base, pack, and monster creation
rooms.c, passages.c, new_level.c ported in full: room/maze layout, corridor spanning tree with extra connections, passage numbering flood fill, trap/stairs/object placement, treasure rooms. Careful RNG-call ordering throughout keeps generation seed-faithful to C. Supporting subsystems this depends on, also ported: - screen.go: curses replaced by in-memory Window cell buffers behind a Terminal interface (tcell arrives with the UI phase; tests run headless) - io.go: msg/addmsg/endmsg message-line protocol, status line, step_ok - pack.c in full (add_pack sorting/stacking walk, get_item, inventory) - things.c in full (inv_name, new_thing, discovery lists, pagination) - monsters.c in full; chase.c navigation half (roomin/cansee/see_monst/ find_dest/runto/set_oldch); rings.c, armor.c in full - weapons.c/sticks.c creation half (init_weapon, fix_stick, num) - misc.c look() display update, eat, level-up, direction input - daemons.c callbacks except stomach (needs death()) and the runners chase driver (combat phase) - init.c init_player with the starting kit Tests: level invariants across seeds, determinism, 30-depth sweep.
This commit is contained in:
28
game/fight.go
Normal file
28
game/fight.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package game
|
||||
|
||||
// fight.c — combat. setMname arrives first (monster wake-ups need it); the
|
||||
// combat resolution functions come with the combat phase.
|
||||
|
||||
// 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.Options.Terse {
|
||||
return "it"
|
||||
}
|
||||
return "something"
|
||||
}
|
||||
var mname string
|
||||
if g.Player.On(IsHalu) {
|
||||
ch := int(g.mvinch(tp.Pos.Y, tp.Pos.X))
|
||||
if !isUpper(byte(ch)) {
|
||||
ch = g.rnd(26)
|
||||
} else {
|
||||
ch -= 'A'
|
||||
}
|
||||
mname = monsterTable[ch].Name
|
||||
} else {
|
||||
mname = monsterTable[tp.Type-'A'].Name
|
||||
}
|
||||
return "the " + mname
|
||||
}
|
||||
Reference in New Issue
Block a user