-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvactor.t
147 lines (123 loc) · 4.28 KB
/
convactor.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
#include <convmain.h>
// Modified Actor
// For properName replacements
modify Actor
nameIsKnown = nil
makeProper() {
if(properName != nil) {
name = properName;
cmdDict.addWord(self,properName,&noun);
isProperName = true;
nameIsKnown = true;
}
// return name;
}
;
class InsultTopic : MiscTopic
includeInList = [&miscTopics]
matchList = [insultTopicObj]
;
insultTopicObj : object;
/*modify DefaultCommandTopic
handleTopic(fromActor, action) {
actionPhrase = action.getInfPhrase;
actionPhrase = actionPhrase.findReplace(' you ', ' me ', ReplaceAll);
if(actionPhrase.endsWith(' you'))
actionPhrase = actionPhrase.findReplace(' you', ' me', ReplaceOnce,
actionPhrase.length-5);
currentAction = action;
inherited(fromActor, action);
}
actionPhrase = nil
currentAction = nil
;*/
// Actor insult code
modify Actor
dobjFor(Insult) {
preCond = [canTalkToObj]
verify() {
/* Don't demean yourself */
if (gActor == self)
illogical('You could insult yourself, but you\'re sure to come up with a clever response, or be humiliated. You\'d win, but also lose. It\'s best not to play at all. ');
}
action(){
/* note that the issuer is targeting us with conversation */
gActor.noteConversation(self);
/* let the state object handle it */
curState.handleConversation(gActor, insultTopicObj, insultConvType);
}
}
defaultInsultResponse(actor) { "\^<<theName>> ignores your clumsy insults. "; }
;
insultConvType : ConvType
unknownMsgType = 'No-one\'s listening. '
topicListProp = &miscTopics
defaultResponseProp = &defaultInsultResponse
defaultResponse(db, other, topic)
{ db.defaultInsultResponse(other); }
;
modify SuggestedTopic
timesToSuggest = (ofKind(EventList) ? eventList.length() : 1)
;
modify DefaultAskForTopic
handleTopic(fromActor, topic) {
/* note the invocation */
noteInvocation(fromActor);
/* set pronoun antecedents if possible */
setTopicPronouns(fromActor, topic);
obj = topic.getBestMatch;
if(obj == nil)
inherited(fromActor, topic);
else if(obj.ofKind(Thing))
handleThing(fromActor);
else if(obj.ofKind(Topic))
topicMsg;
}
/* The object (if any) matched by this topic */
obj = nil
handleThing(fromActor) {
if(obj.isIn(fromActor))
alreadyHaveMsg;
else if(obj.isIn(getActor))
refuseMsg;
else if(obj == getActor)
askForOtherMsg;
else if(obj == fromActor)
askForSelfMsg;
else if(getActor.canSee(obj))
pointOutMsg;
else
dontHaveMsg;
}
/* The message to display if the player character asks for something he already has.
If the player character is carrying the asked-for object in another container,
the NPC points this out. */
alreadyHaveMsg = "<q>You already have <<obj.theName>>,</q>
<<getActor.theName>> points
out<<obj.isDirectlyIn(gActor) ? '.' : ', <q>'+
obj.itIsContraction + ' in that ' +
obj.location.name + ' you\'re carrying.</q>'>>
"
/* The message to display if the requested actor has the object asks for but declines to hand it over */
refuseMsg = "<q>No, I need <<obj.itObj>> myself.</q> <<getActor.itNom>> replies. "
/* The message to display if neither the asker nor the askee has the object but the askee can see where it is */
pointOutMsg = "<q>\^<<obj.itIsContraction>> just over there,</q>
<<getActor.itNom>> observes, pointing at
<<obj.location.ofKind(Room) ? 'the ground' :
obj.location.theName>>. "
/* The message to display if neither the asker nor the askee has the object and the askee can't see it */
dontHaveMsg = "<q>I'm afraid I don't have <<obj.itObj>>,</q>
<<getActor.itNom>> tells you. "
/* The message to display if the player asks for the NPC */
askForOtherMsg = "<q>That's me - here I am.</q> <<getActor.itNom>> tells you. "
/* The message to display if the player asks for himself/herself */
askForSelfMsg = "<q>You\'re right there,</q> <<getActor.itNom>> point{s} out. "
/* By default we use the standard handling for a defined topic, but this can be overridden if desired. */
topicMsg() {
if(ofKind(Script)) doScript;
else topicResponse;
}
;