Skip to content

Commit

Permalink
Merge branch 'master' into #138-ui-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
eloisepeng authored Apr 13, 2020
2 parents d1de916 + 42cd395 commit ae8bab6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const emptyMinigame: IMinigame = {
};

export default class App extends React.Component<IProps, IState> {
static readonly maxWeeks: number = 5;
static readonly maxWeeks: number = 9;
private choiceManager: ChoicesManager;
private eventManager: EventsManager;
private minigameManager: MinigamesManager;
Expand Down
13 changes: 7 additions & 6 deletions src/game-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
"pool": [
"CuteGirlEvent",
"SquirrelEvent",
"MidtermEvent"
"MidtermEvent",
"BlockPartyEvent",
"CoronaEvent"
],
"followUp": [
"LandingEvent", "PickFacultyEvent"
"LandingEvent", "PickFacultyEvent", "ImagineDayEvent"
],
"seasonal": [
["ImagineDayEvent"],
[],
["DayOfTheLongBoatEvent", "BoomerGregorEvent", "FratPartyEvent"],
["StormTheWallEvent", "CryMidtermPaperEvent"],
["BlockPartyEvent", "CoronaEvent"]
["StormTheWallEvent", "CryMidtermPaperEvent"]
]
}
}
}
10 changes: 4 additions & 6 deletions src/trackers/EventTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ export default class EventTracker {
if (this.queue.length > 0)
return this.queue.shift() as IEvent;

// const r = Math.random() * 100;
// 0 to 11
const month = (Math.floor(week / 4)) % 4;
if (this.pool.length > 0 &&
(this.seasonal[month].length === 0)) {
const r = Math.random() * 100;
const month = (Math.floor(week / 4)) % 3; // 0 to 11
if (this.pool.length > 0 && (r > this.SEASONAL_CHANCE || this.seasonal[month].length === 0)) {
// If we roll a normal pool or if there are no seasonal events then
// use the normal pool (given that there are still things in the
// normal pool)
let event = this.pool[Math.floor(Math.random() * this.pool.length)];
const index = this.pool.indexOf(event);
this.pool.splice(index, 1);
return event;
} else if (this.seasonal[month].length > 0) {
} else if (r <= this.SEASONAL_CHANCE || this.seasonal[month].length > 0) {
// Else we use the seasonal events pool
let event = this.seasonal[month][Math.floor(Math.random() * this.seasonal[month].length)];
const index = this.seasonal[month].indexOf(event);
Expand Down

0 comments on commit ae8bab6

Please sign in to comment.