import { IProjectCard } from '../IProjectCard' ; import { Tags } from '../Tags' ; import { TileType } from '../../TileType' ; import { Card } from '../Card' ; import { CardType } from '../CardType' ; import { Player } from '../../Player' ; import { ISpace } from '../../boards/ISpace' ; import { SelectSpace } from '../../inputs/SelectSpace' ; import { Resources } from '../../Resources' ; import { CardName } from '../../CardName' ; import { IAdjacencyBonus } from '../../ares/IAdjacencyBonus' ; import { CardRequirements } from '../CardRequirements' ; import { CardRenderer } from '../render/CardRenderer' ; import { Units } from '../../Units' ; import { nextToNoOtherTileFn } from '../../boards/Board' ; import { max } from '../Options' ; export class NaturalPreserve extends Card implements IProjectCard { constructor ( name = CardName . NATURAL_PRESERVE , adjacencyBonus = undefined , metadata = { cardNumber : '044' , renderData : CardRenderer . builder ( ( b ) => { b . production ( ( pb ) => pb . megacredits ( 1 ) ) . nbsp . tile ( TileType . NATURAL_PRESERVE , true ) . asterix ( ) ; } ) , description : 'Oxygen must be 4% or less. Place this tile NEXT TO NO OTHER TILE. Increase your M€ production 1 step.' , } ) { super ( { cardType : CardType . AUTOMATED , name , tags : [ Tags . SCIENCE , Tags . BUILDING ] , cost : 9 , productionBox : Units . of ( { megacredits : 1 } ) , adjacencyBonus , requirements : CardRequirements . builder ( ( b ) => b . oxygen ( 4 , { max } ) ) , victoryPoints : 1 , metadata , } ) ; } private getAvailableSpaces ( player ) { return player . game . board . getAvailableSpacesOnLand ( player ) . filter ( nextToNoOtherTileFn ( player . game . board ) ) ; } public canPlay ( player ) { return this . getAvailableSpaces ( player ) . length > 0 ; } public play ( player ) { return new SelectSpace ( 'Select space for special tile next to no other tile' , this . getAvailableSpaces ( player ) , ( foundSpace ) => { player . game . addTile ( player , foundSpace . spaceType , foundSpace , { tileType : TileType . NATURAL_PRESERVE } ) ; foundSpace . adjacency = this . adjacencyBonus ; player . addProduction ( Resources . MEGACREDITS , 1 ) ; return undefined ; } ) ; } }