Exemple #1
0
void TeamState::InitHex(const Team& team, const MapPos& pos, int rotation, Map& map)
{
	Race race(team.GetRace());

	Hex& hex = map.AddHex(HexPtr(new Hex(race.GetStartSector(team.GetColour()), pos, rotation)));
	hex.SetColour(team.GetColour());
	m_infTrack.RemoveDiscs(1);

	for (Square* pSquare : hex.GetAvailableSquares(team))
	{
		m_popTrack.Remove(SquareTypeToResource(pSquare->GetType()), 1);
		pSquare->SetOccupied(true);
	}

	ShipType ship = race.GetStartShip();
	hex.AddShip(ship, team.GetColour());
	RemoveShips(ship, 1);
}
Exemple #2
0
std::vector<Square*> Hex::GetAvailableSquares(const Team& team)
{
    VERIFY_MODEL(m_colour == team.GetColour());

    std::vector<Square*> squares;

    for (Square& s : m_squares)
        if (!s.IsOccupied() && s.CanOccupy(team))
            squares.push_back(&s);
    return squares;
}
Exemple #3
0
int Hex::GetPinnage(const Team& team) const
{
    int nPinnage = 0;
    for (auto& fleet : m_fleets)
    {
        if (fleet.FindSquadron(ShipType::GCDS))
            return 1000;
        if (!(Race(team.GetRace()).IsAncientsAlly() && fleet.GetColour() == Colour::None))
            nPinnage += (fleet.GetColour() == team.GetColour() ? -1 : 1) * fleet.GetShipCount();
    }
    return nPinnage;
}
Exemple #4
0
bool Hex::IsOwnedBy(const Team& team) const
{
    return m_colour == team.GetColour();
}
Exemple #5
0
bool Hex::CanExploreFrom(const Team& team) const
{
    // "...next to a hex where you have a Ship or an Influence Disc"
    // "If you Explore from a hex with only a Ship, it must not be pinned"
    return IsOwnedBy(team) || (HasShip(team.GetColour()) && CanMoveOut(team));
}