summaryrefslogtreecommitdiffstats
path: root/lib/Games/SMTNocturne/Demons.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-05-25 02:08:35 -0400
committerJesse Luehrs <doy@tozt.net>2014-05-25 02:08:35 -0400
commit4eba504c1522ecec0595db81cfffd04badf67e56 (patch)
tree42652b67c8c6050da9f78681007d8f758d2754e0 /lib/Games/SMTNocturne/Demons.pm
parent563e01add1eeeedbe14744bf214b0c37c38a82d0 (diff)
downloadgames-smtnocturne-demons-4eba504c1522ecec0595db81cfffd04badf67e56.tar.gz
games-smtnocturne-demons-4eba504c1522ecec0595db81cfffd04badf67e56.zip
implement basic fusions
Diffstat (limited to 'lib/Games/SMTNocturne/Demons.pm')
-rw-r--r--lib/Games/SMTNocturne/Demons.pm26
1 files changed, 26 insertions, 0 deletions
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;