Skip to content

Commit

Permalink
Fix my horrid math when it comes to counting items.
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodeflayer committed Jul 27, 2020
1 parent 646788b commit f7773ba
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/inverted/InvertedStaticMapLW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class InvertedStaticMapLW {
return items.moonpearl && InvertedRegionHelper.northEastLW(items, dungeons);
}};
backOfEscape = {x:778, y:439, title:'Escape',
itemCount: 6, req:[['items/moonpearl1', 'items/glove1', InvertedRegionHelper.reqNorthEastLW]],
itemCount: 5, req:[['items/moonpearl1', 'items/glove1', InvertedRegionHelper.reqNorthEastLW]],
validate(items, dungeons) {
return InvertedRegionHelper.northEastLW(items, dungeons) && items.moonpearl && items.glove > 0;
}};
Expand Down
2 changes: 1 addition & 1 deletion app/standard/StandardStaticMapLW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class StandardStaticMapLW {
return true;
}};
backOfEscape = {x:778, y:439, title:'Escape',
itemCount: 6, req:[['items/glove1']],
itemCount: 5, req:[['items/glove1']],
validate(items, dungeons) {
return items.glove > 0;
}};
Expand Down
23 changes: 23 additions & 0 deletions app/tests/standard/StandardOverallTests.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {StandardStaticMapLW} from '~/standard/StandardStaticMapLW';
import {StandardStaticMapDW} from '~/standard/StandardStaticMapDW';

describe('Overall Tests for Standard', () => {
it('should count the items', () => {
const lws = new StandardStaticMapLW();
const dws = new StandardStaticMapDW();
const lwk = Object.keys(lws);
const dwk = Object.keys(dws);

let lwCount = 0;
let dwCount = 0;
for(const k of lwk){
lwCount = lwCount + lws[k].itemCount;
}
for(const k of dwk){
dwCount = dwCount + dws[k].itemCount;
}
console.log('lwCount', lwCount);
console.log('dwCount', dwCount);
console.log('total', lwCount + dwCount);
});
});
17 changes: 9 additions & 8 deletions app/utils/ModelManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ export class ModelManager {

getItemMax() {
if (this.settings.gameMode === this.sol.STANDARD || this.settings.gameMode === this.sol.INVERTED) {
return this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.standard.id ? 155
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mc.id ? (155 + 20)
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mcsk.id ? (155 + 20 + 28)
: (155 + 30 + 28);
return this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.standard.id ? 153
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mc.id ? (153 + 22)
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mcsk.id ? (153 + 22 + 28)
: (153 + 33 + 28);
} else if(this.settings.gameMode === this.sol.RETRO) {
return this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.standard.id ? (155 + 28)
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mc.id ? (155 + 20 + 28)
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mcsk.id ? (155 + 20 + 28)
: (155 + 30 + 28);
return this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.standard.id ? (153 + 28)
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mc.id ? (153 + 22 + 28)
: this.settings.itemShuffle === GameSaveHelper.itemShuffleOptions.mcsk.id ? (153 + 22 + 28)
: (153 + 33 + 28);
}
}

Expand Down Expand Up @@ -432,6 +432,7 @@ export class ModelManager {
}

saveCurrentGame() {
console.log('saving game');
const game = this.settings.gameSlot;
this.gameSaves[game].items = this.items.getCopy();
this.gameSaves[game].dungeons = this.dungeons.getCopy();
Expand Down

0 comments on commit f7773ba

Please sign in to comment.