Exemple #1
0
def build_research_station(state: State, city: City):
    if state.research_stations == 0:
        state.previous_phase = state.phase
        state.phase = Phase.MOVE_STATION
    else:
        state.research_stations -= 1
    state.cities[city].build_research_station()
    state.last_build_research_station = city
Exemple #2
0
def event_action(state: State, event: Event):
    if isinstance(event, Forecast):
        state.previous_phase = state.phase
        state.phase = Phase.FORECAST
        state.play_card(event.player, EventCard.FORECAST)
    elif isinstance(event, GovernmentGrant):
        others.build_research_station(state, event.target_city)
        state.play_card(event.player, EventCard.GOVERNMENT_GRANT)
    elif isinstance(event, Airlift):
        state.move_player_to_city(event.target_player, event.destination)
        state.play_card(event.player, EventCard.AIRLIFT)
    elif isinstance(event, ResilientPopulation):
        state.infection_discard_pile.remove(event.discard_city)
        state.play_card(event.player, EventCard.RESILIENT_POPULATION)
    elif isinstance(event, OneQuietNight):
        state.one_quiet_night = True
        state.play_card(event.player, EventCard.ONE_QUIET_NIGHT)
    elif isinstance(event, MoveResearchStation):
        state.cities[event.move_from].remove_research_station()
        state.phase = state.previous_phase
Exemple #3
0
def other_action(state: State, action: Other, character: Character = None):
    if character is None:
        character = state.active_player

    if isinstance(action, TreatDisease):
        state.treat_city(action.city,
                         action.target_virus,
                         times=1 if character != Character.MEDIC else 3)
    elif isinstance(action, BuildResearchStation):
        if character != Character.OPERATIONS_EXPERT:
            state.play_card(character, action.city)
        build_research_station(state, action.city)
    elif isinstance(action, DiscoverCure):
        state.previous_phase = state.phase
        state.virus_to_cure = action.target_virus
        state.phase = Phase.CURE_VIRUS
    elif isinstance(action, ShareKnowledge):
        state.play_card(action.player, action.card)
        state.players[action.target_player].add_card(action.card)
    elif isinstance(action, ReserveCard):
        state.player_discard_pile.remove(action.card)
        state.players[character].contingency_planner_card = action.card