✨ (all) adding rules button, minor graphics adjustments
This commit is contained in:
parent
e7b4acd2bf
commit
b57c55bc9f
10 changed files with 187 additions and 31 deletions
|
|
@ -14,7 +14,7 @@
|
|||
"scripts": {
|
||||
"prepublishOnly": "npm run test && npm run clean && tsc",
|
||||
"build": "npm run clean && tsc",
|
||||
"clean": "rm -Rf dist",
|
||||
"clean": "del /q dist",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test": "mocha -r ts-node/register src/**/*.spec.ts src/*.spec.ts"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const uraniumResupply = [
|
|||
];
|
||||
const citiesToStep2 = [10, 7, 7, 7, 6];
|
||||
const citiesToEndGame = [21, 17, 17, 15, 14];
|
||||
const cityIncome = [10, 22, 33, 44, 54, 65, 73, 82, 90, 98, 105, 112, 118, 124, 129, 134, 138, 142, 145, 148, 150];
|
||||
const cityIncome = [10, 22, 33, 44, 54, 65, 73, 82, 90, 98, 105, 112, 118, 124, 129, 134, 138, 142, 145, 148, 150, 150];
|
||||
const regionsInPlay = [3, 3, 4, 5, 5];
|
||||
|
||||
export function setup(numPlayers: number, { fastBid = false }: GameOptions, seed?: string): GameState {
|
||||
|
|
@ -130,6 +130,8 @@ export function setup(numPlayers: number, { fastBid = false }: GameOptions, seed
|
|||
playRegions.has(map.cities.find((city) => city.name == con.to)!.region)
|
||||
);
|
||||
|
||||
const p = players.length - 2;
|
||||
|
||||
const G: GameState = {
|
||||
map: filteredMap,
|
||||
players,
|
||||
|
|
@ -160,7 +162,12 @@ export function setup(numPlayers: number, { fastBid = false }: GameOptions, seed
|
|||
auctionSkips: 0,
|
||||
citiesToStep2: citiesToStep2[numPlayers - 2],
|
||||
citiesToEndGame: citiesToEndGame[numPlayers - 2],
|
||||
resourceResupply: '',
|
||||
resourceResupply: [
|
||||
`[${coalResupply[p][0]}, ${oilResupply[p][0]}, ${garbageResupply[p][0]}, ${uraniumResupply[p][0]}]`,
|
||||
`[${coalResupply[p][1]}, ${oilResupply[p][1]}, ${garbageResupply[p][1]}, ${uraniumResupply[p][1]}]`,
|
||||
`[${coalResupply[p][2]}, ${oilResupply[p][2]}, ${garbageResupply[p][2]}, ${uraniumResupply[p][2]}]`,
|
||||
],
|
||||
paymentTable: cityIncome,
|
||||
} as GameState;
|
||||
|
||||
G.log.push({ type: 'event', event: 'Game Start!' });
|
||||
|
|
@ -385,7 +392,7 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
case Phase.Bureaucracy: {
|
||||
player.passed = true;
|
||||
|
||||
player.money += cityIncome[Math.min(player.cities.length, player.citiesPowered)];
|
||||
player.money += G.paymentTable[Math.min(player.cities.length, player.citiesPowered)];
|
||||
player.citiesPowered = 0;
|
||||
|
||||
if (G.players.filter((p) => !p.passed).length == 0) {
|
||||
|
|
@ -696,10 +703,6 @@ export function move(G: GameState, move: Move, playerNumber: number, fake?: bool
|
|||
|
||||
G.currentPlayers.forEach((p) => (G.players[p].availableMoves = availableMoves(G, G.players[p])));
|
||||
|
||||
const p = G.players.length - 2;
|
||||
const i = G.step - 1;
|
||||
G.resourceResupply = `[${coalResupply[p][i]}, ${oilResupply[p][i]}, ${garbageResupply[p][i]}, ${uraniumResupply[p][i]}]`;
|
||||
|
||||
return G;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,5 +141,6 @@ export interface GameState {
|
|||
auctionSkips: number;
|
||||
citiesToStep2: number;
|
||||
citiesToEndGame: number;
|
||||
resourceResupply: string;
|
||||
resourceResupply: string[];
|
||||
paymentTable: number[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,13 +4,6 @@ module.exports = {
|
|||
'vue/no-unused-vars': 'error',
|
||||
'vue/html-indent': ['error', 4, { alignAttributesVertically: false }],
|
||||
'vue/max-attributes-per-line': 0,
|
||||
'vue/html-closing-bracket-newline': [
|
||||
'error',
|
||||
{
|
||||
singleline: 'never',
|
||||
multiline: 'never',
|
||||
},
|
||||
],
|
||||
'vue/attribute-hyphenation': ['error', 'never'],
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
|
|
|
|||
|
|
@ -40,19 +40,22 @@
|
|||
<template v-for="index in 21">
|
||||
<rect
|
||||
:key="'playerCityCount' + index"
|
||||
width="30"
|
||||
height="40"
|
||||
:x="250 + 33 * (index - 1)"
|
||||
y="15"
|
||||
width="28"
|
||||
height="38"
|
||||
:x="251 + 33 * (index - 1)"
|
||||
y="16"
|
||||
rx="2"
|
||||
fill="darkgoldenrod"
|
||||
:stroke="
|
||||
G && (index == G.citiesToStep2 || index == G.citiesToEndGame) ? '#916a08' : 'darkgoldenrod'
|
||||
"
|
||||
stroke-width="2px"
|
||||
/>
|
||||
<text
|
||||
:key="'playerCityCountText' + index"
|
||||
text-anchor="middle"
|
||||
style="font-size: 24px; font-family: monospace"
|
||||
letter-spacing="-3"
|
||||
:text-decoration="G && (index == G.citiesToStep2 || index == G.citiesToEndGame) ? 'underline' : ''"
|
||||
:x="265 + 33 * (index - 1)"
|
||||
y="35"
|
||||
fill="gold"
|
||||
|
|
@ -219,7 +222,7 @@
|
|||
Phase: {{ G.phase }}
|
||||
</text>
|
||||
<text x="30" y="680" font-weight="600" fill="black" style="font-size: 24px">
|
||||
Resource Resupply: {{ G.resourceResupply }}
|
||||
Resource Resupply: {{ G.resourceResupply[G.step - 1] }}
|
||||
</text>
|
||||
</template>
|
||||
</template>
|
||||
|
|
@ -227,8 +230,9 @@
|
|||
<PassButton transform="translate(1355, 15)" :enabled="canPass()" @click="pass()" />
|
||||
<UndoButton transform="translate(1355, 56)" :enabled="canUndo()" @click="undo()" />
|
||||
<LogButton transform="translate(1355, 97)" @click="showLog()" />
|
||||
<SoundButton transform="translate(1450, 25)" :isOn="preferences.sound" @click="toggleSound()" />
|
||||
<HelpButton transform="translate(1450, 80)" :isOn="!preferences.disableHelp" @click="toggleHelp()" />
|
||||
<SoundButton transform="translate(1450, 13)" :isOn="preferences.sound" @click="toggleSound()" />
|
||||
<HelpButton transform="translate(1450, 54)" :isOn="!preferences.disableHelp" @click="toggleHelp()" />
|
||||
<RulesButton transform="translate(1450, 95)" @click="rulesVisible = true" />
|
||||
|
||||
<template v-if="G">
|
||||
<template v-if="G.phase == 'Auction' && G.chosenPowerPlant">
|
||||
|
|
@ -544,6 +548,99 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="G" :class="['modal', { visible: rulesVisible }]">
|
||||
<div class="modal-content" style="left: 50%; transform: translate(-50%)">
|
||||
<span class="close" @click="rulesVisible = false">×</span>
|
||||
<div class="modal-title">Rules Summary</div>
|
||||
<div>
|
||||
<strong>Phases:</strong>
|
||||
<ul>
|
||||
<li><strong>Determine Turn Order</strong> by cities built and highest power plant</li>
|
||||
<li>
|
||||
<strong>Buy Power Plants</strong> from the actual market (minimun bid is power plant number)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Buy Resources</strong> in <strong>reverse</strong> turn order from the resource
|
||||
market
|
||||
</li>
|
||||
<li>
|
||||
<strong>Build Cities</strong> in <strong>reverse</strong> turn order paying
|
||||
<strong>10/15/20</strong> plus connection cost
|
||||
</li>
|
||||
<li>
|
||||
<strong>Bureaucracy:</strong> spend resources to use power plants, collect money according
|
||||
to cities supplied, resupply resource market
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Steps:</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Step 1:</strong>
|
||||
<ul>
|
||||
<li><strong>One</strong> player per city</li>
|
||||
<li>
|
||||
Resource Resupply: <strong>{{ G.resourceResupply[0] }}</strong>
|
||||
</li>
|
||||
<li>Bureaucracy: remove <strong>highest</strong> power plant from market</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Step 2:</strong>
|
||||
<ul>
|
||||
<li>
|
||||
Starts after building phase where a player has
|
||||
<strong>{{ G.citiesToStep2 }}</strong> or more cities
|
||||
</li>
|
||||
<li><strong>Two</strong> players per city</li>
|
||||
<li>
|
||||
Resource Resupply: <strong>{{ G.resourceResupply[1] }}</strong>
|
||||
</li>
|
||||
<li>Bureaucracy: remove <strong>highest</strong> power plant from market</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Step 3:</strong>
|
||||
<ul>
|
||||
<li>Starts after the "Step 3" card is drawn from the deck</li>
|
||||
<li><strong>Three</strong> players per city</li>
|
||||
<li>
|
||||
Resource Resupply: <strong>{{ G.resourceResupply[2] }}</strong>
|
||||
</li>
|
||||
<li>Bureaucracy: remove <strong>lowest</strong> power plant from market</li>
|
||||
<li>All power plants available for auction</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
Game ends after building phase where a player has <strong>{{ G.citiesToEndGame }}</strong> or more
|
||||
cities.<br />
|
||||
The winner is the player that can power more cities. Money and number of cities built are
|
||||
tiebrakers.
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<strong>Payment Table</strong>
|
||||
<table class="payment-table">
|
||||
<tr>
|
||||
<td><strong>Cities</strong></td>
|
||||
<template v-for="index in 21">
|
||||
<td :key="'cities' + index">{{ index - 1 }}</td>
|
||||
</template>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Payment</strong></td>
|
||||
<template v-for="index in 21">
|
||||
<td :key="'payment' + index">${{ G.paymentTable[index - 1] }}</td>
|
||||
</template>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
|
|
@ -553,7 +650,7 @@ import type { GameState } from 'powergrid-engine';
|
|||
import { EventEmitter } from 'events';
|
||||
import { Piece, UIData, Preferences } from '../types/ui-data';
|
||||
import { Card, House, Coal, Oil, Garbage, Uranium } from './pieces';
|
||||
import { Button, PassButton, UndoButton, LogButton, SoundButton, HelpButton } from './buttons';
|
||||
import { Button, PassButton, UndoButton, LogButton, SoundButton, HelpButton, RulesButton } from './buttons';
|
||||
import PlayerBoard from './PlayerBoard.vue';
|
||||
import Calculator from './Calculator.vue';
|
||||
import { LogMove } from 'powergrid-engine/src/log';
|
||||
|
|
@ -568,6 +665,7 @@ import { City, Phase, PowerPlant, PowerPlantType, ResourceType } from 'powergrid
|
|||
LogButton,
|
||||
SoundButton,
|
||||
HelpButton,
|
||||
RulesButton,
|
||||
Button,
|
||||
Calculator
|
||||
},
|
||||
|
|
@ -612,6 +710,7 @@ export default class Game extends Vue {
|
|||
|
||||
logVisible = false;
|
||||
endScoreVisible = false;
|
||||
rulesVisible = false;
|
||||
|
||||
totalBid: number = 0;
|
||||
|
||||
|
|
@ -1111,6 +1210,10 @@ export default class Game extends Vue {
|
|||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
ul {
|
||||
margin-block-start: 0;
|
||||
}
|
||||
|
||||
.game {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -1273,6 +1376,19 @@ text {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.payment-table {
|
||||
border: 1px solid black;
|
||||
margin: 5px auto;
|
||||
|
||||
tr {
|
||||
td {
|
||||
border: 1px solid black;
|
||||
text-align: center;
|
||||
padding: 0 10px 0 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.final-score-table {
|
||||
margin: auto;
|
||||
border: 1px solid black;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<g class="player-board">
|
||||
<rect width="350" height="100" x="0" y="0" fill="gold" :stroke="color" />
|
||||
<rect width="350" height="25" x="0" y="0" :fill="color" />
|
||||
<text x="5" y="13" font-weight="600" fill="black" :text-decoration="isCurrentPlayer ? 'underline' : ''">
|
||||
<text x="5" y="13" font-weight="600" fill="black">
|
||||
{{ getPlayerName() }}
|
||||
</text>
|
||||
<text v-if="isPlayer || ended" x="250" y="13" font-weight="600" fill="black">Money: ${{ player.money }}</text>
|
||||
|
|
|
|||
14
viewer/src/components/buttons/RulesButton.vue
Normal file
14
viewer/src/components/buttons/RulesButton.vue
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<template>
|
||||
<g class="button enabled" @click="$emit('click')">
|
||||
<circle cx="15" cy="15" r="15" fill="gainsboro" stroke="black" stroke-width="2px" />
|
||||
<image x="5" y="5" width="20" height="20" href="../../icons/rules.svg" />
|
||||
<title>Rules</title>
|
||||
</g>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class RulesButton extends Vue {
|
||||
}
|
||||
</script>
|
||||
|
|
@ -3,6 +3,7 @@ import HelpButton from './HelpButton.vue';
|
|||
import LogButton from './LogButton.vue';
|
||||
import PassButton from './PassButton.vue';
|
||||
import SoundButton from './SoundButton.vue';
|
||||
import RulesButton from './RulesButton.vue';
|
||||
import UndoButton from './UndoButton.vue';
|
||||
|
||||
export { Button, HelpButton, LogButton, PassButton, SoundButton, UndoButton };
|
||||
export { Button, HelpButton, LogButton, PassButton, SoundButton, RulesButton, UndoButton };
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
@click="canClick && $emit('click')"
|
||||
>
|
||||
<path d="M3,3 l4,-2 l6,0 l4,2 l0,11 l-4,2 l-6,0 l-4,-2Z" fill="none" stroke="black" />
|
||||
<path d="M3,3 l4,-2 l6,0 l4,2 l0,2 l-4,2 l-6,0 l-4,-2 l0,-2" fill="#F00" />
|
||||
<path d="M3,5 l0,9 l4,2 l0,-9 l-4,-2" fill="#e60000" />
|
||||
<path d="M7,7 l6,0 l0,9 l-6,0 l0,-9" fill="#cc0000" />
|
||||
<path d="M13,7 l4,-2 l0,9 l-4,2 l0,-9" fill="#b30000" />
|
||||
<path d="M3,3 l4,-2 l6,0 l4,2 l0,2.1 l-4,2 l-6,0 l-4,-2 l0,-2.1" fill="#F00" />
|
||||
<path d="M3,5 l0,9 l4.1,2 l0,-9 l-4.1,-2" fill="#e60000" />
|
||||
<path d="M7,7 l6.1,0 l0,9 l-6.1,0 l0,-9" fill="#cc0000" />
|
||||
<path d="M13,7 l4.1,-2 l0,9 l-4.1,2 l0,-9" fill="#b30000" />
|
||||
|
||||
<title>Uranium</title>
|
||||
</g>
|
||||
|
|
|
|||
28
viewer/src/icons/rules.svg
Normal file
28
viewer/src/icons/rules.svg
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="475.452px" height="475.451px" viewBox="0 0 475.452 475.451">
|
||||
<g>
|
||||
<path d="M468.083,118.385c-3.99-5.33-9.61-9.419-16.854-12.275c0.387,6.665-0.086,12.09-1.42,16.281l-85.65,281.789
|
||||
c-1.526,4.948-4.859,8.897-9.992,11.848c-5.141,2.953-10.469,4.428-15.989,4.428H74.66c-22.84,0-36.542-6.652-41.112-19.985
|
||||
c-1.903-5.14-1.807-9.229,0.288-12.275c2.092-2.857,5.708-4.288,10.85-4.288h248.102c17.702,0,29.93-3.285,36.688-9.852
|
||||
c6.763-6.567,13.565-21.177,20.413-43.824l78.228-258.669c4.186-14.084,2.474-26.457-5.141-37.113s-18.462-15.987-32.548-15.987
|
||||
H173.163c-2.474,0-7.329,0.854-14.562,2.568l0.284-0.859c-5.33-1.14-9.851-1.662-13.562-1.571
|
||||
c-3.71,0.099-7.137,1.192-10.277,3.289c-3.14,2.094-5.664,4.328-7.566,6.706c-1.903,2.38-3.761,5.426-5.568,9.136
|
||||
c-1.805,3.715-3.33,7.142-4.567,10.282c-1.237,3.14-2.666,6.473-4.281,9.998c-1.62,3.521-3.186,6.423-4.71,8.706
|
||||
c-1.143,1.523-2.758,3.521-4.854,5.996c-2.091,2.474-3.805,4.664-5.137,6.567c-1.331,1.903-2.19,3.616-2.568,5.14
|
||||
c-0.378,1.711-0.19,4.233,0.571,7.566c0.76,3.328,1.047,5.753,0.854,7.277c-0.76,7.232-3.378,16.414-7.849,27.552
|
||||
c-4.471,11.136-8.52,19.18-12.135,24.126c-0.761,0.95-2.853,3.092-6.28,6.424c-3.427,3.33-5.52,6.23-6.279,8.704
|
||||
c-0.762,0.951-0.81,3.617-0.144,7.994c0.666,4.38,0.907,7.423,0.715,9.136c-0.765,6.473-3.14,15.037-7.139,25.697
|
||||
c-3.999,10.657-7.994,19.414-11.993,26.265c-0.569,1.141-2.185,3.328-4.853,6.567c-2.662,3.237-4.283,5.902-4.853,7.99
|
||||
c-0.38,1.523-0.33,4.188,0.144,7.994c0.473,3.806,0.426,6.66-0.144,8.562c-1.521,7.228-4.377,15.94-8.565,26.125
|
||||
c-4.187,10.178-8.47,18.896-12.851,26.121c-1.138,1.906-2.712,4.145-4.708,6.711c-1.999,2.566-3.568,4.805-4.711,6.707
|
||||
c-1.141,1.903-1.903,3.901-2.284,5.996c-0.19,1.143,0.098,2.998,0.859,5.571c0.76,2.566,1.047,4.612,0.854,6.14
|
||||
c-0.192,2.662-0.57,6.187-1.141,10.567c-0.572,4.373-0.859,6.939-0.859,7.699c-4.187,11.424-3.999,23.511,0.572,36.269
|
||||
c5.33,14.838,14.797,27.36,28.406,37.541c13.61,10.185,27.74,15.27,42.398,15.27h263.521c12.367,0,24.026-4.141,34.971-12.416
|
||||
c10.944-8.281,18.227-18.507,21.837-30.696l78.511-258.662C477.412,141.51,475.701,129.234,468.083,118.385z M164.31,118.956
|
||||
l5.997-18.274c0.76-2.474,2.329-4.615,4.709-6.423c2.38-1.805,4.808-2.712,7.282-2.712h173.589c2.663,0,4.565,0.903,5.708,2.712
|
||||
c1.14,1.809,1.335,3.949,0.575,6.423l-6.002,18.274c-0.764,2.475-2.327,4.611-4.713,6.424c-2.382,1.805-4.805,2.708-7.278,2.708
|
||||
H170.593c-2.666,0-4.568-0.9-5.711-2.708C163.74,123.567,163.55,121.431,164.31,118.956z M140.615,192.045l5.996-18.271
|
||||
c0.76-2.474,2.331-4.615,4.709-6.423c2.38-1.809,4.805-2.712,7.282-2.712h173.583c2.666,0,4.572,0.9,5.712,2.712
|
||||
c1.14,1.809,1.331,3.949,0.568,6.423l-5.996,18.271c-0.759,2.474-2.33,4.617-4.708,6.423c-2.383,1.809-4.805,2.712-7.283,2.712
|
||||
H146.895c-2.664,0-4.567-0.9-5.708-2.712C140.043,196.662,139.854,194.519,140.615,192.045z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue