# Rest when dead but not lawful, in a map with no karma res point, if not a thiefScenario: UnderworldEnabled True, neutral non-thief corpse goes there if no karma res point
Given I use the "minimal" database
And I set "UnderworldEnabled" in the config file to "True"
And I remove the karma res point for map "0"
And I add player and character "TestBadCorpse04"
And I set the character's alignment to neutral
And I set the character's current HP to "1"
And I put poison berries in the the character's right hand
And the server is started
When I log on as "TestBadCorpse04"
And I enter the game
And I eat "berries"
And within "10" turns I see the message "You are dead"
And I rest
Then I saw a message "The world dissolves around you."
Scenario: UnderworldEnabled False, neutral non-thief corpse doesn't go there if no karma res point
Given I use the "minimal" database
And I set "UnderworldEnabled" in the config file to "False"
And I remove the karma res point for map "0"
And I add player and character "TestBadCorpse04"
And I set the character's alignment to neutral
And I set the character's current HP to "1"
And I put poison berries in the the character's right hand
And the server is started
When I log on as "TestBadCorpse04"
And I enter the game
And I eat "berries"
And within "10" turns I see the message "You are dead"
And I rest
Then I did not see a message "The world dissolves around you."
I took the opportunity to refactor the alignment step a little, so it’s just one step that passes
on the specific alignment as a symbol:
Given(/^I set the character's alignment to (lawful|neutral|evil)$/) do|desired_alignment|
set_character_alignment(get_player_id(@user[:char_name]), desired_alignment.to_sym)
end
and then I mirror the enum in the server code to push the appropriate value to the DB:
Given(/^I put a spellbook in the the character's right hand$/) do# TODO - not hardcoded item ID
put_attuned_in_player_hand(get_player_id(@user[:char_name]), 31000, :right)
end
This code only works for databases where the ID for a spellbook happens to be 31000, and gets poor
marks for readability. Let’s add a very flexible item ID lookup method and use that:
Given(/^I put a spellbook in the the character's right hand$/) do
item_id = lookup_item_id({ name: 'spellbook' })
put_attuned_in_player_hand(get_player_id(@user[:char_name]), item_id, :right)
end
Scenario: Multiple character effects stack correctly
Given I use the "minimal" database
And I add player and character "TestSubject01"
And I inflict fear on the character for "2" turns
And I blind the character for "4" turns
And the server is started
When I log on as "TestSubject01"
And I enter the game
Then I saw a message "You are scared!"
And after "2" turns I no longer see the message "You are scared!"
Then I saw a message "You are blind!"
And after "2" turns I no longer see the message "You are blind!"
Simple, but forced me to learn:
the PlayerEffect slots are one-based, not zero-based (initially my first-applied effect was
ignored).
the display of fear overrides the display of blindess (I’m tempted to call
this a bug).