diff options
Diffstat (limited to 'lib/Games')
-rw-r--r-- | lib/Games/SMTNocturne/Demons.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Games/SMTNocturne/Demons.pm b/lib/Games/SMTNocturne/Demons.pm index b648bf6..336a12a 100644 --- a/lib/Games/SMTNocturne/Demons.pm +++ b/lib/Games/SMTNocturne/Demons.pm @@ -23,4 +23,25 @@ sub fuse { ); } +sub fusions_for { + my ($demon) = @_; + + $demon = Games::SMTNocturne::Demons::Demon->from_name($demon) + unless ref($demon); + + my @fusions; + my %seen; + for my $types (Games::SMTNocturne::Demons::FusionChart::unfuse($demon->type)) { + my ($type1, $type2) = @$types; + for my $demon1 (Games::SMTNocturne::Demons::Demon->from_type($type1)) { + for my $demon2 (Games::SMTNocturne::Demons::Demon->from_type($type2)) { + push @fusions, [ $demon1, $demon2 ] + if fuse($demon1, $demon2) eq $demon; + } + } + } + + return @fusions; +} + 1; |