Skip to main content
  1. Posts/

Day 76a - Coffee and Drake's Blood

OldDays seitan-spin cucumber

Not an endorsement.
Not an endorsement.

In which we ingest some potent potables.

Test Every Day
#

Coffee
#

First, the coffee, which increases stamina temporarily. It should be easy to confirm that it does, independent of whether we are already at max stamina or not.

features/player_effects.feature
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
Scenario: Coffee increases stamina
  Given I use the "minimal" database
  And I add player and character "TestCoffee01"
  And I set the character's max stamina to "10"
  And I set the character's current stamina to "1"
  And I put a coffee in the character's left hand
  And the server is started
  And I log on as "TestCoffee01"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  Then after "1" turns I have a current stamina of "3"

Scenario: Coffee increases stamina past max
  Given I use the "minimal" database
  And I add player and character "TestCoffee02"
  And I set the character's max stamina to "10"
  And I set the character's current stamina to "10"
  And I put a coffee in the character's left hand
  And the server is started
  And I log on as "TestCoffee02"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  Then after "1" turns I have a current stamina of "11"

But we want to make sure it isn’t increasing max stamina. The boring way would be to log out the character and check the database, or use a debug command to output the character’s stats (the player doesn’t seem to be able to see their max stamina, for some reason).

Instead we will find a way to tire a character whose stamina has been boosted by coffee, then have them rest, and make sure their stamina stops at max. So let’s make a weak character, throw a very heavy weapon in their hand, and make them walk; that should do it.

features/player_effects.feature
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
Scenario: Coffee does not increase max stamina
  Given I use the "minimal" database
  And I add player and character "TestCoffee03"
  And I set the character's "strength" stat to "3"
  And I set the character's max stamina to "10"
  And I set the character's current stamina to "10"
  And I put a coffee in the character's left hand
  And I put a stone halberd in the character's right hand
  And the server is started
  And I log on as "TestCoffee03"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  And I have a current stamina of "11"
  And I move east
  And I have a current stamina of "10"
  And I rest
  Then I have a current stamina of "10"

For reference, the stone halberd weighs 112.1 units, compared to an iron shortsword which weighs 3. I’m not super-happy with this test, but it does work to prove that the max stamina is not being increased.

Drake’s Blood
#

Believe it or not, in this game, “Drake’s Blood” is ambiguous. In the item catalog there are:

  1. Drake Blood (Quest): A large steel vial which “contains the blood of a lightning drake”, but is just a quest item and cannot be drunk.
  2. Drake Potion (Con Only): A large porcelain vial with no further description, which has the Permanent_Constitution effect. Nice, but not the effect we’re looking for now.
  3. Drake Potion: A small porcelain vial, which has the Drake_Potion effect. Bingo!
  4. Drake Potion (mother of pearl): A mother-of-pearl bottle, etched with delicate tracery, which also has the Drake_Potion effect. But has only a hundredth of the coin value of the normal Drake Potion. Maybe that’s backwards..?

And what are the Drake_Potion effects?

DragonsSpine/GameSystems/Effects/Effect.cs
642
643
644
645
646
647
648
649
650
case EffectType.Drake_Potion:
  if (target.Constitution < target.Land.MaxAbilityScore)
    target.Constitution++;
  target.HitsMax += effectAmount;
  target.Hits = target.HitsFull;
  target.StaminaMax += effectAmount;
  target.Stamina = target.StaminaFull;
  target.Mana = target.ManaFull;
  break;

Easy enough to test:

features/player_effects.feature
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
Scenario: Drake potion increases constitution
  Given I use the "minimal" database
  And I add player and character "TestDP01"
  And I set the character's "constitution" stat to "10"
  And I put a drake potion in the character's left hand
  And the server is started
  And I log on as "TestDP01"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  Then I have a constitution stat of "11"

Scenario: Drake potion doesn't increase constitution beyond Land max
  Given I use the "minimal" database
  And I add player and character "TestDP02"
  And I set the character's "constitution" stat to "18"
  And I put a drake potion in the character's left hand
  And the server is started
  And I log on as "TestDP02"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  Then I have a constitution stat of "18"

Scenario: Drake potion increases max HP and heals fully
  Given I use the "minimal" database
  And I add player and character "TestDP03"
  And I set the character's max HP to "10"
  And I set the character's current HP to "5"
  And I put a drake potion in the character's left hand
  And the server is started
  And I log on as "TestDP03"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  Then I have a current and max HP of "14"

Scenario: Drake potion increases max stamina and rests fully
  Given I use the "minimal" database
  And I add player and character "TestDP04"
  And I set the character's max stamina to "10"
  And I set the character's current stamina to "5"
  And I put a drake potion in the character's left hand
  And the server is started
  And I log on as "TestDP04"
  And I enter the game
  When I open "bottle"
  And I drink "bottle"
  Then I have a current stamina of "14"
  And I rest
  And I have a current stamina of "14"

Scenario: Drake potion restores mana fully
  Given I use the "minimal" database
  And I add player and character "TestDP05"
  And I make the character a thief
  And I set the character's max mana to "10"
  And I set the character's current mana to "5"
  And I put a drake potion in the character's left hand
  And the server is started
  And I log on as "TestDP05"
  And I enter the game
  And I wait for "1" turns
  And I have a current mana of "5"
  When I open "bottle"
  And I drink "bottle"
  Then I have a current mana of "10"

We had to add some more stat tweaking and stat checking code, but we’ll be using that a lot anyway. These tests I’m fairly happy with.

73 scenarios (73 passed)
671 steps (671 passed)
20m5.804s

In the process, though, I’ve created some fairly ugly test code in the steps. Too much repetition in handling the various stats. Need to deal with that. Tomorrow.


Useful Stuff
#


More to come
More to come

Day 76a code - tests