Fixing the hand to hand combat.
Ran the combat overnight to check for bugs, none were noticed until spell number 3748 was cast, when the fireball got stuck to the npc hand again, gonna put some check in later down the combat execution path to make sure that if there is a spell and we arent in magic combat mode it gets destroyed.
Fixed a bug where npcs could select broken weapons from their inventory to fight with, causing them to never switch to hand to hand combat.
Apparently our hand to hand combat has been broken for over a year and I never noticed because none of our npcs for the Arena tutorial or alpha are were designed to fight with fists, they can properly switch to fists now.
The animations for fist combat werent properly named or assigned to the data table for the left or right fist, they both had all the hand to hand combat anims. Causing bugs in hit detection. Fixed it.
The code for actually throwing a Left punchwas never actually programmed in we were only ever checking for if the left hand weapon was a shield for shield bashing, I added in some checks to see if the left hand weapon was a fist if it is we have a 50 percent chance of using the left fist instead of the right one.
Fixed a bug where the fist objects would be destroyed when reevaluating weapons when no others were available.
Fixed a bug when fist references wouldnt be set when switching from Magic to hand to hand.
Fixed a execution flow issue in evaluating the chance to throw a left punch in the melee component.
Finally fixed the issue of NPC attacking when they were no where near the player in two ways, first the code for actually defining the range based in weapon length sometimes had invalid refs to the weapon, and second I added a check to see how far away the NPC is from the player and if they arent within that distance they return negative on their can attack check. We were previously only using that range to tell the npc where to run during combat, but there was nothing stoping them from still attacking if they got to an invalid location until now. This does sometimes result in the NPC just standing there if they cant get to the player, but thats better than them attacking aimlessly, in practice it just looks like the npc is waiting in the player to make their next move which is a cool side effect.
Fixed a bug where the magic casting animations went on way to long even after a spell was done firing.
Added a new socket for the hand to hand weapons because none of the existing sockets worked well, modified the logic of the weapon attach to hand function to use this new socket.
Hand to hand weapons working just like the rest!
NPC can now taunt the player if they cant reach them including playing a sound and an animation! Basically if the NPC cant reach they player they will say something like come on strike me coward!! Fucking awesome addition that only took a few minutes.