## Shield# Notes:# Temporary character attribute "Shielding"; there is a Land.MaxShielding.# Land max is 9 in the current db.# Visible via command 'show effects' as "Total Shielding = <value>".# Value is subtracted from armor class for ranged attacks, half for melee.Scenario: Temporary shield potion increases shield temporarily Given I use the "minimal" database as-isAnd I add player and character "TestTS02"And I create a "shield" potion of amount "5" and duration "2"And I put the item in the character's left handAnd I start the server and playAnd I have a shielding of "0"When I open and drink "bottle"Then I have a shielding of "5"And I restAnd I have a shielding of "0"Scenario: Temporary shield potion maxes out at Land max Given I use the "minimal" database as-isAnd I add player and character "TestTS03"And I create a "shield" potion of amount "10" and duration "2"And I put the item in the character's left handAnd I start the server and playAnd I have a shielding of "0"When I open and drink "bottle"Then I have a shielding of "9"And I restAnd I have a shielding of "0"
Rather than starting a fight, I’m just using the “show effects” command to see what the effect is.
Everything works well until I try multiple potions on a whim, and instead of combining or
overriding, the effect drops to zero..? Couldn’t immediately figure it out, so tag the test and
move on.
# bug - rather than having the amount updated, we wind up with 0?@bugScenario: Multiple temporary shield potions Given I use the "minimal" database as-isAnd I add player and character "TestTS04"And I create a "shield" potion of amount "6" and duration "99"And I put the item in the character's right handAnd I create a "shield" potion of amount "9" and duration "99"And I put the item in the character's left handAnd I start the server and playAnd I have a shielding of "0"When I open and drink "bottle"Then I have a shielding of "6"And I drop "right"And I open and drink "bottle"And I have a shielding of "9"
For the protection and resistance stuff, let’s make some generic steps:
Then(/^I have a "([^"]*)" resistance of "([^"]*)"$/)do|type,desired_value|resp=telnet_command(@connection,"show resists",/->/) waited_for = /#{type}\s*:\s*#{desired_value}\b/iexpect(@last_resp).tomatch(waited_for)endThen(/^I have a "([^"]*)" protection of "([^"]*)"$/)do|type,desired_value|resp=telnet_command(@connection,"show protection",/->/) waited_for = /#{type}\s*:\s*#{desired_value}\b/iexpect(@last_resp).tomatch(waited_for)end
## Resistance and Protection effects# TODO - verify no unintended resistance/protectionScenario Outline: Resistance and protection potions have desired effects Given I use the "minimal" database as-isAnd I add player and character "TestRP01"And I create an "<effect>" potion of amount "<amt>" and duration "3"And I put the item in the character's left handAnd I start the server and playAnd I have a "<resist>" resistance of "0"And I have a "<protect>" protection of "0"When I open and drink "bottle"And I have a "<resist>" resistance of "<resistamt>"And I have a "<protect>" protection of "<protectamt>"And I restAnd I have a "<resist>" resistance of "0"And I have a "<protect>" protection of "0"Examples:| effect | amt | resist | resistamt | protect | protectamt || Protection_from_Fire | 2 | Fire | 1 | Fire | 2 || Protection_from_Cold | 3 | Ice | 1 | Ice | 3 || Protection_from_Fire_and_Ice | 4 | Fire | 1 | Fire | 4 || Protection_from_Fire_and_Ice | 5 | Ice | 1 | Ice | 5 || Protection_from_Poison | 6 | Poison | 1 | Poison | 6 || Protection_from_Stun_and_Death | 8 | Death | 1 | Death | 8 || Protection_from_Stun_and_Death | 9 | Stun | 1 | | || Protection_from_Blind_and_Fear | 7 | Blind | 1 | | || Protection_from_Blind_and_Fear | 8 | Fear | 1 | | || Resist_Fear | 7 | Fear | 1 | | || Resist_Blind | 0 | Blind | 1 | | || Resist_Stun | 5 | Stun | 1 | | || Resist_Lightning | 0 | Lightning | 1 | | |
Resist_Death seems to have an interesting issue. In CreateCharacterEffect:
# bug? - Resist_Death adds death resistance but removes death protection when it wears off# NOTE: Merge with other test when fixed.@bugScenario Outline: Death resistance potion has desired effect Given I use the "minimal" database as-isAnd I add player and character "TestRP02"And I create an "<effect>" potion of amount "<amt>" and duration "3"And I put the item in the character's left handAnd I start the server and playAnd I have a "<resist>" resistance of "0"And I have a "<protect>" protection of "0"When I open and drink "bottle"And I have a "<resist>" resistance of "<resistamt>"And I have a "<protect>" protection of "<protectamt>"And I restAnd I have a "<resist>" resistance of "0"And I have a "<protect>" protection of "0"Examples:| effect | amt | resist | resistamt | protect | protectamt || Resist_Death | 3 | Death | 1 | | |
Zonk?
I initially skipped over it; what the heck is Resist_Zonk?
if(target.Stunned<=0&&critical&&!target.immuneStun){intsaveMod=-(target.ZonkResistance);// damager used a bashif(damager.CommandType==Command.CommandType.Bash){saveMod+=Math.Max(target.Level,Skills.GetSkillLevel(damager.GetSkillExperience(Globals.eSkillType.Bash)))-Math.Min(target.Level,Skills.GetSkillLevel(damager.GetSkillExperience(Globals.eSkillType.Bash)));}if(!DND_GetSavingThrow(target,SavingThrow.PetrificationPolymorph,saveMod)){// stun for 1 round if bash save failed, 1 - 2 for othersif(damager.CommandType==Command.CommandType.Bash)target.Stunned=1;elsetarget.Stunned+=(short)RollD(1,2);
It also partially protects from spell-based stuns. But then what does StunResistance do?
case"stun":#region Immune to Stunif(target.immuneStun){if(caster!=null){if(target.race!=""){caster.WriteToDisplay(target.Name+" is immune to stun based magic.");}else{caster.WriteToDisplay("The "+target.Name+" is immune to stun based magic.");}}return0;}#endregionelseif(DND_GetSavingThrow(target,savingThrow,-(target.StunResistance)+casterSL)){if(caster!=null){if(target.race!=""){caster.WriteToDisplay(target.Name+" resists your Stun spell.");}else{caster.WriteToDisplay("The "+target.Name+" resists your Stun spell.");}
So StunResistance is just for a “stun” spell, and ZonkResistance is for all other ways you
might get stunned. Interesting. I guess I should add a test for ZonkResistance.
…which fails. Turns out it’s an effect for worn items only, even if I make a potion for it. I’ll
have to tackle the worn effect thing, once I’ve exhausted all the potioning. Tomorrow.