Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.78 KB | None | 0 0
  1. -- Austria Hungary Functions
  2. -- Author: TarcisioCM
  3. -- DateCreated: 7/23/2014 11:23:53 AM
  4. --------------------------------------------------------------
  5.  
  6. print ("Gott erhalte Franz den Kaiser!")
  7.  
  8. function GreaterEurope_AHtrait(playerID)
  9.     local player = Players[playerID]
  10.     if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_AUSTRIA_HUNGARY"] and player:IsAlive() then -- [Change the civ name]
  11.         for city in player:Cities() do
  12.             --Refresh to see if any puppet city has been annexed.
  13.             city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETFOODDUMMY"], 0)
  14.             city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETDUMMY"], 0)
  15.            
  16.             --Dummy to get the food difference of puppet cities, it will create dummy buildings in that city equal to the food surplus.
  17.             if city:IsPuppet() then
  18.                 city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], 0) -- Just making sure this is removed
  19.                 local PuppetFood = city:FoodDifference()
  20.                 city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETFOODDUMMY"], PuppetFood)   
  21.                 city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PUPPETDUMMY"], 1)
  22.             end
  23.             --Giving the puppet bonus for non-puppet cities.
  24.             local productionBonus = player:GetBuildingClassCount(GameInfoTypes["BUILDINGCLASS_GE_AUSTRIAHUNGARY_PUPPETFOODDUMMY"]) / 3 --[Change the "3" to decide how much food is required per production bonus.]
  25.             local numPuppets = player:GetBuildingClassCount(GameInfoTypes["BUILDINGCLASS_GE_AUSTRIAHUNGARY_PUPPETDUMMY"])
  26.             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.
  27.             if not(city:IsPuppet()) then
  28.                 local currentPoints = city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"])
  29.                 local pointIncrease = numPuppets + currentPoints
  30.                 city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], pointIncrease) -- WeLoveTheKingDay points for each puppet city.
  31.                 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]
  32.                 if city:GetWeLoveTheKingDayCounter() == 0 then
  33.                     city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], pointIncrease) -- WeLoveTheKingDay points for each puppet city.
  34.                     if city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"]) >= pointLimit then
  35.                         city:SetWeLoveTheKingDayCounter(20) --[Set the number of turns this city have the WeLoveTheKingDay, default is 20]
  36.                         --Warning the player
  37.                         if player:IsHuman() then
  38.                             local cityName = city:GetName()
  39.                             local description = Locale.ConvertTextKey('TXT_KEY_GE_WELOVETHEKINGDAY_EVENT', cityName)
  40.                             local descriptionShort = Locale.ConvertTextKey("TXT_KEY_GE_WELOVETHEKINGDAY_EVENT_SHORT", cityName)
  41.                             player:AddNotification(NotificationTypes["NOTIFICATION_GENERIC"], description, descriptionShort)
  42.                         end
  43.                     end
  44.                 end
  45.                 if city:GetWeLoveTheKingDayCounter() > 0 then
  46.                     city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], 0) -- Remove the WeLoveTheKingDay points.
  47.                     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.
  48.                     if city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_PRODUCTIONDUMMY"]) > 30 then -- [If you change the 25 below change it here too]
  49.                         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]
  50.                     end
  51.                 end
  52.             end
  53.         end
  54.     end
  55. end
  56. GameEvents.PlayerDoTurn.Add(GreaterEurope_AHtrait)
  57.  
  58.  GreaterEurope_ConcertHall(playerID)
  59.         local player = Players[playerID]
  60.         if player:IsAlive() and player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_AUSTRIA_HUNGARY"] then -- Change civ
  61.                 for city in player:Cities() do
  62.                         local plot = city:Plot()
  63.                         for i = 0, plot:GetNumUnits() - 1, 1 do
  64.                                 if not(plot:GetUnit(i):IsHasPromotion(GameInfoTypes["PROMOTION_GE_SPAWNINGDUMMY"])) then
  65.                                         local unit = plot:GetUnit()
  66.                                         if city:IsHasBuilding(GameInfoTypes["BUILDING_AUSTRIA_HUNGARY_CONCERTHALL"]) then -- Change building
  67.                                                 if city:GetNumGreatWorksInBuilding(GameInfoTypes["BUILDINGCLASS_OPERAHOUSE"]) == 2 then -- no need to change this is buildingclass
  68.                                                         local currentPoints = city:GetNumBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"])
  69.                                                         city:SetNumRealBuilding(GameInfoTypes["BUILDING_GE_AUSTRIAHUNGARY_WLTKDPOINTS"], currentPoints + 3) -- Change "3" for desired ammount of day points per unit
  70.                                                         unit:ChangeExperience(15) -- exp that units gain
  71.                                                 end
  72.                                         end
  73.                                 end
  74.                         end
  75.                 end
  76.                 for unit in player:Units() do
  77.                         unit:SetHasPromotion(GameInfoTypes["PROMOTION_GE_SPAWNINGDUMMY"], true)
  78.                 end
  79.         end
  80. end
  81. GameEvents.PlayerDoTurn.Add(GreaterEurope_ConcertHall)
  82. GameEvents.UnitSetXY.Add(GreaterEurope_ConcertHall)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement