summaryrefslogtreecommitdiffstats
path: root/lib/Games/SMTNocturne/Fusion/Demon.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Games/SMTNocturne/Fusion/Demon.pm')
-rw-r--r--lib/Games/SMTNocturne/Fusion/Demon.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Games/SMTNocturne/Fusion/Demon.pm b/lib/Games/SMTNocturne/Fusion/Demon.pm
index bc386d1..23df00c 100644
--- a/lib/Games/SMTNocturne/Fusion/Demon.pm
+++ b/lib/Games/SMTNocturne/Fusion/Demon.pm
@@ -99,6 +99,24 @@ sub lookup {
return wantarray ? @possible : (@possible == 1 ? $possible[0] : undef);
}
+sub level_up {
+ my $self = shift;
+ my @possible = $self->lookup(
+ type => $self->type,
+ level => sub { $_ > $self->level },
+ );
+ return $possible[0];
+}
+
+sub level_down {
+ my $self = shift;
+ my @possible = $self->lookup(
+ type => $self->type,
+ level => sub { $_ < $self->level },
+ );
+ return $possible[$#possible];
+}
+
__PACKAGE__->meta->make_immutable;
1;