New stats and bug fixes.

This commit is contained in:
2020-08-29 09:01:18 -07:00
parent 191a6081b7
commit 1b9e94ba1f
7 changed files with 45 additions and 14 deletions

View File

@@ -1506,10 +1506,10 @@ class Harvest extends React.Component {
view = (
<div>
<div className='game-card'>
<div className={'flex ' + (currentExpense <= 0 ? 'red' : 'green')}>
<div className={'flex ' + (currentExpense < 0 ? 'red' : 'green')}>
<FontAwesomeIcon icon={faDollarSign} size='6x' />
<div>
{currentExpense ? (
{typeof currentExpense === 'number' ? (
<p>
{isCurrentPlayer ? 'You' : this.props.game.currentPlayer}
{currentExpense <= 0 ? ' lost ' : ' gained '}
@@ -2037,6 +2037,7 @@ const GameOver = ({ id, alertHandled, contents, game, player}) => {
<p>Total: ${formatMoney(p.harvestTotal)} Expenses: ${formatMoney(Math.abs(p.operatingExpenses))}</p>
<p>Avg ${formatMoney(p.harvestAverage)} rolling {p.harvestRoll} for {p.numHarvests} harvests</p>
<p>Hay: ${formatMoney(p.hay)} Grain: ${formatMoney(p.grain)} Fruit: ${formatMoney(p.fruit)} Cows: ${formatMoney(p.cows)}</p>
<p>Tractor: ${formatMoney(p.tractor)} Harvester: ${formatMoney(p.harvester)}</p>
</div>))}
</div>
<div className={tabClass(gameOverTabs.investments)}>
@@ -2049,7 +2050,11 @@ const GameOver = ({ id, alertHandled, contents, game, player}) => {
<p>Hay: {(p.hay / ((pObj.assets.hay * 2000) || 0.001)).toFixed(2)} {' '}
Grain: {(p.grain / ((pObj.assets.grain * 2000) || 0.001)).toFixed(2)} {' '}
Fruit: {(p.fruit / ((pObj.assets.fruit * 5000) || 0.001)).toFixed(2)} {' '}
Cows: {(p.cows / (((pObj.assets.cows * 500) + (playerRidgeValue(pObj, game.otherPlayers))) || 0.001)).toFixed(2)}
Cows: {(p.cows / ((((pObj.assets.cows + p.cowsLost) * 500) + (playerRidgeValue(pObj, game.otherPlayers))) || 0.001)).toFixed(2)}
</p>
<p>
Tractor: {Math.max(0, (p.tractor / ((pObj.assets.tractor * 10000) || 0.001))).toFixed(2)} {' '}
Harvester: {Math.max(0, (p.harvester / ((pObj.assets.harvester * 10000) || 0.001))).toFixed(2)}
</p>
</div>
);

View File

@@ -185,7 +185,14 @@
(hay . 0)
(grain . 0)
(fruit . 0)
(cows . 0)))
(cows . 0)
(tractor . 0)
(harvester . 0)
(hay-expenses . 0)
(grain-expenses . 0)
(fruit-expenses . 0)
(cows-expenses . 0)
(cows-lost . 0)))
(alist-ref 'ai? args eqv? #f)
(alist-ref 'processing-turn args eqv? #f))))
@@ -568,7 +575,7 @@
;; (session-set! (sid) 'game *game*)
;; (set-startup-otbs (session-ref (sid) 'player) 2)
)
(send-static-file "index.html")
(send-static-file "main.html")
;; (with-headers `((connection close)
;; (content-type text/html))
;; (lambda ()
@@ -577,7 +584,7 @@
)
(define (start-game)
(send-static-file "index.html")
(send-static-file "main.html")
""
;; (with-output-to-string
;; (lambda ()
@@ -1038,6 +1045,9 @@
(grain . ,(alist-ref 'grain stats))
(fruit . ,(alist-ref 'fruit stats))
(cows . ,(alist-ref 'cows stats))
(cowsLost . ,(alist-ref 'cows-lost stats eqv? 0))
(tractor . ,(alist-ref 'tractor stats))
(harvester . ,(alist-ref 'harvester stats))
(harvestAverage . ,(exact->inexact
(round
(/ (fold + 0 (map (lambda (c) (alist-ref c stats))
@@ -2049,9 +2059,11 @@
(inexact->exact
(round (/ (exact->inexact amount) num-equipment))))))
(for-each (lambda (player)
((make-player-stat equipment amount-per-player) player)
(safe-set! (player-cash player)
(+ (player-cash player) amount-per-player)))
(players-with equipment game)))))
((make-player-stat equipment (- amount)) player)
(safe-set! (player-cash player) (- (player-cash player) amount))))
(define (make-player-gains amount)
@@ -2232,6 +2244,8 @@
(for-each (lambda (from-player)
(when (not (eq? player from-player))
(when (not (player-has-asset? 'harvester from-player))
((make-player-stat equipment -2000) from-player)
((make-player-stat equipment 2000) player)
(safe-set! (player-cash from-player)
(- (player-cash from-player) 2000))
(safe-set! (player-cash player)
@@ -2290,6 +2304,7 @@
(safe-set! (player-assets player)
(alist-update 'cows (- (alist-ref 'cows (player-assets player)) (- cows ridge-cows))
(player-assets player)))
((make-player-stat 'cows-lost slaughtered-cows) player)
`(((?action . info)
(?value . ,(conc slaughtered-cows
" cows slaughtered on your farm.")))))

View File

@@ -305,7 +305,7 @@ $tab-margin: 0.3rem;
.player-black {
background-color: black; }
.player-none {
background-color: #f2f2f2; }
background-color: #f2f2f2; } //
.tab .player {
height: 27px;