-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module.exports = function( config ) { | ||
config.set( { | ||
browsers: [ 'jsdom' ], | ||
frameworks: [ 'mocha' ], | ||
|
||
plugins: [ | ||
'karma-chrome-launcher', | ||
'karma-jsdom-launcher', | ||
'karma-mocha', | ||
'karma-mocha-reporter', | ||
'karma-sourcemap-loader', | ||
'karma-webpack', | ||
], | ||
|
||
files: [ | ||
// since it's not a module, we include it directly | ||
'app/lib/string/String.js', | ||
'app/js/actions.js', | ||
'app/js/ffxivcraftmodel.js', | ||
'test/**/*Test.js', | ||
], | ||
|
||
preprocessors: { | ||
'app/**/*.js': [ 'sourcemap' ], | ||
'test/**/*.js': [ 'webpack', 'sourcemap' ], | ||
}, | ||
|
||
reporters: [ | ||
'mocha', | ||
], | ||
|
||
mochaReporter: { | ||
output: 'autowatch', | ||
}, | ||
|
||
webpack: { | ||
mode: 'development', | ||
}, | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import assert from "assert"; | ||
import ArmorerRecipes from "../app/data/recipedb/Armorer"; | ||
import simFinalState from "./simFinalState"; | ||
|
||
const CRAFTER = new Crafter('Armorer', 80, 2535, 2163, 486, false, AllActions); | ||
|
||
const RECIPE = { | ||
startQuality: 0, | ||
...ArmorerRecipes.find( ({id}) => id === 'af91eefbcf4' ), | ||
}; | ||
RECIPE.suggestedCraftsmanship = RECIPE.suggestedCraftsmanship || SuggestedCraftsmanship[RECIPE.level]; | ||
RECIPE.suggestedControl = RECIPE.suggestedControl || SuggestedControl[RECIPE.level]; | ||
|
||
describe("Oddly Specific Chainmail Sheet", () => { | ||
it("First Reflect: Quality increases by 482", () => { | ||
var finalState = simFinalState( CRAFTER, RECIPE, [ | ||
AllActions.reflect | ||
] ); | ||
assert.equal(482, finalState.qualityState); | ||
}); | ||
it("Reflect, Groundwork increases progress by 1323", () => { | ||
var finalState = simFinalState( CRAFTER, RECIPE, [ | ||
AllActions.reflect, | ||
AllActions.groundwork | ||
] ); | ||
assert.equal(1323, finalState.progressState); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import assert from "assert"; | ||
import simFinalState from "./simFinalState"; | ||
|
||
const INIT_CP = 180; | ||
|
||
describe("FFXIV Crafting Model", () => { | ||
|
||
it("Can craft Zelkova Fishing Rod with 3 basic synth", () => { | ||
var crafter = new Crafter('Carpenter', 80, 2000, 0, INIT_CP, false, AllActions); | ||
// Zelkova Fishing Rod | ||
var recipe = new Recipe(70, 290, 2214, 80, 0, 11736, 1076, undefined); | ||
var sequence = [ AllActions.basicSynth2, AllActions.basicSynth2, AllActions.basicSynth2 ]; | ||
var finalState = simFinalState( crafter, recipe, sequence ); | ||
|
||
assert.equal(finalState.cpState, INIT_CP); | ||
assert.equal(finalState.lastStep, 3); | ||
assert.equal(finalState.progressState, 2466); | ||
assert.equal(finalState.step, 3); | ||
}); | ||
|
||
it("Will not craft Zelkova Fishing Rod with only 2 basic synth", () => { | ||
var crafter = new Crafter('Carpenter', 80, 2000, 0, INIT_CP, false, AllActions); | ||
// Zelkova Fishing Rod | ||
var recipe = new Recipe(70, 290, 2214, 80, 0, 11736, 1076, undefined); | ||
var sequence = [ AllActions.basicSynth2, AllActions.basicSynth2 ]; | ||
var finalState = simFinalState( crafter, recipe, sequence ); | ||
|
||
assert.equal(finalState.cpState, INIT_CP); | ||
assert.equal(finalState.lastStep, 2); | ||
assert.equal(finalState.progressState, 1644); | ||
assert.equal(finalState.step, 2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default function simFinalState( crafter, recipe, sequence ) { | ||
var synth = new Synth(crafter, recipe, 0, 1.0, false, 0); | ||
var startState = NewStateFromSynth(synth); | ||
|
||
var synth = new Synth(crafter, recipe, 0, 1.0, true, 0); | ||
var synthNoConditions = new Synth(crafter, recipe, 0, 1.0, false, 0); | ||
|
||
var init = { | ||
seed: Math.seed, | ||
synth: synth, | ||
startState: NewStateFromSynth(synth), | ||
startStateNoConditions: NewStateFromSynth(synthNoConditions), | ||
sequence: sequence | ||
}; | ||
return simSynth(sequence, startState, false, true, true, undefined); | ||
} |