Skip to content

Commit

Permalink
Merged PR 410: Merge 527_tutorial to master
Browse files Browse the repository at this point in the history
Related work items: #531, #527
  • Loading branch information
Allen B. Cummings committed Jan 17, 2019
1 parent 61763bf commit 3f8b4d2
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 21 deletions.
8 changes: 7 additions & 1 deletion core/prerequisites.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private nomask int isValidPrerequisiteType(string type)
{
return (member(({ "research", "attribute", "skill", "quest", "guild",
"race", "faction", "trait", "background", "combat statistic", "level",
"opinion", "state", "presence" }), type) > -1);
"opinion", "state", "presence", "not present" }), type) > -1);
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -582,6 +582,11 @@ public nomask varargs int checkPrerequisites(object researcher, string grouping,
ret &&= checkPresence(researcher, prerequisiteData["value"]);
break;
}
case "not present":
{
ret &&= !checkPresence(researcher, prerequisiteData["value"]);
break;
}
default:
{
ret = 0;
Expand Down Expand Up @@ -699,6 +704,7 @@ public nomask string displayPrerequisites(string colorConfiguration, object conf
case "guild":
case "race":
case "presence":
case "not present":
case "faction":
{
if (pointerp(prerequisites[key]["value"]) &&
Expand Down
21 changes: 21 additions & 0 deletions tests/core/prerequisitesTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,27 @@ void CheckPrerequsistesCorrectlyHandlesPresenceChecks()
ExpectFalse(Prerequisite->checkPrerequisites(Researcher, "group a", owner), "check fails when not present");
}

/////////////////////////////////////////////////////////////////////////////
void CheckPrerequsistesCorrectlyHandlesNotPresentChecks()
{
object owner = clone_object("/lib/realizations/npc.c");
owner->Name("Fred");
destruct(Researcher);
Researcher = clone_object("/lib/realizations/player.c");
Researcher->Name("Bob");

move_object(Researcher, this_object());

ExpectTrue(Prerequisite->AddTestPrerequisite("not present",
(["type":"not present", "value" : ({ "Fred" })]), "group a"));

move_object(owner, this_object());
ExpectFalse(Prerequisite->checkPrerequisites(Researcher, "group a", owner), "check fails when present");

destruct(owner);
ExpectTrue(Prerequisite->checkPrerequisites(Researcher, "group a", owner), "check passes when not present");
}

/////////////////////////////////////////////////////////////////////////////
void DisplayPrerequisitesCorrectlyDisplaysQuestPrerequisites()
{
Expand Down
2 changes: 1 addition & 1 deletion tutorial/characters/aegis-equipment.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void CreateAegisEquipment(object user)
move_object(equipment, user);
user->equip(equipment, 1);

equipment = clone_object("/lib/instances/items/armor/light-armor/leather-arm-greave.c");
equipment = clone_object("/lib/instances/items/armor/light-armor/leather-arm-greaves.c");
equipment->set("craftsmanship", 50);
equipment->set("armor class", 1);
move_object(equipment, user);
Expand Down
4 changes: 2 additions & 2 deletions tutorial/characters/berenar/startingConversation.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ protected void Setup()
"enough to cause them to flee. Looks like they dragged their fallen "
"with 'em though.'");

addResponse("berenar interjects", "\x1b[0;31m[Say nothing...]\x1b[0m", "@D@You remain silent.");
addResponse("berenar interjects", "@I@Say nothing...@E@", "@D@You remain silent.");
addTopic("player will live", "@S@`I may have spoken out of turn. ##ActorName## "
"has regained consciousness and does not yet look ready to depart us.' @D@"
"notes Berenar as he crouches down to help Galadhel tend to ##InitiatorPossessive## wounds.");
addResponseTopic("berenar interjects", "\x1b[0;31m[Say nothing...]\x1b[0m", "player will live");
addResponseTopic("berenar interjects", "@I@Say nothing...@E@", "player will live");
addTopicEvent("player will live", "playerAgainLosesConsciousness");

addResponse("berenar interjects", "I'm not dead yet...",
Expand Down
7 changes: 5 additions & 2 deletions tutorial/characters/brendan/brendan.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ virtual inherit "/lib/realizations/npc.c";

object player;
int CallingYield;
int DoNotKillMe = 1;

/////////////////////////////////////////////////////////////////////////////
protected void Setup()
{
Name("black-robed figure");
addAlias("black-robed figure");
addAlias("figure");
addAlias("brendan");
short("Black-robed figure");
Gender(1);
Race("maegenstryd");
Expand All @@ -28,6 +30,7 @@ public void IYield(object player)
this_object()->onTriggerConversation(player, "first conversation");
player = 0;
CallingYield = 0;
DoNotKillMe = 0;
}

/////////////////////////////////////////////////////////////////////////////
Expand All @@ -48,5 +51,5 @@ public int secondLife()
CallingYield = 1;
call_out("IYield", 1, player);
}
return 1;
}
return DoNotKillMe;
}
98 changes: 85 additions & 13 deletions tutorial/characters/brendan/startingConversation.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void WhoAreYou()
"What is going on here? Why do you force us to fell our own comrades? And just "
"what was that horrid smoking thunderclap?'");
addResponsePrerequisite("villain", "Speak @A@Diplomacy@E@",
(["diplomacy":(["type":"skill", "value" : 21])]), 1);
(["diplomacy":(["type":"skill", "value" : 5])]), 1);
}

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -67,7 +67,7 @@ private void YouAreABitSimple()
"It'd be a pity if your simpering whines came to naught. Perhaps you'd "
"rather we converse?'");
addResponsePrerequisite("you are a simpleton", "Is this how you end? @A@Persuasion@E@",
(["persuasion":(["type":"skill", "value" : 1])]), 1);
(["persuasion":(["type":"skill", "value" : 2])]), 1);
}

/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -155,35 +155,105 @@ private void YouKnowMe()
{
addConditionalTopicAddendum("my death is nigh", "blessed daughter",
(["presence":(["type":"presence", "value" : ({ "galadhel" })])]),
"@D@The robed one looks directly at Galadhel and adds, @S@`Now, if you "
" @D@The robed one looks directly at Galadhel and adds, @S@`Now, if you "
"would be so kind, blessed daughter and sister of the damned, I "
"would prefer to leave this world.'");

addTopicInterjection("my death is nigh",
"/lib/tutorial/characters/galadhel/galadhel.c",
"you know me?", 1);

addTopic("yes, I know you", "@D@The figure shrugs, @S@`Yes, I left "
"your brother's command. I was Phaedra stationed with your "
"brother in Helcarion... until the back of "
"our forces was resoundingly broken.'");
addTopic("yes, I know you", "@D@The figure shrugs, @S@`Your resemblance to "
"your brother is unmistakable.' @D@The black-robed looks quite "
"pleased with himself.");

addResponse("yes, I know you", "Galadhel?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::look## at Galadhel "
"in shock and ##ResponseInfinitive::ask##, @S@`Galadhel?'");
addResponse("yes, I know you", "Who are you?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::look## at Galadhel "
"in shock and ##ResponseInfinitive::return## ##InitiatorPossessive## "
"gaze to the black-robed figure. @C@##InitiatorName## "
"##ResponseInfinitive::ask##, @S@`Who are you?'");

addResponsePrerequisite("yes, I know you", "Galadhel?",
(["presence":(["type":"presence", "value" : ({ "galadhel" })])]));
}

addResponse("yes, I know you", "You were Phaedra?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::look## at the figure "
"in shock and ##ResponseInfinitive::ask##, @S@`Helcarion? Whose "
"command were you under?'");

/////////////////////////////////////////////////////////////////////////////
private void StopInterrupting()
{
addTopic("stop interrupting", "@D@The figure smirks and wryly says, "
"@S@`My tale is much better if I am not constantly interrupted. "
"Do you wish to hear it or no?'");

addTopicInterjection("stop interrupting",
"/lib/tutorial/characters/galadhel/galadhel.c",
"Interruptions aren't your only concern", 1);

addResponseTopic("yes, I know you", "Galadhel?", "stop interrupting");
addResponseTopic("yes, I know you", "You were Phaedra?", "stop interrupting");
addResponseTopic("yes, I know you", "Who are you?", "stop interrupting");

addTopic("I was Phaedra", "@D@The figure shrugs, apparently not at all "
"opposed to spilling his guts. It's almost as if he enjoys telling "
"how deeply rooted his associates are in Eledhel's politics. @S@`"
"I was Phaedra. We were stationed in Helcarion... Your brother's "
"command. That is, until the back of our forces was resoundingly "
"broken.'");

addResponse("I was Phaedra", "Wait. What?",
"@D@Stunned, ##InitiatorName## ##ResponseInfinitive::look## at the figure "
"and ##ResponseInfinitive::ask##, @S@`Helcarion? What "
"happened?'");
addResponse("I was Phaedra", "And?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::look## at the figure "
"and ##ResponseInfinitive::say##, @S@`And?'");

addTopic("We fought but lost", "@S@`We fought until but five of us were "
"left. It was obvious that we were to be captured, for they would not "
"kill us though the corpses of our foes piled up in walls before us.' "
"@D@The black-robed figure glances at Galadhel and adds, @S@`Finally, "
"weariness and the unabated attack of our foes overwhelmed us. We "
"were taken. It was not a difficult choice to lay aside my allegiance "
"after I saw what they did to Mendros. That aside, they paid me very "
"well.'");
addResponseTopic("I was Phaedra", "Wait. What?", "We fought but lost");
addResponseTopic("I was Phaedra", "And?", "We fought but lost");
}

/////////////////////////////////////////////////////////////////////////////
private void SoThenWhat()
{
addResponse("We fought but lost", "Galadhel's brother...",
"@D@@C@##InitiatorName## ##ResponseInfinitive::frown## slightly and "
"##ResponseInfinitive::ask##, @S@`And what of Galadhel's brother?'");
addResponse("We fought but lost", "Who are you people?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::frown## slightly and "
"##ResponseInfinitive::ask##, @S@`Who, no what, are you people? What "
"is your purpose here? And don't you dare continue with the mushroom "
"farmer story.'");
addResponse("We fought but lost", "What did they do to Mendros?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::frown## slightly and "
"##ResponseInfinitive::ask##, @S@`What did they do to Mendros?'");
addResponse("We fought but lost", "What are you doing?",
"@D@@C@##InitiatorName## ##ResponseInfinitive::frown## slightly and "
"##ResponseInfinitive::ask##, @S@`What are you and your fellows doing "
"here? And don't you dare continue with the mushroom "
"farmer story.'");

addTopic("so then what", "@D@The figure begins, @S@`Very well, I su..'");
addResponseTopic("We fought but lost", "Galadhel's brother...",
"so then what");
addResponseTopic("We fought but lost", "Who are you people?",
"so then what");
addResponseTopic("We fought but lost", "What did they do to Mendros?",
"so then what");
addResponseTopic("We fought but lost", "What are you doing?",
"so then what");

addTopicInterjection("so then what",
"/lib/tutorial/characters/donald/donald.c",
"we waste time on this bastard", 1);
}

/////////////////////////////////////////////////////////////////////////////
Expand All @@ -204,4 +274,6 @@ protected void Setup()
BadHost();
IAmAFarmer();
YouKnowMe();
StopInterrupting();
SoThenWhat();
}
18 changes: 18 additions & 0 deletions tutorial/characters/donald/startingConversation.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ private void BrendanOeldhen()
"besotted fool", 1);
}

/////////////////////////////////////////////////////////////////////////////
private void WeWasteTime()
{
addTopic("we waste time on this bastard", "\n@D@Donald tears his sword "
"from the black-robed figure's leg and shoves the blade through the "
"his throat. Donald gives the now severed head of the man a swift "
"kick into the bushes, separating it from it's body by many feet "
"@S@`We waste time! Did anything he said mean anything to you? "
"Does it shine any light on why they attacked our camp?");

addTopicEvent("we waste time on this bastard", "killPoorBrendan");

addTopicInterjection("we waste time on this bastard",
"/lib/tutorial/characters/galadhel/galadhel.c",
"did it mean anything to me?", 1);
}

/////////////////////////////////////////////////////////////////////////////
protected void Setup()
{
Expand All @@ -86,4 +103,5 @@ protected void Setup()
Haldor();
LetsGetTheseBastards();
BrendanOeldhen();
WeWasteTime();
}
53 changes: 51 additions & 2 deletions tutorial/characters/galadhel/brendanOeldhenConversation.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,60 @@ private void YouKnowMe()
addTopic("you know me?", "@D@Galadhel tilts her head, curious now and "
"uses the tip of the arrow in her hand to ease aside the fabric "
"of the hood of his robe. Her features register recognition after "
"a moment and she says softly, @S@`Brendan Oeldhen? What brings you "
"to this end? How did you come to par...'");
"a moment and she says softly, @S@`You know me? Who are you?'");

addTopicInterjection("you know me?",
"/lib/tutorial/characters/brendan/brendan.c",
"yes, I know you", 1);

addTopic("Interruptions aren't your only concern",
"@D@Galadhel offers a small smile to "
"the robed figure now, eerily sincere. Her voice, however, lowers "
"to a whisper as she stretches back her bow string, arrow at the "
"ready and aimed right between the legs of her prey. @S@`Speak now.'");

addTopicInterjection("Interruptions aren't your only concern",
"/lib/tutorial/characters/halgaladh/halgaladh.c",
"no more mushroom farmers", 1);

addTopicInterjection("Interruptions aren't your only concern",
"/lib/tutorial/characters/brendan/brendan.c",
"I was Phaedra", 1);
}

/////////////////////////////////////////////////////////////////////////////
private void DidItMeanAnythingToMe()
{
addTopic("did it mean anything to me?", "@D@Galadhel looks something "
"between shocked and murderous at this point. When Donald asks his "
"questions, she is prodded out of her moment of evil contemplation. "
"She hisses softly in return, @S@`Did it mean anything to me?' @D@ "
"She blinks. Once. Her voice raises as she steps toward Donald. @S@ "
"`Did it mean anything to me?' @D@Without hesitation, she takes "
"advantage of Donald's recent injury and casual conversational "
"attitude to quickly and precisely offer a left hook to his temple. "
"After he falls, she says politely to his unconscious form, @S@"
"`As a matter of fact it was very meaningful. He knew my brother. "
"That means this man was Phaedra. It means he had access to some of "
"our country's best intelligence. It also means that this group of "
"black-robed bad-tasted hoodlums may have some connection to our own "
"government.'");
addResponse("did it mean anything to me?", "@I@Continue@E@", "");

addTopic("did it mean anything to me part 2", "@D@Galadhel leans closer, "
"looking as though she is listening to something Donald is obviously "
"in no position to utter. @S@`Oh yes! I'm so glad you asked, esteemed "
"commander. I am still searching for my brother. This man not only "
"could have shed some light on that, but more about what we're up "
"against here and why his group wantonly slayed so many of our "
"cherished friends. It's not every day close to fifteen percent of "
"the Aegis is murdered.' @D@She lets her words trail off, a litany "
"of colourful anecdotes that no noble lady of the realm ought to "
"have heard in her day, nevermind uttered. As she disappears into the "
"woods, she can be heard to say, @S@`I'll give you meaning, you "
"stupid son of a ...'");
addResponseTopic("did it mean anything to me?", "@I@Continue@E@",
"did it mean anything to me part 2");
}

/////////////////////////////////////////////////////////////////////////////
Expand All @@ -88,4 +136,5 @@ protected void Setup()

FindingHaldor();
YouKnowMe();
DidItMeanAnythingToMe();
}
6 changes: 6 additions & 0 deletions tutorial/characters/halgaladh/startingConversation.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ protected void Setup()
addTopicInterjection("stinks part two",
"/lib/tutorial/characters/galadhel/galadhel.c",
"What are we missing", 1);

addTopic("no more mushroom farmers", "@D@As Halgaladh sees Galadhel train "
"her bow on her target, he snickers and adds, @S@`Galadhel, what "
"you're 'aiming' to do doesn't look like a bad plan of action. At "
"least we won't have to worry about him siring more mushroom "
"farmers.");
}
11 changes: 11 additions & 0 deletions tutorial/rooms/onTheTrailPart8.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ public void init()
if (present("donald"))
{
present("donald")->attack(keeper);
present("donald")->registerEvent(this_object());
}
}
}

/////////////////////////////////////////////////////////////////////////////
public void killPoorBrendan()
{
object brendan = present("brendan");
if (brendan)
{
brendan->hit(1000, "physical");
}
}

0 comments on commit 3f8b4d2

Please sign in to comment.