Equipment Menu


In the player class, I added instance variables to hold the equipped helmet, chest piece, gloves, and boots.  These start out as null, but I added logic to automatically equip one of those items if the equipment slot for it is null when an item for that slot is collected.  I also decided to go ahead and make separate lists for each item type, which will make looping those those lists much easier for the menu.  The collection code was updated to handle these items in the same way that weapons are collected, which adds each piece of armor to the appropriate list.  A method to calculate the total defense was also added, which is the sum of the defense values for each armor equipped.

I recreated almost all of the equipment menu, so that it now handles armor.  Now, the player must select the weapon or armor to replace it.  When selecting a piece of equipment, it will display a selectable list with all of the items that can replace it.

The Weapon and Armor classes were updated to accept a new parameter in the constructor, which is the number of socket slots for each item.  The player will not be able to equip more sockets than this value.  Unfortunately, since the socket for each item is implemented as List, I can only add the socket to the end of the list.  This means that it works in a stack fashion.  I believe I can insert an item into a list at a specific index, but I can’t insert null into the list.  Null signifies that a socket location is empty.  Alternatively, I could implement the Socket list as an array, but that will limit the maximum number of socketable abilities.  Pressing the action (X) button will bring up the list of socket abilities that can be equipped for the currently selected item.  For now, any socket can be equipped into any item.  I already have constants defined for the body location of each socket ability, so I will just need to modify the code to only display the sockets for the selected body location.  All acquired socket abilities are currently stored in one list, but I may want to make separate lists of sockets for each body location to make generating the menus simpler.

I have updated the ResistorKit menu to accept a texture image as part of a menu item.  Unfortunately, I didn’t have any way to access the texture array from the method where the equipment menu is created.


The player’s current attack and defense values are displayed below the character model.  When equipping an item, if the new value is greater than the current value, then the text is displayed in blue.  If the new value is lower, then the text is red.  If the value is the same, then the text is white.  Currently, all collected items for the selected slot are displayed, so the player’s equipped item for that slot is also displayed in the list.  Removing the currently equipped item would be a slight improvement for later, but will probably be a headache to keep the menu indexes straight since it is currently parallel with the list of acquired items for that body slot.  Alternatively, I could just remove the equipped item from the acquired list whenever it is equipped, which is probably the simplest solution.