… | |
… | |
19 | List::Util::max |
19 | List::Util::max |
20 | map $_->type == cf::FORCE && $_->slaying =~ /^Invitor Level (\d+)$/ ? $1 : 0, |
20 | map $_->type == cf::FORCE && $_->slaying =~ /^Invitor Level (\d+)$/ ? $1 : 0, |
21 | $ob->inv |
21 | $ob->inv |
22 | } |
22 | } |
23 | |
23 | |
24 | # determine level required for the given map/position |
24 | # determine level required for the given location |
25 | sub map_level { |
25 | sub map_level { |
26 | my ($map, $x, $y) = @_; |
26 | my ($map, $x, $y) = @_; |
27 | |
27 | |
28 | my $path = $map->path; |
|
|
29 | my $player = sprintf "%s/%s/", cf::localdir, cf::playerdir; |
|
|
30 | |
|
|
31 | for my $x (0 .. $map->width - 1) { |
28 | for my $x (0 .. $map->width - 1) { |
32 | for my $y (0 .. $map->height - 1) { |
29 | for my $y (0 .. $map->height - 1) { |
33 | return 4 |
30 | return 4 |
34 | if grep $_->flag (cf::FLAG_MONSTER), |
31 | if grep $_->flag (cf::FLAG_MONSTER), |
35 | $map->at ($x, $y); |
32 | $map->at ($x, $y); |
36 | } |
33 | } |
37 | } |
34 | } |
38 | |
35 | |
|
|
36 | my $path = $map->path; |
|
|
37 | my $player = sprintf "%s/%s/", cf::localdir, cf::playerdir; |
|
|
38 | |
39 | if ($player eq substr $path, 0, length $player) { |
39 | if ($player eq substr $path, 0, length $player) { |
40 | 1 |
40 | 1 |
41 | } elsif (grep $_->flag (cf::FLAG_UNIQUE) && $_->flag (cf::FLAG_IS_FLOOR), |
41 | } elsif (grep $_->flag (cf::FLAG_UNIQUE) && $_->flag (cf::FLAG_IS_FLOOR), |
42 | $map->at ($x, $y)) { |
42 | $map->at ($x, $y)) { |
43 | 2 |
43 | 2 |
… | |
… | |
93 | |
93 | |
94 | $portal->set_slaying ($map->path); |
94 | $portal->set_slaying ($map->path); |
95 | $portal->set_hp ($x); |
95 | $portal->set_hp ($x); |
96 | $portal->set_sp ($y); |
96 | $portal->set_sp ($y); |
97 | |
97 | |
98 | $portal->apply ($pl, 0); |
98 | $portal->apply ($pl); |
99 | |
99 | |
100 | $portal->free; |
100 | $portal->free; |
101 | } |
101 | } |
102 | |
102 | |
103 | cf::register_command "accept-invitation" => 10, sub { |
103 | cf::register_command "accept-invitation" => 10, sub { |