Birthdays!

leave-game
Thomas Hintz 5 years ago
parent a8006b27df
commit 197e4ffc5d

@ -44,7 +44,7 @@ export const spaceContent =
'License expired. Head back to the second week in January.', 'License expired. Head back to the second week in January.',
'Frugivore swarm forces you to cover fruit. PAY $2000 if you own fruit.', 'Frugivore swarm forces you to cover fruit. PAY $2000 if you own fruit.',
`Finished plowing. Time for Apple pie. Draw ${itemCardShort}`, `Finished plowing. Time for Apple pie. Draw ${itemCardShort}`,
'Corn in without major solar flare. Yield is doubled this year.', 'Birthday bonus! And corn in without major solar flare. Yield is doubled this year.',
'Winds continue. Work halts. PAY $500.', 'Winds continue. Work halts. PAY $500.',
'AI malfunction. PAY $1000.', 'AI malfunction. PAY $1000.',
'Dust storms head south. COLLECT $500.', 'Dust storms head south. COLLECT $500.',

@ -22,6 +22,7 @@ import CowImg from './../../../assets/img/cow.svg'
import HayImg from './../../../assets/img/hay.svg' import HayImg from './../../../assets/img/hay.svg'
import WheatImg from './../../../assets/img/wheat.svg' import WheatImg from './../../../assets/img/wheat.svg'
import TractorImg from './../../../assets/img/tractor-icon.svg' import TractorImg from './../../../assets/img/tractor-icon.svg'
import CakeImg from './../../../assets/img/cake.svg'
import TractorFullImg from './../../../assets/img/tractor-with-spikes.svg' import TractorFullImg from './../../../assets/img/tractor-with-spikes.svg'
import HarvesterImg from './../../../assets/img/harvester.svg' import HarvesterImg from './../../../assets/img/harvester.svg'
import VolcanoImg from './../../../assets/img/volcano2.gif' import VolcanoImg from './../../../assets/img/volcano2.gif'
@ -50,17 +51,17 @@ import { buy, roll, endTurn, loan, trade, submitTradeAccept,
function netWorth(player) { function netWorth(player) {
return ((player.assets.hay + player.assets.grain) * 2000) + return ((player.assets.hay + player.assets.grain) * 2000) +
(player.assets.fruit * 5000) + (player.assets.fruit * 5000) +
(player.assets.cows * 500) + (player.assets.cows * 500) +
((player.assets.harvester + player.assets.tractor) * 10000) + ((player.assets.harvester + player.assets.tractor) * 10000) +
player.displayCash - player.debt; player.displayCash - player.debt;
} }
function assetsValue(player) { function assetsValue(player) {
return ((player.assets.hay + player.assets.grain) * 2000) + return ((player.assets.hay + player.assets.grain) * 2000) +
(player.assets.fruit * 5000) + (player.assets.fruit * 5000) +
(player.assets.cows * 500) + (player.assets.cows * 500) +
((player.assets.harvester + player.assets.tractor) * 10000); ((player.assets.harvester + player.assets.tractor) * 10000);
} }
function getElementValue(id) { function getElementValue(id) {
@ -282,6 +283,10 @@ class PlayerResources extends React.Component {
<ResourceUnit img={TractorImg} h='240' s='100' label='Tractors' <ResourceUnit img={TractorImg} h='240' s='100' label='Tractors'
amount={player.assets.tractor}> amount={player.assets.tractor}>
{player.assets.tractor} {player.assets.tractor}
</ResourceUnit> {' '}
<ResourceUnit img={CakeImg} h='240' s='100' label='Birthday'
amount={player.assets.birthday ? player.assets.birthday : 0}>
{player.assets.birthday ? player.assets.birthday : 0}
</ResourceUnit> </ResourceUnit>
</div> </div>
); );
@ -885,7 +890,7 @@ class Misc extends React.Component {
<img src={VolcanoImg} /> Copyright <a href="https://thenounproject.com/Maludk/">Laymik</a> with modifications by Thomas Hintz - <CCBY /> <img src={VolcanoImg} /> Copyright <a href="https://thenounproject.com/Maludk/">Laymik</a> with modifications by Thomas Hintz - <CCBY />
</li> </li>
<li> <li>
<img src={CornImg} /> <img src={FruitImg} /> Copyright <a href='https://madexmade.com/'>Made</a> - <CCBY /> <img src={CornImg} /> <img src={FruitImg} /> <img src={CakeImg} /> Copyright <a href='https://madexmade.com/'>Made</a> - <CCBY />
</li> </li>
<li> <li>
<img src={CowImg} /> Copyright <a href='https://thenounproject.com/rivercon/'>rivercon</a> - <CCBY /> <img src={CowImg} /> Copyright <a href='https://thenounproject.com/rivercon/'>rivercon</a> - <CCBY />

@ -88,7 +88,7 @@ const initialState = {
debt: 5000, debt: 5000,
spaces, spaces,
state: GAME_STATES.turnEnded, state: GAME_STATES.turnEnded,
assets: { hay: 10, grain: 10, fruit: 0, cows: 0, harvester: 0, tractor: 0 }, assets: { hay: 10, grain: 10, fruit: 0, cows: 0, harvester: 0, tractor: 0, birthday: 0 },
color: '', color: '',
name: '', name: '',
ridges: { ridge1: 0, ridge2: 0, ridge3: 0, ridge4: 0 }, ridges: { ridge1: 0, ridge2: 0, ridge3: 0, ridge4: 0 },

@ -106,7 +106,8 @@
(finished initform: #f accessor: player-finished) (finished initform: #f accessor: player-finished)
(assets initform: (assets initform:
'((hay . 10) (grain . 10) (fruit . 0) (cows . 0) '((hay . 10) (grain . 10) (fruit . 0) (cows . 0)
(harvester . 0) (tractor . 0)) (harvester . 0) (tractor . 0)
(birthday . 0))
accessor: player-assets) accessor: player-assets)
(ridges initform: (ridges initform:
'((ridge1 . 0) (ridge2 . 0) (ridge3 . 0) (ridge4 . 0)) '((ridge1 . 0) (ridge2 . 0) (ridge3 . 0) (ridge4 . 0))
@ -1939,7 +1940,7 @@
(define (gains amount) (lambda (n) (+ n amount))) (define (gains amount) (lambda (n) (+ n amount)))
(define (player-crop-rule player crop) (define (player-crop-rule player crop)
(if (> (alist-ref crop (player-assets player)) 0) `(((tom ,crop))) '())) (if (> (alist-ref crop (player-assets player) eqv? 0) 0) `(((tom ,crop))) '()))
(define (aug4-action player) (define (aug4-action player)
(when (not (already-harvested? 'wheat player)) (when (not (already-harvested? 'wheat player))
@ -1969,6 +1970,7 @@
((apr2 add-rule ?p ,(make-player-year-rule ((apr2 add-rule ?p ,(make-player-year-rule
10 '((?p corn harvest-mult 2) (?p grain))))) 10 '((?p corn harvest-mult 2) (?p grain)))))
((apr2 player-action ?p ,(lambda (p) (safe-set! (player-corn-doubled p) #t)))) ((apr2 player-action ?p ,(lambda (p) (safe-set! (player-corn-doubled p) #t))))
((apr2 money ?p ,(gains 5000)) (?p birthday))
((apr3 money ?p ,(pays 500))) ((apr3 money ?p ,(pays 500)))
((apr4 money ?p ,(pays 1000))) ((apr4 money ?p ,(pays 1000)))
((may1 money ?p ,(gains 500))) ((may1 money ?p ,(gains 500)))
@ -2045,7 +2047,8 @@
,@(player-crop-rule player 'hay) ,@(player-crop-rule player 'hay)
,@(player-crop-rule player 'grain) ,@(player-crop-rule player 'grain)
,@(player-crop-rule player 'tractor) ,@(player-crop-rule player 'tractor)
,@(player-crop-rule player 'harvester)) ,@(player-crop-rule player 'harvester)
,@(player-crop-rule player 'birthday))
`((,(list-ref *months* space) ?action tom ?value))))) `((,(list-ref *months* space) ?action tom ?value)))))
(if a (if a
(begin (set! res (cons a res)) (loop (amb+))) (begin (set! res (cons a res)) (loop (amb+)))
@ -2238,6 +2241,15 @@
(define (gp i) (define (gp i)
(list-ref (game-players (first-game)) i)) (list-ref (game-players (first-game)) i))
(define (gn name)
(find (lambda (p) (equal? (player-name p) name))
(game-players (first-game))))
(define (gnb name)
(let ((player (gn name)))
(safe-set! (player-assets player)
(alist-update 'birthday 1 (player-assets player)))))
(cond-expand (cond-expand
(geiser (geiser
'()) '())

Loading…
Cancel
Save