summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-10-05 21:11:24 -0500
committerJesse Luehrs <doy@tozt.net>2009-10-05 21:32:13 -0500
commit4be05163cc0be9bd4615a44954a6d7d11309b8fe (patch)
tree39f06ea66bf95560ddf590e4cc3a83c9a7065951
parenta8aa9525b5fe556470fdf96a0bab733c1d616b0a (diff)
downloadgames-smtnocturne-fusion-4be05163cc0be9bd4615a44954a6d7d11309b8fe.tar.gz
games-smtnocturne-fusion-4be05163cc0be9bd4615a44954a6d7d11309b8fe.zip
add subtypes for each specific demon type
-rw-r--r--lib/Games/SMTNocturne/Fusion/Types.pm21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Games/SMTNocturne/Fusion/Types.pm b/lib/Games/SMTNocturne/Fusion/Types.pm
index 2504803..a4a83d2 100644
--- a/lib/Games/SMTNocturne/Fusion/Types.pm
+++ b/lib/Games/SMTNocturne/Fusion/Types.pm
@@ -1,13 +1,15 @@
package Games::SMTNocturne::Fusion::Types;
-use MooseX::Types -declare => [qw(DemonType FusionType SMTDemon DemonList)];
+my @demon_types;
+BEGIN {
+ @demon_types =
+ qw(Deity Megami Fury Lady Kishin Holy Element Mitama Yoma Fairy Divine
+ Fallen Snake Beast Jirae Brute Femme Vile Tyrant Night Wilder Haunt
+ Foul Seraph Wargod Genma Dragon Avatar Avian Raptor Entity Fiend);
+}
+use MooseX::Types
+ -declare => [qw(DemonType FusionType SMTDemon DemonList), @demon_types];
use MooseX::Types::Moose qw(ArrayRef Str);
-# XXX: make each demon type a subtype of Demon
-my @demon_types =
- qw(Deity Megami Fury Lady Kishin Holy Element Mitama Yoma Fairy Divine
- Fallen Snake Beast Jirae Brute Femme Vile Tyrant Night Wilder Haunt
- Foul Seraph Wargod Genma Dragon Avatar Avian Raptor Entity Fiend);
-
enum DemonType, @demon_types;
enum FusionType, qw(deathstone evolve normal special);
@@ -18,4 +20,9 @@ subtype DemonList, as ArrayRef[SMTDemon];
coerce DemonList, from ArrayRef[Str],
via { [map { to_SMTDemon($_) } @$_] };
+for my $typename (@demon_types) {
+ my $type = __PACKAGE__->can($typename)->();
+ subtype $type, as SMTDemon, where { $_->type eq $typename };
+}
+
1;