Monday, May 13, 2024

Stats and Buffs

As it seems to be always of late, I thought I would get onto a simple bit of code this evening. Where I'd left off yesterday was that skills that gave abilities with a passive effect (I'm currently playing with a defensive stance as a skill in the Fighter Protection tree) would give a default buff to the defensive value of that character.

So, picking up, I got into working on skills that grant the ability, and that in turn has a passive effect connected to it. There was a bunch of tweaking code and structures to get that quite the way I wanted it and working. Next issue was that waaaaay back when, when I wrote the editor interface code for Effects, I did it for Armor, and called it defence. Since then, the game has evolved - and I need both a defence and an armor stat. So sleeves up, I got stuck into that and eventually changed all the bits of code where they were needed to handle those nicely. Then changes in the app to handle the new data.

Great, so I can finally see one of my test characters with an extra defence stat.... no. More trouble-shooting and testing. Turns out I mucked up some double and integer calculations in what was supposed to be a simple buff calculation. With that fixed, lets check that statline. Nope. More bug fixing. More checks, more troubleshooting a few more times.

The last bug that I've found is a gem. When the characters are loaded from the server, the buffs are applied before all the item are equipped. So, when my character is loaded up, his defence is 30. The buff should grant him an extra 10%. So it's flagged as having a value of 3. But then, after all his items are equipped, his defence is over a 100. That buff needs to change.

That finally brings me about to my bug. I did write code that APPLIES a new effect to a character, but rather amusingly, I've not needed one to REMOVE an effect. All my test buffs and debuffs simply wear off and vanish. They stop ticking health onto the character, or doing some form of damage and that's that. I will need to write code that remove a buff, recalculates it, and pops it back on with new stats. I think that it's something I'll be calling a lot (like after each item equipped/removed, buffs granted and so on) - but that's a project for tomorrow.

Anyhow, feels like an awful lot of things fixed tonight, so that's great.

No comments:

Post a Comment

Teleports & Location-Swaps working

A rather productive Friday evening it has been. I've managed to expand the code that deals with special combat events, and successfully ...