… | |
… | |
9 | ); |
9 | ); |
10 | |
10 | |
11 | sub stats_get($) { |
11 | sub stats_get($) { |
12 | my ($stats, $save) = @_; |
12 | my ($stats, $save) = @_; |
13 | |
13 | |
14 | for my $stat (@STATS) { |
|
|
15 | $save->{$stat} = $stats->$stat; |
14 | $save->{$_} = $stats->$_ |
16 | } |
15 | for @STATS; |
17 | |
16 | |
18 | $save |
17 | $save |
19 | } |
18 | } |
20 | |
19 | |
21 | sub stats_set($$) { |
20 | sub stats_set($$) { |
22 | my ($stats, $save) = @_; |
21 | my ($stats, $save) = @_; |
23 | |
22 | |
24 | for my $stat (@STATS) { |
|
|
25 | $stats->$stat ($save->{$stat}); |
23 | $stats->$_ ($save->{$_}) |
26 | } |
24 | for @STATS; |
27 | |
25 | |
28 | $stats->hp ($stats->maxhp); |
26 | $stats->hp ($stats->maxhp); |
29 | $stats->grace ($stats->maxgrace); |
27 | $stats->grace ($stats->maxgrace); |
30 | $stats->food (999); |
28 | $stats->food (999); |
31 | } |
29 | } |
… | |
… | |
98 | && abs ($pl->ob->x - $x) <= 1 |
96 | && abs ($pl->ob->x - $x) <= 1 |
99 | && abs ($pl->ob->y - $y) <= 1; |
97 | && abs ($pl->ob->y - $y) <= 1; |
100 | |
98 | |
101 | my $portal = cf::object::new "exit"; |
99 | my $portal = cf::object::new "exit"; |
102 | |
100 | |
103 | $portal->slaying ($map); |
101 | $portal->slaying ($map); |
104 | $portal->hp ($x); |
102 | $portal->stats->hp ($x); |
105 | $portal->sp ($y); |
103 | $portal->stats->sp ($y); |
106 | |
104 | |
107 | $portal->apply ($pl->ob); |
105 | $portal->apply ($pl->ob); |
108 | |
106 | |
109 | $portal->free; |
107 | $portal->free; |
110 | } |
108 | } |