Closed pineappledan closed 6 years ago
Same functions are used by Celtic modified UA I've created. There also should be function which checks on conquering city. Look there and tell me if it is what you need. When I have some time (I have long weekend now) I can try add this. Then we could release v31.
Please post here what stats should be given by each stage.
I did a mock-up of what might be a good way to do this.
I created dummy buildings for each policy and 1 dummy building for founder, enhancer and reformation.
Instead of having the policy directly boost the Mono Church, the policy gives a free dummy building in every city. This means that the yield boost from each policy is not shown in the UI anymore, but no actual gameplay change
On found, enhance and reform, set state of religion to 1, 2, or 3, and cycle through every city in the game for cities with that religion. All cities with the religion get the appropriate mono church dummy building.
On convert, game checks the state of the religion (1,2,or 3), and gives the appropriate number of dummy buildings
I did not check the lua. There's parts of it I don't understand how to do, like getting a city ID from plot coordinates, cycling through all cities in the game, and defining/setting a new value for a religion MonolithicChurch2.0.zip
Ok, leave it to me for now. I will try to code something.
One more thing: bonuses should be increased with the number of Monos in the city. Once I tried to count the number of improvements in city but it is probably not possible to achieve. So do you plan to do only one bonus after checking if the Mono is in the city?
Second thing: even if so, code checks all tiles available to get by the city in its range, so it is possible that one Mono can be counted by not one but even two or three cities.
For now policy bonuses scale with the number of improvements and are tied to one city. I think that's why we didn't put that before. I don't remember quite well.
I will try to use pCity:IsWorkingPlot( plot ) function. Maybe it will work.
EDIT: This will not work properly. This plot need to be used by citizen to be counted. I think the best way will be just count all MCs within the range of the city. This will prevent issues with tile ownership change and other issues in cost of using one MC more than once (by few cities).
I will do it only for Ethiopia right?
Of course for now I add bonuses to ALL cities whether they have or not adopted Pantheon or Religion by themselves. It is Empire-wide bonus.
Ok, first part made in Beta branch. Works for now, but maybe not as it was intended in the beginning. What it contains?
Cleaning and setting bonuses again is needed because if player found Pantheon, then loose city, found Religion, recapture city and enhance religion then recaptured city would be missing some buildings from second stage.
Next part is checking everything after capturing city by Ethiopia (it still can have MC in range even if it weren't Ethiopia's city before) and founding new city. Capturing Ethiopian city by another civ will freeze bonuses in state it was before capturing.
After that I will do checking after creating MC or deleteing it.
Anything else regarding religion?
bonuses should be increased with the number of Monos in the city. Once I tried to count the number of improvements in city but it is probably not possible to achieve. So do you plan to do only one bonus after checking if the Mono is in the city?
I don't think we had ever talked about that as a feature before. The main selling point for the mono church was going to be how it improved using religion and policies of whatever civ controlled it. What kind of bonus did you have in mind?
Cleaning and setting bonuses again is needed because if player found Pantheon, then loose city, found Religion, recapture city and enhance religion then recaptured city would be missing some buildings from second stage
You would have to convert the city at some point, and majority religion stays during city conquest. I think any issues with setting the right number of buildings would be caught by the conversion lua hook
We can talk about what the yields on each level should be later, but for comparison: French Chateau comes out at the same tech level Chateau: 3fo, 3go, 2cu 2go, 1cu at flight 1cu at printing press 3fo 5go 4cu total
Monolithic Church possibility: Base: 1 Fa 1 Pr ancient policy : 1Cu Medieval policy: 1 Fa Industrial policy: 1 Sc Ideology : 2 Go founder: 1 Fa Follower (x2): 1 Pr Enhancer: 1 Cu Reformation: 1 Pr, 1 Go so 3Fa/3P/1Sc/2Go/2Cu or 3Fa/4P/1Sc/3Go/2Cu if you reform
If we add a production to industrial, I would recommend making the base improvement +1 Faith only, or the +1 prod from reformation be removed. There are a lot of yields on this improvement already
I cannot add bonuses directly to improvement via lua. The only way I can do that with your suggestion was counting the number of MCs within the range of the city and add such number of dummy buildings. We can do that other way also: we can only check if there's any MC in the range of city and add one big bonus. And that was what I suggested and you quoted 2 post before. Nothing particular, I mean I have not any values in mind.
I will revert production then. No problem.
I don't want to bother with religion checking. The only thing that matters to me for now is level achieved by ethiopia in its religion. If it achieved enhancement and then its religion was purged then still all MCs will give 3 levels of yields (pantheon+religion+enhancement). If we add religion checking then code will be so complicated that I will probably loose control over it at some point.
I still bother if those bonuses would be dependable from pilaging MCs... like Oppidum is.
Now I need to decide what to do if other country conquest city of ethiopia with MCs in range and then delete MC. This would normally check all cities in range of Ethiopia, reset its bonuses and set from the beggining. But it is not Ethiopian city, so religion level can be different. So we need to check both countries? Or maybe only that other country? I want to prevent any exploit. Also if Ethiopia delete MC and other city of other civ had that MC in its range (so it had its bonus) then it also should be calculated, right? That would cause big amount of calculations for every city in the world. I hope you will understand what I mean. In the beginning I thought about freezing yields from MCs in cities captured from Ethiopia. But then player could delete all MCs from its city and bonuses would stay. That's an exploit. Now I think- and it is probably THE BEST way to do this: when Ethiopia loses its city, that city loose all bonuses from MCs, so other country cannot benefit from Ethiopias developement. If city come back to Ethiopia it regains those bonuses. What do you think? Last one is also easiest to code.
Moreover you mention Founder + Follower x2. I don't think there's a way of checking that. I would restrict that (and I coded that way) to Pantheon + Founder. I have no function to track founder beliefs and It would mean no bonuses for ethiopia if it won't found any religion and double bonus every religion stage (Founder+Follower; Enhancer+Follower). I restricted that to one at a time.
Yields:
Part II and III are on Github. You can check them. I hve only policies left to add (mechanics). All works fine for now. When I finish we can talk about modifying eventually. If everything will be ok I will merge it to Master and push update v31.
If you check the sql I wrote, I added sql tables that would add the dummy buildings on each of the policies. There is no need for lua for any of that.
The way faith is added is overly-complicated and harder for players to understand. This is the same thing we did with the Spanish mission. We decided it was better if the mission gave each hacienda faith, instead of adding faith to the building for each hacienda worked. It’s nicer if people can see the yields out on the landscape.
There are two potential ways to have MC work:
All religions give the dummy buildings for MC, regardless of who founds religion. Religions keep track of if they are enhanced/reformed, and each city gets dummy buildings based off that.
All cities everywhere get dummy buildings for MCs whenever Ethiopia founds/enhances/reforms. So the MC yields only increase when Ethiopia progresses.
I think option 1 is better because it is easier to describe, explain, and it doesn’t depend on Ethiopia to get its religion. MC yields scale with any civ using any religion, and only cares what “level” the religion is. It will also be more consistent with how the yields from policies will work.
I looked at your files before. What I saw was code that adds only ONE building (or 999) if player finishes branch. It is not dependable on number of MCs nor civilization. Code for religion was also not dependable on number of MCs. I thought that we aimed for that. If you build MC it adds bonuses to city. Your code suggested that code is one time use and you are not in need of building more MCs because they won't give you anything.
Your version if I understand it correctly need to keep track of each city on the entire map, which is very hard to calculate if you play on huge map where you have hundreds of cities and each city has 36 tiles to check. Moreover you need to keep track of each religion, pantheon etc. Too complicated. I try to find compromise between our ideas, code complexity and needed calculation.
I finished coding. Comments are left for now. It works like:
I tested it and it works. It needs only to be explained in help text properly. It is easy to understand. I hope AI will build them correctly (it has no knowledge about dummy buildings created after construction MC, it can see only yields and the fact it can improve resource. If there will be problems we can adjust flavors).
The table defines the policy that gives the building, the building it gives, and the number of cities that get the building (so I set it to 999 so that all cities get the building). What I had written in SQL would have done the exact same thing as the previous version w.r.t. policies, except it would not have been shown in the UI. That's all.
There are a bunch of issues with how the yields are currently given:
As for the Monolithic churches IRL, they are a source of intense interest for people outside Ethiopia; Lalibela has been called the new Jerusalem. It wouldn't be fair to say that other cultures don't recognize or value these churches. They made it into our mod after all :D.
I really am convinced the best course of action is to allow all civs to benefit from the UI equally, provided they have the requisite policies and religions.
EDIT: I just checked the dummy buildings and you are still using the dummy buildings I created. Those dummy buildings still use the Building_ImprovementYieldChanges table. so a single instance of that building will increase the yields of all MCs in workable radius of the city.
As you have currently written the lua, every MC in range of the city is going to add another copy of that dummy building, so if 2 MC are built near a city, each MC will yield +2 faith (4 faith total). If there are 3 MC, each gets +3 faith (9 faith total). So currently the code gives an exponential increase in yields instead of a flat increase in yields.
It would be simpler, less computationally intense, more visible, and easier for the AI if the yields were applied in the manner I suggest
Ok. I probably understand the issue. I didn't notice that it was giving yields to improvements instead of flat ones. I will try to simplify that, but later.
I analyzed that. I will try ti code that to be dependable on ethiopia's developement. We will see how it works. But as of sql table. What if player conquer city of ethiopia and assume it has no bonuses. Then ethiopia finishes tradition and all city get copy of building boosting mcs. That other country wont get that bonus. It will have its own developement. Moreover this is one time bonus. If it is used and you found new cities they won't get the dummy. It will get only next branch finishers. And last there's something wrong with the TRADITION_FINISHER (etc) policy. Lua couldn't find such thing. I needed to check if branch is completed via special lua function and then it worked.
I will fix the number of dummies. Now it will check if city has ANY mc in its range and add appropriate dummy. Any change to any mc city foundation etc will scan through cities and will set values according to Ethiopias level of developement. It shouldn't be much work but I will need to sit and anylize it carefully later.
I agree that current version is very unfair for other civs. With version dependable on Ethiopias developent even country without religion will benefit of MC. With separate decelopement it will be punished even more for not having that and remember theres half of civs that do not have religion.
Ok, reworked. Now it works like:
Really simple and imo more interesting that (much more) complicated version with MC dependable on every civ developement level 9more constants to track, more resetting, building changes, substituting etc). And for sure better than previous one I created.
There's no need of checking tile changes (buildings update MC yields continuously) or conquering city (because all cities have same bonuses related to ethiopia). If city has no MC in its territory then dummies do nothing at all.
Tile porn is saved, every yield is shown in tooltip, player will not miss anything.
It was not so much work. Comments still are in the code and I didn't change MC texts so if you accept such composition I will clean everything and push to master.
What do you think? Better?
definitely better. Means there's a big punishment for wiping ethiopia out completely, instead of vassalizing him. this also avoids any weird interactions with Byzantium
I'm glad you like it. Now I know why we didn't make this before. It was tough.
What do you mean by interaction with Byzantium? Can you test it quickly before the update? I want to be sure I didn't miss anything. I tried of course to check it, but you know, it is like checking your own homework.
Tomorrow I will finish job on this and merge all stuff. v31 is closer.
w.r.t. Byzantium, two things this avoids: Not having to explain that this UI does not scale with Byzantium's bonus belief, in case a Byzantine player conquered territory with MCs. If all religions applied the dummy buildings for MCs, not having to code for Byzantium's extra belief
The original idea for the monolithic church was to have 0 tech unlocks for improved yields. Instead, all the upgrades would be unlockable from adopting religious tenets or from policies. The policies were implemented, but the beliefs were not, since it would overwhelm the user interface to list all possible religious tenets.
A solution: A set of dummy buildings which add bonus yields to Mono Church are added to all cities on the map when Ethiopia adopts religious tenets.
Use these lua hooks: GameEvents.PantheonFounded.Add(function(iPlayer, iCapitalCity, iReligion, iBelief1) end) GameEvents.ReligionFounded.Add(function(iPlayer, iHolyCity, iReligion, iBelief1, iBelief2, iBelief3, iBelief4, iBelief5) end) GameEvents.ReligionEnhanced.Add(function(iPlayer, iReligion, iBelief1, iBelief2) end) GameEvents.ReligionReformed.Add(function(iPlayer, iReligion, iBelief1) end)
Then if a city is conquered/settled, it could check the capital and copy whatever dummy buildings are there.
This would solve the UI issue. Mono churches would scale with Ethiopia's religion for all players, so killing Ethiopia before he could improve his religion will make mono churches less valuable.