Merge pull request #58 from tjohnson314/master

Enable Central Europe map
This commit is contained in:
Eliott C 2023-07-11 12:02:46 +02:00 • committed by GitHub
commit 8b87e722ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 6 deletions

View file

@ -76,6 +76,18 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
}
}
// Nuclear plants for Central Europe are only allowed for players with cities in:
// Czechia (green), Slovakia (brown), Hungary (purple)
if (G.map.name == 'Central Europe') {
const validCities = player.cities
.map((c) => G.map.cities.find((c_) => c_.name == c.name)!)
.filter((c) => c.region == 'green' || c.region == 'brown' || c.region == 'purple');
if (validCities.length == 0) {
canBid = canBid.filter((p) => p.type != PowerPlantType.Uranium);
}
}
if (canBid.length > 0) {
moves[MoveName.ChoosePowerPlant] = canBid.map((p) => p.number);
}
@ -184,7 +196,16 @@ export function availableMoves(G: GameState, player: Player): AvailableMoves {
if (G.garbageMarket > 0) {
const garbagePrices = G.garbagePrices ?? prices[ResourceType.Garbage];
const price = garbagePrices[garbagePrices.length - G.garbageMarket];
let price = garbagePrices[garbagePrices.length - G.garbageMarket];
// $1 cheaper for players in Wien in Central Europe
if (G.map.name == 'Central Europe') {
const wienCity = player.cities.filter((c) => c.name == 'Wien');
if (wienCity?.length > 0) {
price--;
}
}
if (
player.money >= price &&
player.garbageCapacity > player.garbageLeft &&

View file

@ -1145,6 +1145,15 @@ export function move(G: GameState, move: Move, playerNumber: number, isUndo = fa
case ResourceType.Garbage: {
const garbagePrices = G.garbagePrices ?? prices[ResourceType.Garbage];
price = garbagePrices[garbagePrices.length - G.garbageMarket];
// $1 cheaper for players in Wien in Central Europe
if (G.map.name == 'Central Europe') {
const wienCity = player.cities.filter((c) => c.name == 'Wien');
if (wienCity?.length > 0) {
price--;
}
}
player.garbageLeft++;
G.garbageMarket--;
break;
@ -1314,6 +1323,15 @@ export function move(G: GameState, move: Move, playerNumber: number, isUndo = fa
G.garbageMarket++;
const garbagePrices = G.garbagePrices ?? prices[ResourceType.Garbage];
price = garbagePrices[garbagePrices.length - G.garbageMarket];
// $1 cheaper for players in Wien in Central Europe
if (G.map.name == 'Central Europe') {
const wienCity = player.cities.filter((c) => c.name == 'Wien');
if (wienCity?.length > 0) {
price--;
}
}
break;
}

View file

@ -15,10 +15,10 @@ export type MapName =
| 'India'
| 'China'
| 'Benelux'
| 'Russia';
| 'Russia'
| 'Central Europe';
// | 'Australia'
// | 'Baden-Württemberg'
// | 'Central Europe'
// | 'Japan'
// | 'Korea'
// | 'Northern Europe'

View file

@ -3,6 +3,7 @@ import { PowerPlant } from './gamestate';
import { map as america, mapRecharged as americaRecharged } from './maps/america';
import { map as benelux } from './maps/benelux';
import { map as brazil } from './maps/brazil';
import { map as centraleurope } from './maps/centraleurope';
import { map as china } from './maps/china';
import { map as france } from './maps/france';
import { map as germany, mapRecharged as germanyRecharged } from './maps/germany';
@ -14,7 +15,6 @@ import { map as russia } from './maps/russia';
import { map as spainportugal } from './maps/spainportugal';
// import { map as australia } from './maps/australia';
// import { map as badenwurttemberg } from './maps/badenwurttemberg';
// import { map as centraleurope } from './maps/centraleurope';
// import { map as japan } from './maps/japan';
// import { map as korea } from './maps/korea';
// import { map as northerneurope } from './maps/northerneurope';
@ -88,9 +88,9 @@ export const maps: GameMap[] = [
china,
benelux,
russia,
centraleurope,
// australia,
// badenwurttemberg,
// centraleurope,
// japan,
// korea,
// northerneurope,
@ -111,9 +111,9 @@ export const mapsRecharged: GameMap[] = [
china,
benelux,
russia,
centraleurope,
// australia,
// badenwurttemberg,
// centraleurope,
// china,
// japan,
// korea,

View file

@ -201,4 +201,34 @@ export const map: GameMap = {
layout: 'Portrait',
mapPosition: [70, -60],
adjustRatio: [1.15, 1.15],
resupply: [
[
[4, 5, 3],
[5, 6, 3],
[6, 7, 5],
[7, 8, 5],
[8, 10, 6],
],
[
[1, 2, 3],
[2, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
],
[
[1, 3, 3],
[1, 3, 3],
[2, 4, 4],
[3, 4, 5],
[3, 6, 6],
],
[
[1, 1, 1],
[1, 1, 1],
[1, 2, 1],
[2, 2, 2],
[2, 3, 2],
],
],
};