Skip to content

Commit

Permalink
Can obtain stone from mountains
Browse files Browse the repository at this point in the history
  • Loading branch information
jcreedcmu committed Feb 17, 2024
1 parent d146ee0 commit 11ed663
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Binary file modified public/assets/toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/core/bonus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { mkActiveWordBonus } from './word-bonus';

export type ScoringBonus =
| { t: 'tree' }
| { t: 'mountain' }
| { t: 'bomb' }
| { t: 'required', letter: string }
| { t: 'consonant' }
Expand Down Expand Up @@ -69,6 +70,9 @@ export function bonusGenerator(p: Point, seed: number): Bonus {
else if (ph < 0.4) {
return { t: 'dynamite' };
}
else if (ph < 0.5) {
return { t: 'mountain' };
}
else
return { t: 'tree' };
}
Expand Down Expand Up @@ -131,6 +135,7 @@ export function adjacentScoringOfBonus(bonus: Bonus, p_in_world_int: Point): Sco
case 'required': return [];
case 'empty': return [];
case 'water': return [];
case 'mountain': return [{ bonus, p_in_world_int, destroy: true }];
}
}

Expand Down Expand Up @@ -159,6 +164,7 @@ export function resolveScoring(state: CoreState, scoring: Scoring): CoreState {
case 'wordAchieved': return produce(state, s => { incrementScore(s, bonus.word.length * 10 + 10); });
case 'time': return produce(state, s => { s.slowState.inventory.times++; });
case 'dynamite': return produce(state, s => { s.slowState.inventory.dynamites++; });
case 'mountain': return produce(state, s => { s.slowState.resource.stone++ });
}
}

Expand Down
1 change: 1 addition & 0 deletions src/core/landing-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function landMobileOnCell(m: MoveSource, c: CellContents): LandingResult
case 'time': return { t: 'collision' };
case 'dynamite': return { t: 'collision' };
case 'water': return (m.t == 'resource' && m.res == 'wood') ? { t: 'fillWater' } : { t: 'collision' };
case 'mountain': return { t: 'collision' };
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/ui/sprite-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function spriteLocOfBonus(bonus: Bonus): Point {
case 'word': return { x: 0, y: 8 };
case 'time': return spriteLocOfTool('time');
case 'dynamite': return { x: 0, y: 2 };
case 'mountain': return { x: 1, y: 10 };
}
}

Expand All @@ -84,8 +85,8 @@ export function spriteLocOfRes(res: Resource): Point {
}
}

export function largeSpriteLoc(tool: Tool | ResbarResource): Point {
switch (tool) {
export function largeSpriteLoc(sprite: Tool | ResbarResource): Point {
switch (sprite) {
case 'pointer': return { y: 0, x: 0 };
case 'hand': return { y: 0, x: 1 };
case 'dynamite': return { y: 0, x: 2 };
Expand Down

0 comments on commit 11ed663

Please sign in to comment.