… | |
… | |
7 | type => cf::SPELL, |
7 | type => cf::SPELL, |
8 | subtype => cf::SP_MAGIC_MAPPING, |
8 | subtype => cf::SP_MAGIC_MAPPING, |
9 | on_cast_spell => sub { |
9 | on_cast_spell => sub { |
10 | my ($spell, $who, $caster, $dir, $arg) = @_; |
10 | my ($spell, $who, $caster, $dir, $arg) = @_; |
11 | |
11 | |
12 | my ($map, $x, $y) = ($caster->map, $caster->x, $caster->y); |
12 | my ($map, $x, $y) = ($who->map, $who->x, $who->y); |
13 | |
13 | |
14 | # dirty check, should maybe allow tiled outdoor maps? |
14 | # dirty check, should maybe allow tiled outdoor maps? |
15 | $map->path =~ m%/world/world_% |
15 | $map->path =~ m%/world/world_% |
16 | or return; |
16 | or return; |
17 | |
17 | |
18 | my $bird = cf::object::new "magic_mapper"; |
18 | my $bird = cf::object::new "magic_mapper"; |
19 | my $pl = $caster->contr; |
19 | my $pl = $caster->contr; |
20 | my $dist = 0; |
20 | my $dist = 0; |
21 | $caster->speed_left (-1); $pl->fire_on (0); $pl->run_on (0); |
21 | $caster->speed_left (-1); $pl->fire_on (0); $pl->run_on (0); |
22 | |
22 | |
23 | my $duration = $who->casting_level ($spell) * 150 / 100; |
23 | my $duration = $caster->casting_level ($spell) * 150 / 100; |
24 | |
24 | |
25 | $pl->ns->async (sub { |
25 | $pl->ns->async (sub { |
26 | while (++$dist < $duration && $bird->valid) { |
26 | while (++$dist < $duration && $bird->valid) { |
27 | my $phi = 2 * $dist ** .5; |
27 | my $phi = 2 * $dist ** .5; |
28 | my $dx = (sin $phi) * $phi * 2; |
28 | my $dx = (sin $phi) * $phi * 2; |