1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
|
package Games::SMTNocturne::Fusion::Demon;
use Moose;
use Moose::Util::TypeConstraints;
use MooseX::ClassAttribute;
use MooseX::Types::Moose qw(ArrayRef HashRef Int Maybe Str);
use List::MoreUtils qw(any firstval lastval);
use YAML::Any qw(Load);
use Games::SMTNocturne::Fusion::Types qw(DemonType FusionType SMTDemon);
# XXX ick ick ick (n::ac breaks overload)
use namespace::clean -except => 'meta';
use overload '""' => sub {
my $self = shift;
'<' . $self->type . ' ' . $self->name . ' (' . $self->level . ')>'
};
# use namespace::autoclean;
with 'MooseX::Traits',
'MooseX::Role::Matcher' => { default_match => 'name' };
my @bosses = (qw(Forneus Specter Troll Matador Orthrus Yaksini Thor Daisoujou
Eligor Berith Kaiwan Ose Mizuchi Sui-Ki Kin-Ki Fuu-Ki Ongyo-Ki
Clotho Lachesis Atropos Girimehkala Sakahagi Aciel Skadi
Gabriel Uriel Raphael Futomimi Trumpeter Surt Mot Mithra
Samael Flauros Beelzebub Metatron),
'Hell Biker', 'White Rider', 'Red Rider', 'Black Rider',
'Pale Rider', 'The Harlot', 'Black Frost', 'Beelzebub (Fly)');
class_has _list => (
is => 'ro',
isa => ArrayRef[HashRef],
lazy => 1,
default => sub {
local $/ = undef;
my $data = <DATA>;
close DATA;
return Load($data);
},
);
class_has list => (
is => 'ro',
isa => ArrayRef[SMTDemon],
lazy => 1,
default => sub {
my $meta = shift;
my $class = $meta->name;
my %traits = map {
$_ => ["Games::SMTNocturne::Fusion::Role::" . ucfirst($_)]
} qw(deathstone evolve special);
$traits{normal} = [];
return [ map {
my $demon_class = "Games::SMTNocturne::Fusion::Demon::$_->{type}";
Class::MOP::load_class($demon_class);
my $traits = [@{ $traits{$_->{fusion_type}} }];
my $name = $_->{name};
push @$traits, 'Games::SMTNocturne::Fusion::Role::Boss'
if any { $_ eq $name } @bosses;
$demon_class->new_with_traits(
traits => $traits,
%$_,
);
} @{ $class->_list } ];
},
);
has name => (
is => 'ro',
isa => Str,
required => 1,
);
has level => (
is => 'ro',
isa => Int,
required => 1,
);
has type => (
is => 'ro',
isa => DemonType,
required => 1,
);
has fusion_type => (
is => 'ro',
isa => FusionType,
required => 1,
);
has elemental_fusions => (
traits => ['Hash'],
is => 'ro',
isa => HashRef[Maybe[enum[qw(up down)]]],
init_arg => undef,
default => sub { { } },
handles => {
elemental_fusion_direction => 'get',
},
);
has self_fusion_element => (
is => 'ro',
isa => Maybe[enum[qw(Erthys Aeros Aquans Flameis)]],
init_arg => undef,
default => undef,
);
sub lookup {
my ($class, @props) = @_;
my @possible = $class->grep_matches($class->list, @props);
return wantarray ? @possible : (@possible == 1 ? $possible[0] : undef);
}
sub fusion_possibility {
my $self = shift;
return
if $self->does('Games::SMTNocturne::Fusion::Role::NotNormallyFusable');
# XXX: should have a way to specify which bosses we've beaten so far
return
if $self->does('Games::SMTNocturne::Fusion::Role::Boss');
return 1;
}
sub next_demon_above_level {
my $class = shift;
my ($type, $level) = @_;
my @possible = $class->lookup(
type => $type,
level => sub { $_ >= $level },
);
return firstval { $_->fusion_possibility } @possible;
}
sub next_demon_below_level {
my $class = shift;
my ($type, $level) = @_;
my @possible = $class->lookup(
type => $type,
level => sub { $_ <= $level },
);
return lastval { $_->fusion_possibility } @possible;
}
sub level_up {
my $self = shift;
return $self->next_demon_above_level($self->type, $self->level + 1);
}
sub level_down {
my $self = shift;
return $self->next_demon_below_level($self->type, $self->level - 1);
}
__PACKAGE__->meta->make_immutable;
1;
__DATA__
---
- fusion_type: normal
level: '38'
name: Horus
type: Deity
- fusion_type: normal
level: '47'
name: Atavaka
type: Deity
- fusion_type: special
level: '56'
name: Amaterasu
type: Deity
- fusion_type: normal
level: '65'
name: Odin
type: Deity
- fusion_type: normal
level: '78'
name: Mithra
type: Deity
- fusion_type: normal
level: '93'
name: Vishnu
type: Deity
- fusion_type: normal
level: '18'
name: Uzume
type: Megami
- fusion_type: normal
level: '30'
name: Sarasvati
type: Megami
- fusion_type: normal
level: '48'
name: Sati
type: Megami
- fusion_type: normal
level: '54'
name: Laksmi
type: Megami
- fusion_type: normal
level: '64'
name: Scathach
type: Megami
- fusion_type: normal
level: '44'
name: Dionysus
type: Fury
- fusion_type: evolve
level: '54'
name: Wu Kong
type: Fury
- fusion_type: normal
level: '61'
name: Beji Weng
type: Fury
- fusion_type: special
level: '95'
name: Shiva
type: Fury
- fusion_type: normal
level: '24'
name: Kikuri-Hime
type: Lady
- fusion_type: normal
level: '41'
name: Kushinada
type: Lady
- fusion_type: evolve
level: '57'
name: Parvati
type: Lady
- fusion_type: normal
level: '67'
name: Kali
type: Lady
- fusion_type: evolve
level: '74'
name: Skadi
type: Lady
- fusion_type: normal
level: '17'
name: Minakata
type: Kishin
- fusion_type: normal
level: '27'
name: Zouchou
type: Kishin
- fusion_type: normal
level: '33'
name: Koumoko
type: Kishin
- fusion_type: normal
level: '39'
name: Okuninushi
type: Kishin
- fusion_type: normal
level: '45'
name: Mikazuchi
type: Kishin
- fusion_type: normal
level: '52'
name: Jiroku
type: Kishin
- fusion_type: normal
level: '63'
name: Futomimi
type: Kishin
- fusion_type: normal
level: '72'
name: Bishamon
type: Kishin
- fusion_type: normal
level: '76'
name: Thor
type: Kishin
- fusion_type: normal
level: '13'
name: Shiisaa
type: Holy
- fusion_type: normal
level: '21'
name: Unicorn
type: Holy
- fusion_type: evolve
level: '27'
name: Senri
type: Holy
- fusion_type: normal
level: '36'
name: Feng Huang
type: Holy
- fusion_type: normal
level: '43'
name: Baihu
type: Holy
- fusion_type: normal
level: '55'
name: Chimera
type: Holy
- fusion_type: normal
level: '7'
name: Erthys
type: Element
- fusion_type: normal
level: '11'
name: Aeros
type: Element
- fusion_type: normal
level: '15'
name: Aquans
type: Element
- fusion_type: normal
level: '20'
name: Flameis
type: Element
- fusion_type: normal
level: '25'
name: Ara Mitama
type: Mitama
- fusion_type: normal
level: '29'
name: Nigi Mitama
type: Mitama
- fusion_type: normal
level: '32'
name: Kusi Mitama
type: Mitama
- fusion_type: normal
level: '35'
name: Saki Mitama
type: Mitama
- fusion_type: normal
level: '8'
name: Apsaras
type: Yoma
- fusion_type: normal
level: '14'
name: Isora
type: Yoma
- fusion_type: normal
level: '19'
name: Koppa
type: Yoma
- fusion_type: normal
level: '23'
name: Dis
type: Yoma
- fusion_type: evolve
level: '28'
name: Karasu
type: Yoma
- fusion_type: normal
level: '37'
name: Onkot
type: Yoma
- fusion_type: normal
level: '44'
name: Jinn
type: Yoma
- fusion_type: normal
level: '48'
name: Purski
type: Yoma
- fusion_type: evolve
level: '52'
name: Efreet
type: Yoma
- fusion_type: normal
level: '2'
name: Pixie
type: Fairy
- fusion_type: normal
level: '7'
name: Jack Frost
type: Fairy
- fusion_type: evolve
level: '10'
name: High Pixie
type: Fairy
- fusion_type: normal
level: '19'
name: Pyro Jack
type: Fairy
- fusion_type: normal
level: '26'
name: Kelpie
type: Fairy
- fusion_type: normal
level: '38'
name: Troll
type: Fairy
- fusion_type: normal
level: '43'
name: Setanta
type: Fairy
- fusion_type: normal
level: '46'
name: Oberon
type: Fairy
- fusion_type: normal
level: '57'
name: Titania
type: Fairy
- fusion_type: normal
level: '11'
name: Angel
type: Divine
- fusion_type: normal
level: '18'
name: Archangel
type: Divine
- fusion_type: normal
level: '28'
name: Principality
type: Divine
- fusion_type: normal
level: '33'
name: Power
type: Divine
- fusion_type: normal
level: '41'
name: Virtue
type: Divine
- fusion_type: normal
level: '50'
name: Dominion
type: Divine
- fusion_type: normal
level: '64'
name: Throne
type: Divine
- fusion_type: normal
level: '20'
name: Forneus
type: Fallen
- fusion_type: normal
level: '29'
name: Eligor
type: Fallen
- fusion_type: normal
level: '37'
name: Berith
type: Fallen
- fusion_type: normal
level: '45'
name: Ose
type: Fallen
- fusion_type: normal
level: '58'
name: Decarabia
type: Fallen
- fusion_type: normal
level: '68'
name: Flauros
type: Fallen
- fusion_type: normal
level: '14'
name: Nozuchi
type: Snake
- fusion_type: normal
level: '28'
name: Naga
type: Snake
- fusion_type: normal
level: '34'
name: Mizuchi
type: Snake
- fusion_type: evolve
level: '37'
name: Raja Naga
type: Snake
- fusion_type: normal
level: '55'
name: Quetzalcoatl
type: Snake
- fusion_type: normal
level: '66'
name: Yurlungur
type: Snake
- fusion_type: normal
level: '13'
name: Inugami
type: Beast
- fusion_type: normal
level: '18'
name: Nekomata
type: Beast
- fusion_type: normal
level: '23'
name: Badb Catha
type: Beast
- fusion_type: normal
level: '34'
name: Orthrus
type: Beast
- fusion_type: normal
level: '54'
name: Sparna
type: Beast
- fusion_type: normal
level: '61'
name: Cerberus
type: Beast
- fusion_type: normal
level: '3'
name: Kodama
type: Jirae
- fusion_type: normal
level: '5'
name: Hua Po
type: Jirae
- fusion_type: normal
level: '13'
name: Sudama
type: Jirae
- fusion_type: normal
level: '35'
name: Sarutahiko
type: Jirae
- fusion_type: normal
level: '49'
name: Titan
type: Jirae
- fusion_type: normal
level: '55'
name: Gogmagog
type: Jirae
- fusion_type: normal
level: '4'
name: Shikigami
type: Brute
- fusion_type: normal
level: '20'
name: Momunofu
type: Brute
- fusion_type: normal
level: '25'
name: Oni
type: Brute
- fusion_type: normal
level: '44'
name: Ikusa
type: Brute
- fusion_type: normal
level: '54'
name: Shiki-Ouji
type: Brute
- fusion_type: normal
level: '59'
name: Kin-Ki
type: Brute
- fusion_type: normal
level: '62'
name: Sui-Ki
type: Brute
- fusion_type: normal
level: '66'
name: Fuu-Ki
type: Brute
- fusion_type: special
level: '81'
name: Ongyo-Ki
type: Brute
- fusion_type: normal
level: '7'
name: Datsue-Ba
type: Femme
- fusion_type: normal
level: '20'
name: Taraka
type: Femme
- fusion_type: normal
level: '32'
name: Shikome
type: Femme
- fusion_type: normal
level: '43'
name: Yaksini
type: Femme
- fusion_type: normal
level: '52'
name: Dakini
type: Femme
- fusion_type: normal
level: '58'
name: Clotho
type: Femme
- fusion_type: normal
level: '63'
name: Lachesis
type: Femme
- fusion_type: normal
level: '67'
name: Atropos
type: Femme
- fusion_type: normal
level: '72'
name: Rangda
type: Femme
- fusion_type: normal
level: '30'
name: Arahabaki
type: Vile
- fusion_type: normal
level: '33'
name: Baphomet
type: Vile
- fusion_type: normal
level: '35'
name: Pazuzu
type: Vile
- fusion_type: special
level: '58'
name: Girimehkala
type: Vile
- fusion_type: normal
level: '65'
name: Tao Tie
type: Vile
- fusion_type: special
level: '73'
name: Samael
type: Vile
- fusion_type: normal
level: '83'
name: Mada
type: Vile
- fusion_type: normal
level: '52'
name: Loki
type: Tyrant
- fusion_type: normal
level: '69'
name: Abaddon
type: Tyrant
- fusion_type: normal
level: '74'
name: Surt
type: Tyrant
- fusion_type: evolve
level: '77'
name: Aciel
type: Tyrant
- fusion_type: normal
level: '84'
name: Beelzebub
type: Tyrant
- fusion_type: normal
level: '91'
name: Mot
type: Tyrant
- fusion_type: evolve
level: '95'
name: Beelzebub (Fly)
type: Tyrant
- fusion_type: normal
level: '8'
name: Lilim
type: Night
- fusion_type: normal
level: '18'
name: Fomor
type: Night
- fusion_type: normal
level: '25'
name: Incubus
type: Night
- fusion_type: normal
level: '37'
name: Succubus
type: Night
- fusion_type: normal
level: '47'
name: Kaiwan
type: Night
- fusion_type: normal
level: '53'
name: Loa
type: Night
- fusion_type: evolve
level: '56'
name: Queen Mab
type: Night
- fusion_type: normal
level: '66'
name: Black Frost
type: Night
- fusion_type: normal
level: '70'
name: Nyx
type: Night
- fusion_type: evolve
level: '80'
name: Lilith
type: Night
- fusion_type: normal
level: '6'
name: Zhen
type: Wilder
- fusion_type: normal
level: '15'
name: Bicorn
type: Wilder
- fusion_type: normal
level: '25'
name: Raiju
type: Wilder
- fusion_type: normal
level: '31'
name: Nue
type: Wilder
- fusion_type: normal
level: '43'
name: Mothman
type: Wilder
- fusion_type: normal
level: '75'
name: Hresvelgr
type: Wilder
- fusion_type: normal
level: '4'
name: Preta
type: Haunt
- fusion_type: normal
level: '11'
name: Choronzon
type: Haunt
- fusion_type: normal
level: '17'
name: Yaka
type: Haunt
- fusion_type: normal
level: '20'
name: Chatterskull
type: Haunt
- fusion_type: normal
level: '28'
name: Pisaca
type: Haunt
- fusion_type: normal
level: '49'
name: Legion
type: Haunt
- fusion_type: normal
level: '63'
name: Rakshasa
type: Haunt
- fusion_type: normal
level: '1'
name: Will O' Wisp
type: Foul
- fusion_type: normal
level: '6'
name: Slime
type: Foul
- fusion_type: normal
level: '7'
name: Mou-Ryo
type: Foul
- fusion_type: normal
level: '16'
name: Blob
type: Foul
- fusion_type: normal
level: '28'
name: Black Ooze
type: Foul
- fusion_type: normal
level: '42'
name: Phantom
type: Foul
- fusion_type: special
level: '45'
name: Sakahagi
type: Foul
- fusion_type: normal
level: '52'
name: Shadow
type: Foul
- fusion_type: evolve
level: '73'
name: Uriel
type: Seraph
- fusion_type: special
level: '84'
name: Raphael
type: Seraph
- fusion_type: special
level: '87'
name: Gabriel
type: Seraph
- fusion_type: special
level: '90'
name: Michael
type: Seraph
- fusion_type: special
level: '95'
name: Metatron
type: Seraph
- fusion_type: evolve
level: '33'
name: Valkyrie
type: Wargod
- fusion_type: evolve
level: '58'
name: Ganesha
type: Wargod
- fusion_type: evolve
level: '38'
name: Kurama
type: Genma
- fusion_type: evolve
level: '46'
name: Hanuman
type: Genma
- fusion_type: evolve
level: '52'
name: Cu Chulainn
type: Genma
- fusion_type: evolve
level: '24'
name: Gui Xian
type: Dragon
- fusion_type: evolve
level: '44'
name: Long
type: Dragon
- fusion_type: evolve
level: '22'
name: Makami
type: Avatar
- fusion_type: normal
level: '26'
name: Cai-Zhi
type: Avatar
- fusion_type: normal
level: '46'
name: Yatagarasu
type: Avatar
- fusion_type: normal
level: '60'
name: Barong
type: Avatar
- fusion_type: evolve
level: '63'
name: Garuda
type: Avian
- fusion_type: special
level: '63'
name: Gurr
type: Raptor
- fusion_type: evolve
level: '64'
name: Albion
type: Entity
- fusion_type: deathstone
level: '30'
name: Matador
type: Fiend
- fusion_type: deathstone
level: '37'
name: Daisoujou
type: Fiend
- fusion_type: deathstone
level: '42'
name: Hell Biker
type: Fiend
- fusion_type: deathstone
level: '52'
name: White Rider
type: Fiend
- fusion_type: deathstone
level: '55'
name: Red Rider
type: Fiend
- fusion_type: deathstone
level: '61'
name: Black Rider
type: Fiend
- fusion_type: deathstone
level: '63'
name: Pale Rider
type: Fiend
- fusion_type: deathstone
level: '69'
name: The Harlot
type: Fiend
- fusion_type: deathstone
level: '77'
name: Trumpeter
type: Fiend
|