forked from fuzzball-muck/fuzzball-muf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd-kill.muf
185 lines (158 loc) · 5.14 KB
/
cmd-kill.muf
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
@program cmd-kill
1 99999 d
1 i
(*
* cmd-kill.muf
*
* MUF implementation of the FuzzBall 'kill' command that existed until
* its removal in fb7. This is generally considered a completely useless
* command, as it [usually] requires both participants to opt-in and the
* result is to pay pennies to sweep someone.
*
* It is very rare to find anyone opting in to this program, and even
* more rare to find somone using it to sweep someone else. RP MUCKs
* generally have a "real" combat system in place instead.
*
* Anyway, this is a MUF implementation for any MUCK that still wants to
* use this old system.
*)
(* These defines mimic the tune parameters that are now gone. Feel free
* to season them to taste -- the defaults are what are used on most MUCKs.
*)
(* TP_RESTRICT_KILL - This requires both participants to have the KILL_OK flag
* set.
*)
$def TP_RESTRICT_KILL 1
(* The minimum cost to attempt to kill someone *)
$def TP_KILL_MIN_COST 10
(* If the player pays this much, they will 100% succeed in the kill. *)
$def TP_KILL_BASE_COST 100
(* The player being killed gets this much money as what the messaging
* refers to as the "insurance policy". They don't get this money if
* they already have max_pennies.
*)
$def TP_KILL_BONUS 50
(* END CONFIGURATION *)
: help ( -- )
{
" KILL <player> [=<cost>]"
" "
" A successful kill sends the player home, sends all objects in the"
"player's inventory to their respective homes. The probability of"
"killing the player is <cost> percent. Spending 100 pennies always"
"works except against Wizards who cannot be killed. Players cannot"
"be killed in rooms which have the HAVEN flag set. On systems where"
"the KILL_OK flag is used, you cannot kill someone unless both you"
"and they are set Kill_OK."
" "
"Getting killed is no big deal. If you are killed, you return to your home,"
"and all things you carry return to their homes. You also collect 50 pennies"
"in insurance money (unless you have >= 10000 pennies)."
}tell
;
: main ( s -- )
dup strlen not if
pop help exit
then
(* Haven check first *)
me @ location "HAVEN" flag? if
pop "You can't kill anyone here!" tell exit
then
TP_RESTRICT_KILL me @ "KILL_OK" flag? not and if
pop "You have to be set KILL_OK to kill someone." tell exit
then
(* Parse out cost, if available *)
dup "=" instring if
"=" rsplit atoi
else
TP_KILL_MIN_COST
then
var! Cost
(* Only players may be killed. *)
match dup player? not if
dup #-2 = if
pop "I don't know which one you mean." tell exit
else #-1 = if
"I don't know who you want to kill." tell
(* This is, technically, not in the original C code. Also, it is
* unlikely this line of code will ever be used. So consider it
* my personal easter egg.
*)
me @ name " looks around with murderous intent." strcat otell
exit
else
"Sorry, you can only kill other players." tell exit
then then
then
(* Only wizards may tele-murder *)
dup location me @ location = me @ "WIZARD" flag? or not if
pop "I don't see that here." tell exit
then
dup "KILL_OK" flag? not TP_RESTRICT_KILL and if
(* It is trivial to parse pronouns, but the original C code didn't
* do it, so I'm not going to do it either. It's a faithful recreation,
* says the guy that put an easter egg in up about 10 lines ago.
*)
pop "They don't want to be killed." tell exit
then
(* Round up to minimum cost -- this is done silently in the C version
* as well.
*)
Cost @ TP_KILL_MIN_COST < if
TP_KILL_MIN_COST Cost !
then
(* Make sure they can pay for it. *)
me @ pennies Cost @ < if
pop "You don't have enough " "pennies" sysparm "." strcat strcat tell
exit
then
(* Pay to play *)
me @ Cost @ -1 * addpennies
(* Can't kill wizards, ever. *)
dup "WIZARD" flag? random TP_KILL_BASE_COST % Cost @ >= or if
"Your murder attempt failed." tell
me @ name " tried to kill you!" strcat notify
exit
then
(* Do messaging *)
dup "_/dr" getpropstr strlen if
dup "_/dr" "(Drop)" 1 parseprop tell
else
dup name "You killed " swap strcat "!" strcat tell (* You bastard! *)
then
dup "_/odr" getpropstr strlen if
dup "_/odr" "(ODrop)" 0 parseprop
(* Prepend name, if needed *)
dup me @ name stringpfx not if
me @ name " " strcat swap strcat
then
otell
else
dup name me @ name " killed " strcat swap strcat "!" strcat otell
then
(* Pay insurance *)
dup pennies "max_pennies" sysparm atoi < if
(* Yes, the C code doesn't take into account an insurance policy of
* 0 or even negative if you really want to be a jerk!
*)
dup
"Your insurance policy pays " TP_KILL_BONUS intostr strcat
" " strcat "pennies" sysparm strcat "." strcat notify
dup TP_KILL_BONUS addpennies
else
dup "Your insurance policy has been revoked." notify
then
(* Sweep the player's contents home *)
me @ contents
begin
dup thing? while
dup #-3 moveto
next
repeat
pop
(* And lastly sweep the player *)
#-3 moveto
;
.
c
q