1 /*
2  * This "room" is a special object which can be dropped once.
3  */
4 int dropped;
5 int grow_stage;
6 string owner;
7 
set_owner(string n)8 void set_owner(string n) {
9     owner = n;
10 }
11 
reset(int arg)12 void reset(int arg) {
13     if (arg)
14 	return;
15     dropped = 0;
16     grow_stage = 5;
17 }
18 
19 string short() {
20     return "portable castle";
21 }
22 
23 void long() {
24     write(short() + ".\n");
25 }
26 
heart_beat()27 void heart_beat() {
28     if (!dropped)
29 	return;
30     if (grow_stage > 0) {
31 	say("The castle grows...\n");
32 	grow_stage -= 1;
33 	return;
34     }
35     if (grow_stage == 0) {
36 	string name;
37 	say("The portable castle has grown into a full castle !\n");
38 	shout("Something in the world has changed.\n");
39 	name = create_wizard(lower_case(owner), /* domain: */ 0);
40 	if (name)
41 	    move_object(name, environment());
42 	destruct(this_object());
43 	return;
44     }
45 }
46 
id(string str)47 int id(string str) {
48     return str == "castle";
49 }
50 
drop()51 int drop() {
52     if (environment(this_player())->query_drop_castle()) {
53 	write("Not this close to the city!\n");
54 	return 1;
55     }
56     dropped = 1;
57     shout("There is a mighty crash, and thunder.\n");
58     set_heart_beat(1);
59     return 0;
60 }
61 
get()62 int get() {
63     if (dropped) {
64 	write("You can't take it anymore !\n");
65 	return 0;
66     }
67     return 1;
68 }
69