From 4eba504c1522ecec0595db81cfffd04badf67e56 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 25 May 2014 02:08:35 -0400 Subject: implement basic fusions --- lib/Games/SMTNocturne/Demons.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'lib/Games/SMTNocturne/Demons.pm') diff --git a/lib/Games/SMTNocturne/Demons.pm b/lib/Games/SMTNocturne/Demons.pm index e69de29..b075dc5 100644 --- a/lib/Games/SMTNocturne/Demons.pm +++ b/lib/Games/SMTNocturne/Demons.pm @@ -0,0 +1,26 @@ +package Games::SMTNocturne::Demons; +use strict; +use warnings; + +use Games::SMTNocturne::Demons::Demon; +use Games::SMTNocturne::Demons::FusionChart; + +sub fuse { + my ($demon1, $demon2) = @_; + + $demon1 = Games::SMTNocturne::Demons::Demon->new_from_name($demon1) + unless ref($demon1); + $demon2 = Games::SMTNocturne::Demons::Demon->new_from_name($demon2) + unless ref($demon2); + + my $new_type = Games::SMTNocturne::Demons::FusionChart::fuse( + $demon1->type, $demon2->type + ); + my $new_level = ($demon1->level + $demon2->level) / 2; + + return Games::SMTNocturne::Demons::Demon->new_from_type_and_level( + $new_type, $new_level + ); +} + +1; -- cgit v1.2.3-54-g00ecf