Shh, don't give away my secret move.
Well anyway this update is almost entirely about pocketsand.
-=-=-=-
Look, I know what you're thinking, "delphonso, why are you using a dictionary when all you're doing is putting singular info in. You should clearly just be using an array. All the stuff about modding is also totally false and could be done with arrays." I get it. I know you're all thinking that all the time, and trust me - so was I.
Until I shoved an array in that bad boy.
These arrays are more similar to Pokemon attacks. They contain the name, then the damage, then a status indicator, and finally accuracy. Hopefully that's enough for a simple battling game. This comes with the downside of making it more difficult to make mons - because you need to specify each move directly and explicitly. Perhaps a better way to do this would be to store all the moves somewhere as arrays, and bring them over by name.
This did present a challenge, and get ready for some technobabble while I explain it. Previously the moves were only a key and name: "attHi" : "Flamethrower" now, however, the moves are arrays: "attHi" : ["Flamethrower", 50, 0, 95]
For the naming of the buttons, I simply used the key "attHi" to get the string "Flamethrower". However, now that key leads to an array. The button doesn't know what to do with all the brackets, numbers and commas, so it throws an error. So how to grab the first position in an array with the key? Googling this was a fucking nightmare, and it wasn't until I talked through it with a friend that I figured it out. In GDScript (basically, Python), dictionaries can be called by their keys in two ways:
You can call by string - so mondictionary["attHi"] will give you whatever is at the key.
Or you can call by attribute (technical term...I forget) - it looks like this: mondictionary.attHi
This second form is necessary to work with arrays, because the code doesn't know what you mean by mondictionary["attHi"[somenumber]], but it does understand mondictionary.attHi[somenumber]. What I'm doing there is taking the 0th position from the array. Arrays are counted in the way that nerds count - starting at 0. So the array's 0th position is the attack's name like "Flamethrower"! Easy peasy!
The new attack function is once again a mess. I set the whole attack array into a variable because "type" contains a key that is a string, so the second method earlier discussed won't work. We'll also need to pull a lot of info from the array to check miss chance, etc in the future. Right now, I check if the move has a status effect (as in, is not 0 in the status position), and print a short sentence about it.
The enemy now has slight variation on their attacks - if they have a status effect, they prioritize doing damage.
And here's the final product - still not great, but making progress. I'd like to start working on...you know really making the game instead of just printing stuff. That'll need health, mons getting knocked out, and so on.