diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-05-25 02:23:55 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-05-25 02:23:55 -0400 |
commit | 2a5da1a4d4f9cdeeb5dece6710afd5ca828cb0c8 (patch) | |
tree | 89c9aa5ddd7229795f347acd8e4582aa4d8a4bb6 /lib/Games/SMTNocturne/Demons | |
parent | 56927ba9e44de61a06e2c7ec2a48227a0d75a162 (diff) | |
download | games-smtnocturne-demons-2a5da1a4d4f9cdeeb5dece6710afd5ca828cb0c8.tar.gz games-smtnocturne-demons-2a5da1a4d4f9cdeeb5dece6710afd5ca828cb0c8.zip |
function to get possible types that can fuse to make a type
Diffstat (limited to 'lib/Games/SMTNocturne/Demons')
-rw-r--r-- | lib/Games/SMTNocturne/Demons/FusionChart.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Games/SMTNocturne/Demons/FusionChart.pm b/lib/Games/SMTNocturne/Demons/FusionChart.pm index 42e5f77..7848e40 100644 --- a/lib/Games/SMTNocturne/Demons/FusionChart.pm +++ b/lib/Games/SMTNocturne/Demons/FusionChart.pm @@ -15,6 +15,22 @@ sub fuse { return $TYPES{$type1}{$type2}; } +sub unfuse { + my ($type) = @_; + + die "unknown demon type $type" unless $TYPES{$type}; + + my @combinations; + for my $type1 (keys %TYPES) { + for my $type2 (grep { $_ le $type1 } keys %TYPES) { + push @combinations, [ $type1, $type2 ] + if $TYPES{$type1}{$type2} eq $type; + } + } + + return @combinations; +} + 1; __DATA__ |