From 2a5da1a4d4f9cdeeb5dece6710afd5ca828cb0c8 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 25 May 2014 02:23:55 -0400 Subject: function to get possible types that can fuse to make a type --- lib/Games/SMTNocturne/Demons/FusionChart.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Games/SMTNocturne/Demons') 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__ -- cgit v1.2.3-54-g00ecf