Skip to content

Commit

Permalink
Fix: Judgement + [Justice/Strength/Chariot/Death] -> impossible
Browse files Browse the repository at this point in the history
  • Loading branch information
chinhodado committed May 2, 2017
1 parent 63c49d5 commit 8c0f666
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
4 changes: 0 additions & 4 deletions data/Data5.js
Expand Up @@ -162,7 +162,6 @@ var arcana2Combos = [
{ 'source': ['Chariot', 'Star'], 'result': 'Moon' },
{ 'source': ['Chariot', 'Moon'], 'result': 'Lovers' },
{ 'source': ['Chariot', 'Sun'], 'result': 'Priestess' },
{ 'source': ['Chariot', 'Judgement'], 'result': 'Hierophant' },
{ 'source': ['Justice', 'Justice'], 'result': 'Justice' },
{ 'source': ['Justice', 'Hermit'], 'result': 'Magician' },
{ 'source': ['Justice', 'Fortune'], 'result': 'Emperor' },
Expand All @@ -175,7 +174,6 @@ var arcana2Combos = [
{ 'source': ['Justice', 'Star'], 'result': 'Empress' },
{ 'source': ['Justice', 'Moon'], 'result': 'Devil' },
{ 'source': ['Justice', 'Sun'], 'result': 'Hanged Man' },
{ 'source': ['Justice', 'Judgement'], 'result': 'Tower' },
{ 'source': ['Hermit', 'Hermit'], 'result': 'Hermit' },
{ 'source': ['Hermit', 'Fortune'], 'result': 'Star' },
{ 'source': ['Hermit', 'Strength'], 'result': 'Hierophant' },
Expand Down Expand Up @@ -208,7 +206,6 @@ var arcana2Combos = [
{ 'source': ['Strength', 'Star'], 'result': 'Moon' },
{ 'source': ['Strength', 'Moon'], 'result': 'Magician' },
{ 'source': ['Strength', 'Sun'], 'result': 'Moon' },
{ 'source': ['Strength', 'Judgement'], 'result': 'Fortune' },
{ 'source': ['Hanged Man', 'Hanged Man'], 'result': 'Hanged Man' },
{ 'source': ['Hanged Man', 'Death'], 'result': 'Moon' },
{ 'source': ['Hanged Man', 'Temperance'], 'result': 'Death' },
Expand All @@ -225,7 +222,6 @@ var arcana2Combos = [
{ 'source': ['Death', 'Star'], 'result': 'Devil' },
{ 'source': ['Death', 'Moon'], 'result': 'Hierophant' },
{ 'source': ['Death', 'Sun'], 'result': 'Priestess' },
{ 'source': ['Death', 'Judgement'], 'result': 'Magician' },
{ 'source': ['Temperance', 'Temperance'], 'result': 'Temperance' },
{ 'source': ['Temperance', 'Devil'], 'result': 'Fool' },
{ 'source': ['Temperance', 'Tower'], 'result': 'Fortune' },
Expand Down
4 changes: 0 additions & 4 deletions data/Data5.ts
Expand Up @@ -164,7 +164,6 @@ const arcana2Combos = [
{'source': ['Chariot', 'Star' ], 'result': 'Moon' },
{'source': ['Chariot', 'Moon' ], 'result': 'Lovers' },
{'source': ['Chariot', 'Sun' ], 'result': 'Priestess' },
{'source': ['Chariot', 'Judgement' ], 'result': 'Hierophant' },
{'source': ['Justice', 'Justice' ], 'result': 'Justice' },
{'source': ['Justice', 'Hermit' ], 'result': 'Magician' },
{'source': ['Justice', 'Fortune' ], 'result': 'Emperor' },
Expand All @@ -177,7 +176,6 @@ const arcana2Combos = [
{'source': ['Justice', 'Star' ], 'result': 'Empress' },
{'source': ['Justice', 'Moon' ], 'result': 'Devil' },
{'source': ['Justice', 'Sun' ], 'result': 'Hanged Man' },
{'source': ['Justice', 'Judgement' ], 'result': 'Tower' },
{'source': ['Hermit', 'Hermit' ], 'result': 'Hermit' },
{'source': ['Hermit', 'Fortune' ], 'result': 'Star' },
{'source': ['Hermit', 'Strength' ], 'result': 'Hierophant' },
Expand Down Expand Up @@ -210,7 +208,6 @@ const arcana2Combos = [
{'source': ['Strength', 'Star' ], 'result': 'Moon' },
{'source': ['Strength', 'Moon' ], 'result': 'Magician' },
{'source': ['Strength', 'Sun' ], 'result': 'Moon' },
{'source': ['Strength', 'Judgement' ], 'result': 'Fortune' },
{'source': ['Hanged Man', 'Hanged Man' ], 'result': 'Hanged Man' },
{'source': ['Hanged Man', 'Death' ], 'result': 'Moon' },
{'source': ['Hanged Man', 'Temperance' ], 'result': 'Death' },
Expand All @@ -227,7 +224,6 @@ const arcana2Combos = [
{'source': ['Death', 'Star' ], 'result': 'Devil' },
{'source': ['Death', 'Moon' ], 'result': 'Hierophant' },
{'source': ['Death', 'Sun' ], 'result': 'Priestess' },
{'source': ['Death', 'Judgement' ], 'result': 'Magician' },
{'source': ['Temperance', 'Temperance' ], 'result': 'Temperance' },
{'source': ['Temperance', 'Devil' ], 'result': 'Fool' },
{'source': ['Temperance', 'Tower' ], 'result': 'Fortune' },
Expand Down
4 changes: 4 additions & 0 deletions src/FusionCalculator.js
Expand Up @@ -86,6 +86,10 @@ var FusionCalculator = (function () {
}
var level = 1 + Math.floor((persona1.level + persona2.level) / 2);
var arcana = getResultArcana(persona1.arcana, persona2.arcana);
if (!arcana) {
// only Judgement + [Justice/Strength/Chariot/Death] can result in this
return null;
}
var personae = this.personaeByArcana[arcana];
var persona = null;
var found = false;
Expand Down
5 changes: 5 additions & 0 deletions src/FusionCalculator.ts
Expand Up @@ -100,6 +100,11 @@ class FusionCalculator {

let level = 1 + Math.floor((persona1.level + persona2.level) / 2);
let arcana = getResultArcana(persona1.arcana, persona2.arcana);
if (!arcana) {
// only Judgement + [Justice/Strength/Chariot/Death] can result in this
return null;
}

let personae = this.personaeByArcana[arcana];

let persona: PersonaData = null;
Expand Down
18 changes: 17 additions & 1 deletion test/FusionTest.js
Expand Up @@ -74,7 +74,7 @@ describe('FusionCalculator', function () {
expect(fuseTestWrapper("Crystal Skull", "Regent")).to.equal(personaMap["Mithra"]);
});
});
describe('special fusion)', function () {
describe('special fusion', function () {
it('should return Alice when fusing Nebiros and Belial', function () {
expect(fuseTestWrapper("Nebiros", "Belial")).to.equal(personaMap["Alice"]);
});
Expand All @@ -99,6 +99,22 @@ describe('FusionCalculator', function () {
expect(fuseTestWrapper("Orlov", "Neko Shogun")).to.equal(personaMap["Kaiwan"]);
});
});
describe('impossible fusions with Judgement', function () {
it('should return null when fusing Judgement + Death', function () {
expect(fuseTestWrapper("Messiah", "Mandrake")).to.equal(null);
expect(fuseTestWrapper("Trumpeter", "Hell Biker")).to.equal(null);
});
it('should return null when fusing Judgement + Chariot', function () {
expect(fuseTestWrapper("Messiah", "Agathion")).to.equal(null);
});
it('should return null when fusing Judgement + Strength', function () {
expect(fuseTestWrapper("Messiah Picaro", "Kelpie")).to.equal(null);
});
it('should return null when fusing Judgement + Justice', function () {
expect(fuseTestWrapper("Messiah Picaro", "Angel")).to.equal(null);
expect(fuseTestWrapper("Power", "Anubis")).to.equal(null);
});
});
});
describe('#getRecipes()', function () {
describe('special fusions', function () {
Expand Down
22 changes: 21 additions & 1 deletion test/FusionTest.ts
Expand Up @@ -94,7 +94,7 @@ describe('FusionCalculator', () => {
});
});

describe('special fusion)', function () {
describe('special fusion', function () {
it('should return Alice when fusing Nebiros and Belial', () => {
expect(fuseTestWrapper("Nebiros", "Belial")).to.equal(personaMap["Alice"]);
});
Expand Down Expand Up @@ -125,6 +125,26 @@ describe('FusionCalculator', () => {
expect(fuseTestWrapper("Orlov", "Neko Shogun")).to.equal(personaMap["Kaiwan"]);
});
});

describe('impossible fusions with Judgement', function () {
it('should return null when fusing Judgement + Death', () => {
expect(fuseTestWrapper("Messiah", "Mandrake")).to.equal(null);
expect(fuseTestWrapper("Trumpeter", "Hell Biker")).to.equal(null);
});

it('should return null when fusing Judgement + Chariot', () => {
expect(fuseTestWrapper("Messiah", "Agathion")).to.equal(null);
});

it('should return null when fusing Judgement + Strength', () => {
expect(fuseTestWrapper("Messiah Picaro", "Kelpie")).to.equal(null);
});

it('should return null when fusing Judgement + Justice', () => {
expect(fuseTestWrapper("Messiah Picaro", "Angel")).to.equal(null);
expect(fuseTestWrapper("Power", "Anubis")).to.equal(null);
});
});
});

describe('#getRecipes()', () => {
Expand Down

0 comments on commit 8c0f666

Please sign in to comment.