sIKE23 / Mage-Wars

Mage Wars for OCTGN
7 stars 5 forks source link

Create Dictionary for Equipment #368

Open sIKE23 opened 8 years ago

sIKE23 commented 8 years ago

sike23 wrote:

Have you ever thought of putting a Mage's equipment in a list or dict with the CardID stored? Then instead of looping over the whole table looking for his equipment you could just do:

myEquipDict = me.getGlobalVariable('MyEquipDict') if "Gloves of Skill" in myEquipDict: do your logic here...

I have been noodling on this for a while and I vacillate back and forth on if it is a useful idea or not.

You could use the slots as dict keys was one thought and you could then look to see if that slot it is in use already when casting equipment....

This would go hand in hand with breaking out the Life/Defense/Channeling/Equipment Slots/Defense into their own stats....

sIKE23 commented 8 years ago

acg wrote

Hey, that's a great idea!

The one complication is that the dictionary needs to be kept up to date. So every time your equipment enters or leaves the board, we have to make sure to update the dictionary. If we don't get this right, we could run into consistency problems.

I suppose another difficulty is with multiple-slot equipment and with equipment that takes up no space, although I think we could figure those out.

But those issues are solvable.

sIKE23 commented 8 years ago

sike23 wrote:

My thoughts were that equipment that took up multiple slots would be added to both slots. So like Packleaders Cowl would look like:

SlotHead:"Packleaders Cowl",SlotHeadID:CardID,SlotCloak:"Packleaders Cowl",SlotCloakID:CardID

and so on and so forth, what equipment doesn't take up a slot?

sIKE23 commented 8 years ago

@ACG8

As for keeping it up to date, adding into the same slot would prompt are you sure? If yes

replaceEquip(oldID,newID)
def replaceEquip(oldID,newID):
    get StatEquipmentSlot location #will use ring slot for example
    remove old ringslot card name
    remove old ringslot CardID
    add old ringslot card name
    add old ringslot card CardID
    place old CardID back into me.hand

then in the discard function:

if card.type == "Equipment":
    get StatEquipmentSlot location #will use ring slot for example  
    remove old ringslot card name
    remove old ringslot CardID
....rest of existing code

or something close to this....just need the addEquip() to handle new entries....and equipment with dissipate would just be handled by the discard function.....

ACG8 commented 8 years ago

Dancing scimitar does not take up a slot. Same with any other autonomous equipment.

We could have a function that opens up a menu listing all the equipment currently attached to the mage (each equipment having its own button), just for reference.

One nice thing about this idea is that it lets you equip equipment to mages other than yourself. You can do that already by attaching the equipment, but this would provide a way to do it without having to attach the equipment.

For multiple slots, I agree with your idea. To update them all, we would want to have the removal function look at the card id and then iterate over the keys looking for all that matched the id being removed.

We should not have separate keys for the name of the item and the card id; just a key for the card id. The name can be derived from the id, but not vice versa.