collinsmith / riiablo

Diablo II remade using Java and LibGDX
http://riiablo.com
Apache License 2.0
884 stars 101 forks source link

Move mercenary gear to mercenary entitity #40

Open collinsmith opened 5 years ago

collinsmith commented 5 years ago

Hireling should be it's own entity that is a monster that has an inventory. This will make retrieving the mercenary gear less clunky. Additionally, better detection of a save file with NO mercenary is needed.

Instead of checking gameScreen.player.merc.items.items != null, it should be as simple as gameScreen.player.merc != null

Side note yes, I'm aware that the current code looks weird as gameScreen.player.merc.items.items.items -- this is due to how the data is saved in the D2S mostly for debugging purposes to keep the data grouped as in the file. This is really GameScreen.Player.MercData.MercItemData.ItemData.Array<Item> with ItemData being the same object as the D2S.ItemData so player items are read the same way as merc items.