- commit
- 21f124dd4256d40a40ee4212b7b7fdb21621195a
- parent
- b1859bef6759d291135d8355f6f54308c1af6f95
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-10-05 08:24
tweak damage calculation
Diffstat
| M | monster.go | 2 | +- |
| M | player.go | 2 | +- |
2 files changed, 2 insertions, 2 deletions
diff --git a/monster.go b/monster.go
@@ -74,7 +74,7 @@ func (monster *Monster) run() {
74 74 }
75 75
76 76 func (monster *Monster) TakeDamage(attack float64) {
77 -1 amount := attack * (1 - monster.Defense/(monster.Defense+100))
-1 77 amount := attack * attack / (attack + monster.Defense)
78 78 if amount > monster.Health {
79 79 monster.quit <- true
80 80 delete(monster.Game.Monsters, monster)
diff --git a/player.go b/player.go
@@ -43,7 +43,7 @@ func (player *Player) Flush() {
43 43 }
44 44
45 45 func (player *Player) TakeDamage(attack float64) {
46 -1 amount := uint(math.Round(attack * (1 - player.Defense/(player.Defense+100))))
-1 46 amount := uint(math.Round(attack * attack / (attack + player.Defense)))
47 47 if amount > player.Health {
48 48 player.quit <- true
49 49 } else {