laneya2

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

commit
59a2fe93fbe3fabae8de359c395b7757e1f15672
parent
d31ac2ce89e76c714929dc27fe7125200dadf01b
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-10-05 09:16
allow to unequip

Diffstat

M player.go 16 ++++++++++++----

1 files changed, 12 insertions, 4 deletions


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

@@ -185,14 +185,22 @@ func (player *Player) UseItem(name string) {
  185   185 		if old, ok := Items[player.Weapon]; ok {
  186   186 			player.UnapplyItem(old)
  187   187 		}
  188    -1 		player.ApplyItem(item)
  189    -1 		player.Weapon = name
   -1   188 		if name != player.Weapon {
   -1   189 			player.ApplyItem(item)
   -1   190 			player.Weapon = name
   -1   191 		} else {
   -1   192 			player.Weapon = ""
   -1   193 		}
  190   194 	case ARMOR:
  191   195 		if old, ok := Items[player.Armor]; ok {
  192   196 			player.UnapplyItem(old)
  193   197 		}
  194    -1 		player.ApplyItem(item)
  195    -1 		player.Armor = name
   -1   198 		if name != player.Armor {
   -1   199 			player.ApplyItem(item)
   -1   200 			player.Armor = name
   -1   201 		} else {
   -1   202 			player.Armor = ""
   -1   203 		}
  196   204 	}
  197   205 
  198   206 	if player.Health > player.HealthTotal {