… | |
… | |
74 | $ob->message ("You start to feel dizzy.\n"); |
74 | $ob->message ("You start to feel dizzy.\n"); |
75 | $ob->message ("The world around you blurs.\n"); |
75 | $ob->message ("The world around you blurs.\n"); |
76 | $ob->message ("\n"); |
76 | $ob->message ("\n"); |
77 | } |
77 | } |
78 | |
78 | |
79 | my $path = sprintf "%s/%s/%s/%s", |
79 | $pl->savebed ("/schmorp/nimbus", 24, 12); |
80 | cf::localdir, cf::playerdir, $ob->name, "nimbus"; |
|
|
81 | |
|
|
82 | if ($ob->map->path ne $path) { |
|
|
83 | my $nimbus = cf::map::find_map "/schmorp/nimbus"; |
|
|
84 | $nimbus->path ($path); |
|
|
85 | $nimbus->unique (1); |
|
|
86 | |
|
|
87 | $pl->savebed ($path, 24, 12); |
|
|
88 | } |
|
|
89 | }, |
80 | }, |
90 | ); |
81 | ); |
91 | |
|
|
92 | sub teleport { |
|
|
93 | my ($pl, $map, $x, $y) = @_; |
|
|
94 | |
|
|
95 | return if $pl->ob->map->path eq $map |
|
|
96 | && abs ($pl->ob->x - $x) <= 1 |
|
|
97 | && abs ($pl->ob->y - $y) <= 1; |
|
|
98 | |
|
|
99 | my $portal = cf::object::new "exit"; |
|
|
100 | |
|
|
101 | $portal->slaying ($map); |
|
|
102 | $portal->stats->hp ($x); |
|
|
103 | $portal->stats->sp ($y); |
|
|
104 | |
|
|
105 | $portal->apply ($pl->ob); |
|
|
106 | |
|
|
107 | $portal->destroy; |
|
|
108 | } |
|
|
109 | |
82 | |
110 | cf::object::attachment nimbus_exit => |
83 | cf::object::attachment nimbus_exit => |
111 | on_trigger => sub { |
84 | on_trigger => sub { |
112 | my ($self, $ob) = @_; |
85 | my ($self, $ob) = @_; |
113 | |
86 | |
… | |
… | |
129 | |
102 | |
130 | } else { |
103 | } else { |
131 | @savebed = ("/scorn/taverns/inn", 10, 5); |
104 | @savebed = ("/scorn/taverns/inn", 10, 5); |
132 | } |
105 | } |
133 | |
106 | |
|
|
107 | my $map = $ob->map; |
134 | $pl->savebed (@savebed); |
108 | $pl->savebed (@savebed); |
|
|
109 | $ob->goto_map (@savebed); |
135 | |
110 | |
136 | my $map = $ob->map; |
111 | $map->{deny_save} = 1; |
137 | |
112 | $map->unlink_save; |
138 | teleport $pl, @savebed; |
113 | $map->rename ("{nimbus}"); |
139 | |
|
|
140 | # should make this a temporary map and let cf deal with it |
|
|
141 | unlink $map->path; |
|
|
142 | unlink $map->path . ".pst"; |
|
|
143 | |
|
|
144 | $map->delete_map; |
114 | $map->reset; |
145 | |
115 | |
146 | $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); |
116 | $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); |
147 | |
117 | |
148 | $ob->message ("You feel as if you woke up from a dream.\n"); |
118 | $ob->message ("You feel as if you woke up from a dream.\n"); |
149 | $ob->message ("You have a headache.\n"); |
119 | $ob->message ("You have a headache.\n"); |