Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Mythic Emblem powers. These are legion
- --------------------------------------------------------------
- include( "Sukritact_SaveUtils.lua" ); MY_MOD_NAME = "CLBeothukMythic";
- function RemoveCLBeoHidden()
- for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS - 1, 1 do
- local pPlayer = Players[iPlayer]
- if pPlayer:GetCivilizationType() ~= GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- if pPlayer ~= nil then
- local iTeam = pPlayer:GetTeam()
- local pTeam = Teams[iTeam]
- if pTeam:IsHasTech(GameInfoTypes.TECH_CLBEOHIDDEN) then
- pTeam:SetHasTech(GameInfoTypes.TECH_CLBEOHIDDEN, false, pPlayer, false, false)
- end
- end
- end
- end
- end
- RemoveCLBeoHidden()
- function MythicShipPower(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- if pCity:IsHasBuilding(GameInfoTypes.BUILDING_CLBEOSHIP) then
- local SeaLuxes = 0
- for pCityPlot = 0, pCity:GetNumCityPlots() - 1, 1 do
- local pSpecificPlot = pCity:GetCityIndexPlot(pCityPlot)
- if pSpecificPlot ~= nil then
- if pSpecificPlot:GetOwner() == pCity:GetOwner() then
- if pSpecificPlot:GetResourceType(-1) == GameInfoTypes.RESOURCE_PEARLS or pSpecificPlot:GetResourceType(-1) == GameInfoTypes.RESOURCE_CORAL or pSpecificPlot:GetResourceType(-1) == GameInfoTypes.RESOURCE_WHALE or pSpecificPlot:GetResourceType(-1) == GameInfoTypes.RESOURCE_CRAB then
- SeaLuxes = SeaLuxes + 1
- end
- end
- end
- end
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOSHIPPROD, SeaLuxes)
- end
- end
- end
- end
- --PlayerDoTurn
- function MythicHuntPower(player, city, unit)
- print("Mythic Hunt Power Triggered")
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- local pCity = pPlayer:GetCityByID(city)
- local pUnit = pPlayer:GetUnitByID(unit)
- if pCity:IsHasBuilding(GameInfoTypes.BUILDING_CLBEOHUNT) then
- print("Unit domain is " .. pUnit:GetDomainType())
- if pUnit:GetDomainType() == DomainTypes.DOMAIN_SEA then
- print("You made a boat! Have some culture")
- pPlayer:ChangeJONSCulture(2)
- if pPlayer:IsHuman() then
- Events.GameplayAlertMessage(Locale.ConvertTextKey("TXT_KEY_CLBEOTHUK_HUNT_NOTIFICATION", pCity:GetName()))
- end
- end
- end
- end
- end
- --CityTrained
- function MythicCouncilRequires(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- print("Council Requirements fired")
- for pCity in pPlayer:Cities() do
- if pCity:IsCapital() or pPlayer:IsCapitalConnectedToCity(pCity) then
- print("Connected city found!")
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOCOUNCILREQ, 1)
- else
- print("City is disconnected")
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOCOUNCILREQ, 0)
- end
- end
- end
- end
- --PlayerDoTurn
- function MythicCouncilPower(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- if pCity:IsHasBuilding(GameInfoTypes.BUILDING_CLBEOCOUNCIL) then
- local WorkUnits = 0
- for pCityPlot = 0, pCity:GetNumCityPlots() - 1, 1 do
- local pSpecificPlot = pCity:GetCityIndexPlot(pCityPlot)
- if pSpecificPlot ~= nil then
- if pSpecificPlot:GetOwner() == pCity:GetOwner() then
- if pSpecificPlot:GetImprovementType() == GameInfoTypes.IMPROVEMENT_FISHING_BOATS or pSpecificPlot:GetImprovementType() == GameInfoTypes.IMPROVEMENT_OFFSHORE_PLATFORM then
- WorkUnits = WorkUnits + 1
- else
- for i = 0, pSpecificPlot:GetNumUnits() - 1, 1 do
- local pUnit = pSpecificPlot:GetUnit(i)
- if pUnit ~= nil then
- if pUnit:GetUnitType() == GameInfoTypes.UNIT_WORKER then
- WorkUnits = WorkUnits + 1
- end
- end
- end
- end
- end
- end
- end
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOGPPROD, WorkUnits)
- end
- end
- end
- end
- --PlayerDoTurn
- function MythicMoonRequires(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- if pPlayer:HasCreatedPantheon() then
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOMOONREQ, 1)
- else
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOMOONREQ, 0)
- end
- end
- end
- end
- --PlayerDoTurn
- function MythicMoonPower(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- if pCity:IsHasBuilding(GameInfoTypes.BUILDING_CLBEOMOON) then
- local ForeignBoat = 0
- for pCityPlot = 0, pCity:GetNumCityPlots() - 1, 1 do
- local pSpecificPlot = pCity:GetCityIndexPlot(pCityPlot)
- if pSpecificPlot ~= nil then
- if pSpecificPlot:IsWater() then
- local pUnit = pSpecificPlot:GetUnit(0)
- if pUnit ~= nil then
- if pUnit:GetDomainType() == DomainTypes.DOMAIN_SEA then
- if Players[pUnit:GetOwner()] ~= pPlayer then
- ForeignBoat = ForeignBoat + 1
- end
- end
- end
- end
- end
- end
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOSHIPFAITH, ForeignBoat)
- end
- end
- end
- end
- --PlayerDoTurn
- function MythicFestivalRequires(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- if pCity:GetResourceDemanded(true) == GameInfoTypes.RESOURCE_PEARLS or pCity:GetResourceDemanded(true) == GameInfoTypes.RESOURCE_CORAL or pCity:GetResourceDemanded(true) == GameInfoTypes.RESOURCE_WHALE or pCity:GetResourceDemanded(true) == GameInfoTypes.RESOURCE_CRAB then
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOFESTIVALREQ, 1)
- else
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOFESTIVALREQ, 0)
- end
- end
- end
- end
- --PlayerDoTurn
- function PlaceMythicalBeast(pCity, pResource)
- for pCityPlot = 0, pCity:GetNumCityPlots() - 1, 1 do
- local pSpecificPlot = pCity:GetCityIndexPlot(pCityPlot)
- if pSpecificPlot ~= nil then
- if pSpecificPlot:IsWater() then
- print("We found water")
- if pSpecificPlot:GetResourceType(-1) == -1 then
- pSpecificPlot:SetResourceType(pResource, 1)
- print("resource placed.")
- return
- else
- print("but it's full")
- end
- end
- end
- end
- end
- function MythicFestivalPower(player, city, buildingType)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- if buildingType == GameInfoTypes.BUILDING_CLBEOFESTIVAL then
- local pCity = pPlayer:GetCityByID(city)
- print(pCity:GetName() .. " has a Festical Emblem")
- local pResource = pCity:GetResourceDemanded(true)
- print(pResource .. " demanded!")
- PlaceMythicalBeast(pCity, pResource)
- save(pPlayer, pCity:GetName(), pResource)
- end
- end
- end
- --GameEvents.CityConstructed
- function RemoveMythicalBeast(pCity, pResource)
- for pCityPlot = 0, pCity:GetNumCityPlots() - 1, 1 do
- local pSpecificPlot = pCity:GetCityIndexPlot(pCityPlot)
- if pSpecificPlot ~= nil then
- if pSpecificPlot:IsWater() then
- if pSpecificPlot:GetResourceType(-1) == pResource then
- pSpecificPlot:SetResourceType(-1)
- return
- end
- end
- end
- end
- end
- function StopMythicalFestivalPower(player, city, building)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- print("BuildingType is "..buildingType)
- if buildingType == BUILDING_CLBEOFESTIVAL then
- local pCity = pPlayer:GetCityByID(city)
- local pResource = load(pPlayer, pCity:GetName())
- if pResource ~= nil then
- RemoveMythicalBeast(pCity, pResource)
- end
- end
- end
- end
- --GameEvents.CitySoldBuilding
- function MythicSongRequires(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- print(pCity:GetNumWorldWonders() .. " in " .. pCity:GetName())
- if pCity:GetNumWorldWonders() > 0 then
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOSONGREQ, 1)
- else
- pCity:SetNumRealBuilding(GameInfoTypes.BUILDING_CLBEOSONGREQ, 0)
- end
- end
- end
- end
- --PlayerDoTurn
- function MythicSongPower(player)
- local pPlayer = Players[player]
- if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- for pCity in pPlayer:Cities() do
- if pCity:IsHasBuilding(GameInfoTypes.BUILDING_CLBEOSONG) then
- local range = 3
- local pPlot = pCity:Plot()
- local x = pPlot:GetX()
- local y = pPlot:GetY()
- for dx = -range, range do
- for dy = -range, range do
- local SpecificPlot = Map.PlotXYWithRangeCheck(x, y, dx, dy, range)
- if SpecificPlot ~= nil and SpecificPlot:GetOwner() == -1 then
- print("SpecificPlot is working")
- if SpecificPlot:GetTerrainType() == TerrainTypes.TERRAIN_COAST then
- SpecificPlot:SetOwner(pCity:GetOwner())
- end
- end
- end
- end
- end
- end
- end
- end
- --PlayerDoTurn
- for i = 0, GameDefines.MAX_MAJOR_CIVS - 1, 1 do
- local pPlayer = Players[i]
- if pPlayer:IsEverAlive() and pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_CLBEOTHUK then
- print("Beothuk Mythic Emblem lua loaded!")
- GameEvents.PlayerDoTurn.Add(MythicShipPower)
- GameEvents.PlayerDoTurn.Add(MythicCouncilRequires)
- GameEvents.PlayerDoTurn.Add(MythicCouncilPower)
- GameEvents.PlayerDoTurn.Add(MythicMoonRequires)
- GameEvents.PlayerDoTurn.Add(MythicMoonPower)
- GameEvents.PlayerDoTurn.Add(MythicFestivalRequires)
- GameEvents.PlayerDoTurn.Add(MythicSongRequires)
- GameEvents.PlayerDoTurn.Add(MythicSongPower)
- GameEvents.CityTrained.Add(MythicHuntPower)
- GameEvents.CityConstructed.Add(MythicFestivalPower)
- GameEvents.CitySoldBuilding.Add(StopMythicFestivalPower)
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement