From c4b49f49450e9de62f65ed3756ecb0bb509e4b5c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 25 May 2014 10:21:21 -0400 Subject: normal fusions should only result in normal fusion types --- lib/Games/SMTNocturne/Demons.pm | 4 ++-- lib/Games/SMTNocturne/Demons/Demon.pm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/Games/SMTNocturne/Demons.pm b/lib/Games/SMTNocturne/Demons.pm index 0cc20c8..e1e482d 100644 --- a/lib/Games/SMTNocturne/Demons.pm +++ b/lib/Games/SMTNocturne/Demons.pm @@ -94,8 +94,8 @@ sub _normal_fusion { my $new_level = ($demon1->level + $demon2->level) / 2 + 1; - return Games::SMTNocturne::Demons::Demon->from_type_and_level( - $new_type, $new_level + return Games::SMTNocturne::Demons::Demon->from_fusion_stats( + $new_type, $new_level, 'normal' ); } diff --git a/lib/Games/SMTNocturne/Demons/Demon.pm b/lib/Games/SMTNocturne/Demons/Demon.pm index 53d3cd8..4a1b8ce 100644 --- a/lib/Games/SMTNocturne/Demons/Demon.pm +++ b/lib/Games/SMTNocturne/Demons/Demon.pm @@ -29,13 +29,13 @@ sub from_name { return $DEMONS_BY_NAME{$name}; } -sub from_type_and_level { - my ($class, $type, $level) = @_; +sub from_fusion_stats { + my ($class, $type, $level, $fusion_type) = @_; die "unknown type $type" unless $DEMONS_BY_TYPE{$type}; my $found; - for my $demon (@{ $DEMONS_BY_TYPE{$type} }) { + for my $demon (grep { $_->fusion_type eq $fusion_type } @{ $DEMONS_BY_TYPE{$type} }) { $found = $demon; last if $demon->level >= $level; } -- cgit v1.2.3-54-g00ecf