301 Days

A year of gamedev experiments.

Day 77a - Have Another Drink

| Comments

In which we force a hapless player character to drink many things.

Test Every Day

We did coffee and drake blood last time, let’s churn through a bunch more.

Mana_Restore

No excitement here, the test is very straightforward:

features/player_effects.featurelink
368
369
370
371
372
373
374
375
376
377
378
379
Scenario: Mana restore potion restores mana fully
    Given I use the "minimal" database as-is
    And I add player and character "TestMR01"
    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 "Mana_Restore" potion in the character's left hand
    And I start the server and play
    And I wait for "1" turns
    And I have a current mana of "5"
    When I open and drink "bottle"
    Then I have a current mana of "10"

Naphtha

Intended to be thrown, not drunk. A quick test to show how deadly:

features/player_effects.featurelink
383
384
385
386
387
388
389
390
391
392
393
Scenario: Naphtha is fatally poisonous at 50 HP
    Given I use the "minimal" database as-is
    And I add player and character "TestNaph01"
    And I set the character's current and max HP to "50"
    And I put a "Naphtha" potion in the character's left hand
    And I start the server and play
    When I open and drink "bottle"
    Then after "2" turns I have a current HP of "35"
    And after "3" turns I have a current HP of "22"
    And after "3" turns I have a current HP of "10"
    And within "3" turns I see the message "You have died from poison."

Interestingly, the character effect of drunk naphtha is transferred completely to the character’s Poisoned attribute, so the poison will run its course completely independent of the duration that was originally attached to the effect.

DragonsSpine/GameSystems/Effects/Effect.cslink
654
655
656
case EffectType.Naphtha:
    target.Poisoned = effectAmount;
    break;

Fully testing the naphtha poison effect, therefore, requires spending a lot of time watching a character that has a lot of hit points:

features/player_effects.featurelink
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
@slow
Scenario: Naphtha is severely poisonous at 80 HP
    Given I use the "minimal" database as-is
    And I add player and character "TestNaph02"
    And I set the character's current and max HP to "80"
    And I put a "Naphtha" potion in the character's left hand
    And I start the server and play
    When I open and drink "bottle"
    Then after "2" turns I have a current HP of "65"
    And after "3" turns I have a current HP of "52"
    And after "3" turns I have a current HP of "40"
    And after "3" turns I have a current HP of "29"
    And after "3" turns I have a current HP of "19"
    And after "3" turns I have a current HP of "10"
    And after "3" turns I have a current HP of "2"
    And within "2" turns I see the message "The Poison spell has worn off."
    And after "3" turns I have a current HP of "3"

Nitro

Should be similar to naphtha, I’d think, but simply marked “TODO” in the server code.

OrcBalm (euphemism)

Identified as “Orc urine”, this one stuns the character:

features/player_effects.featurelink
417
418
419
420
421
422
423
424
Scenario: Drinking orc urine is stunning
    Given I use the "minimal" database as-is
    And I add player and character "TestOrcB01"
    And I put an "OrcBalm" potion in the character's left hand
    And I start the server and play
    When I open and drink "bottle"
    Then I saw the message "You are stunned!"
    And within "6" turns I no longer see the message "You are stunned!"

Because the length of the stun is random (between 1 and the effect amount), we just verify that it stops within the maximum time.

Permanent_Mana

There was no item in the production database with this effect, so I’ve let it be for now.

Stamina_Restore

Another simple one:

features/player_effects.featurelink
432
433
434
435
436
437
438
439
440
441
442
443
Scenario: Stamina restore potion rests fully
    Given I use the "minimal" database as-is
    And I add player and character "TestSR01"
    And I set the character's max stamina to "10"
    And I set the character's current stamina to "0"
    And I put a "Stamina_Restore" potion in the character's left hand
    And I start the server and play
    And I have a current stamina of "0"
    When I open and drink "bottle"
    Then I have a current stamina of "10"
    And I rest
    And I have a current stamina of "10"

With the the last couple of steps just to verify that the max stamina has not increased.

Water and Wine

Both have no effect, intentionally (as far as I can tell). Water I can understand, but I remember the use (and misuse) of wine in the original game; so I’ll call that a bug.

Luckily I have a reference by which to correct the wine issue. According to a 1993 edition of the “Kesmai Kompanion”:

Wine (bought at the tavern) is a mild poison (does 1 hit of damage) that has a 10 round delay.

TODO: Poison delay is something I’ll have to look into a bit more. It was a big part of the poison model of the original game, but doesn’t seem to be a feature of this server code.

Youth_Potion

For a time, definitely the most valuable item in the game. Makes you young, unless you’re already very young:

features/player_effects.featurelink
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
Scenario: Youth potion restores youth
    Given I use the "minimal" database as-is
    And I add player and character "TestYP01"
    And I set the character's current age to "75000"
    And I put a "Youth_Potion" potion in the character's left hand
    And I start the server and play
    And I have an age of "ancient"
    When I open and drink "bottle"
    Then I saw the message "You feel young again!"
    And I have an age of "young"

Scenario: Youth potion disappoints the young
    Given I use the "minimal" database as-is
    And I add player and character "TestYP02"
    And I set the character's current age to "14000"
    And I put a "Youth_Potion" potion in the character's left hand
    And I start the server and play
    And I have an age of "very young"
    When I open and drink "bottle"
    Then I saw the message "The fluid is extremely bitter."
    And I have an age of "very young"

HitsMax, Hits, and Stamina

No potions for these three, will have to come back to them later.

Permanent_Strength, Permanent_Dexterity

More simple stuff, with the negative test that the stat can’t be raised above to maximum for the “Land” the player is in. Also, the permanent strength increase stuns the character for three turns, and the dexterity increase blinds the character for three turns.

Code

Permanent_Intelligence, Permanent_Wisdom, Permanent_Constitution, Permanent_Charisma

These ones are so similar I decided to try a (slightly) more DRY approach using Cucumber’s scenario outlines:

features/player_effects.featurelink
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
Scenario Outline: Permanent stat potion increases stat permanently
    Given I use the "minimal" database as-is
    And I add player and character "TestPS01"
    And I set the character's "<stat>" stat to "<init>"
    And I put a "<effect>" potion in the character's left hand
    And I start the server and play
    And I have a "<stat>" stat of "<init>"
    When I open and drink "bottle"
    And I have a "<stat>" stat of "<expect>"
Examples:
| stat         | effect                 | init | expect |
| intelligence | Permanent_Intelligence | 10   | 11     |
| intelligence | Permanent_Intelligence | 18   | 18     |
| constitution | Permanent_Constitution | 10   | 12     |
| constitution | Permanent_Constitution | 18   | 18     |
| charisma     | Permanent_Charisma     | 10   | 11     |
| charisma     | Permanent_Charisma     | 18   | 18     |
# TODO: Tests for effects for which there is not an item in the catalog.
#| wisdom       | Permanent_Wisdom       | 10   | 11     |
#| wisdom       | Permanent_Wisdom       | 18   | 18     |

Again, we make sure a stat is already at local max (18 in this case) does not increase.

Progress?

Unfortunately, there are still a bunch of character effects to cover. We’ll finish them up quickly so we can move on to something more interesting. Tomorrow.


Useful Stuff


Day 77a code - tests

Comments