1 | #! perl |
1 | #! perl |
|
|
2 | #CONVERSION: PARTIAL |
2 | |
3 | |
3 | # handle the nimbus map and other stuff |
4 | # handle the nimbus map and other stuff |
4 | |
5 | |
5 | my @STATS = qw( |
6 | my @STATS = qw( |
6 | Str Dex Con Wis Cha Int Pow |
7 | Str Dex Con Wis Cha Int Pow |
… | |
… | |
53 | } |
54 | } |
54 | } |
55 | } |
55 | |
56 | |
56 | # called when the player will likely die (modulo explore mode) |
57 | # called when the player will likely die (modulo explore mode) |
57 | # but before any stats/exp is changed |
58 | # but before any stats/exp is changed |
58 | sub on_player_death { |
59 | cf::attach_to_players |
|
|
60 | on_death => sub { |
59 | my ($ob) = @_; |
61 | my ($pl) = @_; |
|
|
62 | my $ob = $pl->ob; |
60 | |
63 | |
61 | my $pl = $ob->contr; |
64 | # save player stats and experience to restore it later |
62 | |
65 | |
63 | # save player stats and experience to restore it later |
66 | unless ($ob->{in_nimbus}) { |
|
|
67 | my $save = { |
|
|
68 | stats => stats_get $ob->stats, |
|
|
69 | orig_stats => stats_get $pl->orig_stats, |
|
|
70 | savebed => [$pl->get_savebed], |
|
|
71 | skill_exp => skills_get $ob, |
|
|
72 | }; |
64 | |
73 | |
65 | unless ($ob->{in_nimbus}) { |
74 | $ob->{in_nimbus} = $save; |
66 | my $save = { |
|
|
67 | stats => stats_get $ob->stats, |
|
|
68 | orig_stats => stats_get $pl->orig_stats, |
|
|
69 | savebed => [$pl->get_savebed], |
|
|
70 | skill_exp => skills_get $ob, |
|
|
71 | }; |
|
|
72 | |
75 | |
73 | $ob->{in_nimbus} = $save; |
76 | $ob->message ("\n"); |
|
|
77 | $ob->message ("You start to feel dizzy.\n"); |
|
|
78 | $ob->message ("The world around you blurs.\n"); |
|
|
79 | $ob->message ("\n"); |
|
|
80 | } |
74 | |
81 | |
75 | $ob->message ("\n"); |
82 | my $path = sprintf "%s/%s/%s/%s", |
76 | $ob->message ("You start to feel dizzy.\n"); |
83 | cf::localdir, cf::playerdir, $ob->name, "nimbus"; |
77 | $ob->message ("The world around you blurs.\n"); |
|
|
78 | $ob->message ("\n"); |
|
|
79 | } |
|
|
80 | |
84 | |
81 | my $path = sprintf "%s/%s/%s/%s", |
|
|
82 | cf::localdir, cf::playerdir, $ob->name, "nimbus"; |
|
|
83 | |
|
|
84 | if ($ob->map->path ne $path) { |
85 | if ($ob->map->path ne $path) { |
85 | my $nimbus = cf::map::get_map "/schmorp/nimbus"; |
86 | my $nimbus = cf::map::get_map "/schmorp/nimbus"; |
86 | $nimbus->set_path ($path); |
87 | $nimbus->set_path ($path); |
87 | $nimbus->set_unique (1); |
88 | $nimbus->set_unique (1); |
88 | |
89 | |
89 | $pl->set_savebed ($path, 24, 12); |
90 | $pl->set_savebed ($path, 24, 12); |
|
|
91 | } |
90 | } |
92 | }, |
91 | |
93 | ; |
92 | 0 |
|
|
93 | } |
|
|
94 | |
94 | |
95 | sub teleport { |
95 | sub teleport { |
96 | my ($pl, $map, $x, $y) = @_; |
96 | my ($pl, $map, $x, $y) = @_; |
97 | |
97 | |
98 | return if $pl->ob->map->path eq $map |
98 | return if $pl->ob->map->path eq $map |