Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Austria Hungary Functions
- -- Author: TarcisioCM
- -- DateCreated: 7/23/2014 11:23:53 AM
- --------------------------------------------------------------
- print ("Gott erhalte Franz den Kaiser!")
- function GreaterEurope_AHtrait(playerID)
- local player = Players[playerID]
- if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_AUSTRIA_HUNGARY"] and player:IsAlive() then -- [Change the civ name]
- for city in player:Cities() do
- --Refresh to see if any puppet city has been annexed.
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETFOODDUMMY"], 0)
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETDUMMY"], 0)
- --Dummy to get the food difference of puppet cities, it will create dummy buildings in that city equal to the food surplus.
- if city:IsPuppet() then
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], 0) -- Just making sure this is removed
- local PuppetFood = city:FoodDifference()
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETFOODDUMMY"], PuppetFood)
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETDUMMY"], 1)
- end
- --Giving the puppet bonus for non-puppet cities.
- local productionBonus = player:GetBuildingClassCount(GameInfoTypes["BUILDINGCLASS_GE_AUSTRIAHUNGARY_PUPPETFOODDUMMY"]) / 3 --[Change the "3" to decide how much food is required per production bonus.]
- local numPuppets = player:GetBuildingClassCount(GameInfoTypes["BUILDINGCLASS_GE_AUSTRIAHUNGARY_PUPPETDUMMY"])
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PRODUCTIONDUMMY"], 0) -- Remove the production bonus before assigning it again, so if the conditions are not met you'll lose the bonus.
- if not(city:IsPuppet()) then
- local currentPoints = city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"])
- local pointIncrease = numPuppets + currentPoints
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], pointIncrease) -- WeLoveTheKingDay points for each puppet city.
- local pointLimit = 100 + ((numPuppets * 20)) -- [Define the limit of points so a new day can begin. The number of puppets is multiplied by 20 and added to the point limit, you can change that to anything]
- if city:GetWeLoveTheKingDayCounter() == 0 then
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], pointIncrease) -- WeLoveTheKingDay points for each puppet city.
- if city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"]) >= pointLimit then
- city:SetWeLoveTheKingDayCounter(20) --[Set the number of turns this city have the WeLoveTheKingDay, default is 20]
- --Warning the player
- if player:IsHuman() then
- local cityName = city:GetName()
- local description = Locale.ConvertTextKey('TXT_KEY_GE_WELOVETHEKINGDAY_EVENT', cityName)
- local descriptionShort = Locale.ConvertTextKey("TXT_KEY_GE_WELOVETHEKINGDAY_EVENT_SHORT", cityName)
- player:AddNotification(NotificationTypes["NOTIFICATION_GENERIC"], description, descriptionShort)
- end
- end
- end
- if city:GetWeLoveTheKingDayCounter() > 0 then
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], 0) -- Remove the WeLoveTheKingDay points.
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PRODUCTIONDUMMY"], (productionBonus * 2)) -- This is a dummy building with 1% production modifier, and is assigned to every non-puppet city.
- if city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PRODUCTIONDUMMY"]) > 30 then -- [If you change the 25 below change it here too]
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PRODUCTIONDUMMY"], 30) -- [25% is the maximum bonus from puppet cities you can have, so this makes sure you'll only have a max of 25 dummies]
- end
- end
- end
- end
- end
- end
- GameEvents.PlayerDoTurn.Add(GreaterEurope_AHtrait)
- GreaterEurope_ConcertHall(playerID)
- local player = Players[playerID]
- if player:IsAlive() and player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_AUSTRIA_HUNGARY"] then -- Change civ
- for city in player:Cities() do
- local plot = city:Plot()
- for i = 0, plot:GetNumUnits() - 1, 1 do
- if not(plot:GetUnit(i):IsHasPromotion(GameInfoTypes["PROMOTION_GE_SPAWNINGDUMMY"])) then
- local unit = plot:GetUnit()
- if city:IsHasBuilding(GameInfoTypes["BUILDING_AUSTRIA_HUNGARY_CONCERTHALL"]) then -- Change building
- if city:GetNumGreatWorksInBuilding(GameInfoTypes["BUILDINGCLASS_OPERAHOUSE"]) == 2 then -- no need to change this is buildingclass
- local currentPoints = city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"])
- city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], currentPoints + 3) -- Change "3" for desired ammount of day points per unit
- unit:ChangeExperience(15) -- exp that units gain
- end
- end
- end
- end
- end
- for unit in player:Units() do
- unit:SetHasPromotion(GameInfoTypes["PROMOTION_GE_SPAWNINGDUMMY"], true)
- end
- end
- end
- GameEvents.PlayerDoTurn.Add(GreaterEurope_ConcertHall)
- GameEvents.UnitSetXY.Add(GreaterEurope_ConcertHall)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement