Showing posts with label take off. Show all posts
Showing posts with label take off. Show all posts

Wielding a Weapon

I added the ability to wield weapons in my roguelike engine. This includes the ability to take off your weapon as well. There is not much tricky about this operation. If you already are wielding a weapon, and you wield another one, the first weapon needs to go back into your inventory.

Weapon wielding was much easier than dealing with armor. Right now I only have one slot for your weapon. You either are holding one weapon or you are not. I don't have to check different armor wielding locations such as your arm (shield) or your feet (boots).

Now that I got the basics of armor and weapons down, I am rethinking how I handle them. Currently I generate a random list of them to represent what is on a dungeon level. Then I change their state when you pick the up and wield them. However the items are still part of the dungeon level. This is fine if you only have one level. But I plan to have multiple levels. I don't want your inventory or equipment to disappear when you climb the stairs down to another level.

A better idea would be to move items from the dungeon to your inventory. Then you could moves items from your inventory to equipment you are wielding. The inventory and equipment list can persist past the dunegon level. This is going to require some refactoring.

Equipment

Today I just about implemented equipment in my roguelike game engine. You can wield armor. When you wield another armor of the same type, your new choice replaces the old. The the old armor gets put back into your inventory. I can show what armor you have wielded.

One thing on the TO DO list is to handle the wielding of weapons. It should be easier than armor since I only allow 1 slow for weapon holding right now. I also need to complete the implementation of taking off an item your have worn. Got to deal with a full inventory, as well as presenting the user with a list of what you are wearing.

On a positive note, I got the armor class working. The AC gets updated when you wield something. This takes base armor plus armor bonus into account. I like that. Once I finished the TO DO items, I am really going to want to create some unique armor with really high AC.