New stats and bug fixes.

master
Thomas Hintz 4 years ago
parent 191a6081b7
commit 1b9e94ba1f

@ -41,6 +41,9 @@ install:
interactive:
csi -include-path $(assets) -include-path src/server -s src/server/farm.scm
interactiveserver:
cd dist ; csi -include-path $(assets) -include-path ../src/server -s farm.scm
src/server/farm: src/server/farm.scm src/server/db.scm
cd src/server/ && csc -include-path ../../$(assets) -O3 farm.scm

@ -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>
);

@ -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.")))))

@ -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;

@ -48,11 +48,6 @@ module.exports = {
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Alpha Centauri Farming',
filename: 'index.html',
meta: {viewport: 'width=device-width, initial-scale=1'},
}),
new FaviconsWebpackPlugin('./assets/img/tractor.svg'),
new MiniCssExtractPlugin({
filename: './assets/[name].[hash].css',

@ -19,7 +19,7 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
module.exports = function(env) {
@ -43,7 +43,12 @@ module.exports = function(env) {
'node_modules']
},
plugins: [
new ReactRefreshWebpackPlugin()
new ReactRefreshWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Alpha Centauri Farming',
filename: 'index.html',
meta: {viewport: 'width=device-width, initial-scale=1'},
}),
],
module: {
rules: [

@ -22,6 +22,7 @@ const path = require('path');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = function(env) {
return merge(common, {
@ -32,6 +33,13 @@ module.exports = function(env) {
path.resolve(__dirname, env.assets),
'node_modules']
},
plugins: [
new HtmlWebpackPlugin({
title: 'Alpha Centauri Farming',
filename: 'main.html',
meta: {viewport: 'width=device-width, initial-scale=1'},
}),
],
optimization: {
minimize: true,
minimizer: [new OptimizeCssAssetsPlugin({}), new TerserPlugin()],

Loading…
Cancel
Save