
In which we start making our own potions.
Test Every Day #
Now that we’ve done permanent stat effect, time to move onto the temporary effects. Only problem is, only one of them actually exists in the item catalog:
SELECT [catalogID]
,[itemID]
,[notes]
FROM [production].[dbo].[CatalogItem]
WHERE notes LIKE '%temporary%' AND baseType = 'Bottle'
catalogID itemID notes
----------- ----------- ---------------------------------------------------------------------------
94 20070 Temporary Strength Potion *ALL*
108 20210 Temporary Strength Potion *Oak*
(2 row(s) affected)
It’s time to start generating new items, rather than relying on what was in the production db. Add a generic potion “blank” to the minimal db:
|
|
and some code to make a new item from a blank and a hash of changes:
|
|
so we can create a step to make new potions:
|
|
and use it to churn through the temporary stat potions:
|
|
The stumbling block here was that these temporary stat increases aren’t reflected in the
show stats
output, but instead require a show tempstats
to be seen.
So now that works, and I went back to retool the permanent stat effects the same way.
Tackle a TODO every other day #
This looks like a good one:
|
|
Unreliable tests are worse than useless. Time is wasted chasing bugs that don’t exist, confidence in the tests is undermined by “sometimes it just fails”, and eventually problems slip through that should have been caught. Let’s nip this one in the bud, as it were.
Two issues with this test: if the player misses, they don’t do any damage, and can’t see whether it was reported numerically or not. And there’s a (slim) chance that the wolves will kill the player before the attack. Luckily there’s one solution to both: we give the player such a high weapon skill that both hitting and blocking are guaranteed.
|
|
(A note about line 264: With random-order testing, and with many tests using the database “as-is”, leftover spawns were causing problems. There’s nothing worse than a character being mauled to death by wolves when you’re trying to test potion effects. So I added code to remove a spawn zone from the database.)
|
|
Surprisingly, this database code was failing because I had not been adding a player skill entry when adding a player (and the game server hadn’t complained about that). So I also added that logic to player creation.
With an unarmed skill of ten million, the player has no problem surviving and doing some serious damage to the wolves:
Swing hits with heavy damage! (24)
The wolf is blocked by your hand.
The wolf misses you.
The wolf is blocked by your hand.
->
Problem Effects #
Getting a complete passing run of these tests should not be difficult, but I kept running into random failures around the new PlayerEffect tests. A little investigation showed that effects were staying in the database, so when the same test was run again, results were not as expected. A quick hook to clear things out should help:
|
|
|
|
and then…
103 scenarios (103 passed)
969 steps (969 passed)
34m42.281s
And now we have confidence to add even more tests. Tomorrow.
Useful Stuff #