- commit
- 0fde94ad69bf26cac026965f16d66119ffc97117
- parent
- 095bbf211a10714ae5d08fefc156345a1b1302d9
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-10-08 22:12
have different kinds of monsters
Diffstat
| M | monster.go | 23 | ++++++++++++++++++++++- |
1 files changed, 22 insertions, 1 deletions
diff --git a/monster.go b/monster.go
@@ -2,6 +2,7 @@ package main 2 2 3 3 import ( 4 4 "math" -1 5 "math/rand" 5 6 "time" 6 7 ) 7 8 @@ -28,9 +29,29 @@ func makeMonster(game *Game, pos Point) *Monster { 28 29 Dir: "right", 29 30 Speed: 0, 30 31 Attack: 2 + float64(game.Level),31 -1 Defense: 0 + float64(game.Level),-1 32 Defense: 2, 32 33 Health: 10 + float64(game.Level), 33 34 } -1 35 -1 36 r := rand.Intn(10) -1 37 if r == 0 { -1 38 monster.Rune = 'M' -1 39 monster.Attack += 6 -1 40 monster.Defense += 6 -1 41 monster.Health *= 2 -1 42 monster.Speed -= 2 -1 43 } else if r < 3 { -1 44 monster.Rune = 's' -1 45 monster.Speed += 10 -1 46 monster.Health /= 2 -1 47 } else if r < 5 { -1 48 monster.Rune = 'z' -1 49 monster.Attack += 2 -1 50 monster.Defense += 2 -1 51 monster.Health *= 1.2 -1 52 monster.Speed -= 5 -1 53 } -1 54 34 55 go monster.run() 35 56 return monster 36 57 }