laneya2

cave exploration game
git clone https://git.ce9e.org/laneya2.git

commit
d3bff951acee52f57363763903c9ff2bca1bdc0f
parent
20487f2430e654da47347775ce7a61bf226f47c4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-10-05 08:56
scale monsters with level

Diffstat

M game.go 4 ++++
M monster.go 6 +++---

2 files changed, 7 insertions, 3 deletions


diff --git a/game.go b/game.go

@@ -24,6 +24,7 @@ type Game struct {
   24    24 	lastId     int
   25    25 	Rects      []Rect
   26    26 	Ladder     Point
   -1    27 	Level      uint
   27    28 }
   28    29 
   29    30 var verbose = false
@@ -51,6 +52,7 @@ func getGame(id string) *Game {
   51    52 			register:   make(chan *Player),
   52    53 			unregister: make(chan *Player),
   53    54 			lastId:     0,
   -1    55 			Level:      1,
   54    56 		}
   55    57 		game.generateMap()
   56    58 		mux.Lock()
@@ -136,6 +138,8 @@ func (game *Game) MaybeNextLevel() {
  136   138 		}
  137   139 	}
  138   140 
   -1   141 	game.Level += 1
   -1   142 
  139   143 	game.generateMap()
  140   144 	game.Enqueue(Message{
  141   145 		"action": "setLevel",

diff --git a/monster.go b/monster.go

@@ -30,9 +30,9 @@ func makeMonster(game *Game, pos Point) *Monster {
   30    30 		Rune:    'm',
   31    31 		Pos:     pos,
   32    32 		Speed:   0,
   33    -1 		Attack:  2,
   34    -1 		Defense: 0,
   35    -1 		Health:  10,
   -1    33 		Attack:  2 + float64(game.Level),
   -1    34 		Defense: 0 + float64(game.Level),
   -1    35 		Health:  10 + float64(game.Level),
   36    36 	}
   37    37 	go monster.run()
   38    38 	return monster