adaneslavo / More-Unique-Components-for-VP

Adds 3rd and 4th unique component to each civilization.
1 stars 6 forks source link

Lua for Songhai #51

Closed theazuresoul closed 6 years ago

theazuresoul commented 6 years ago

Sofa - need lua for new promotion. essentially a copy of the GG 15% RCS/CS boost if within 2 tiles, but ONLY applies to mounted units. So if mounted unit is in 2 range of a sofa it gets boost Qadi - need lua to convert 10% production to culture in city. The Indian Qila does the exact same thing, but with food, you can lift code from there. Qadi - need lua for 'jizya' effect; 1 Gold for every citizen not following your majority religion.

Infixo commented 6 years ago

Those Qadi effects will not be visible to the player when looking at yields in the city. The AI won't care because it is a UB and it will be produced anyway.

Hokath commented 6 years ago

jizya could be changed to use the existing code for yield per religion in the city. A bit different but has support. The hospital converts food to science, doesnt it. Perhaps something there (maybe it needs to be generalised in the DLL) could be done for this and the Qila

Infixo commented 6 years ago

Hospital uses a particular table Building_ScienceFromYield. And whenever science yields are calculated in the code, there is an exception to handle that. Very bad design. Not to be reused easily, if ever.

pineappledan commented 6 years ago

hospital and hanse use the scienceFromYield table. It's a clunky implementation. A table for YieldsFromPercentYields where you could define an InputYield and an OutputYield would have been much more elegant.

Qila has Food -> Culture lua. Just have to adapt that to production -> culture instead. Should be straightforward

Realized just now that Qadi and Qila UBs both check for the civ before calculating, so their lua are hypothetically incompatible with Rome's UA. This doesn't matter though, because neither building is capturable (castles and courthouses can't be captured :P)

added production conversion to Qadi

pineappledan commented 6 years ago

Added lua for sofa. I don't know if a lua tag exists to check if a unit is mounted or not, so I left a placeholder in the lua called 'GetIsMounted'.

The Sofa lua can't be done using GetUnitCombat because the UNITCOMBAT_ARCHER contains both mounted and unmounted units. Has the IsMounted column in the Units table been exposed to lua?

Infixo commented 6 years ago

The correct syntax is "if pUnit:IsMounted() then", without "Get"

Infixo commented 6 years ago

There are 2 Sofas now...

pineappledan commented 6 years ago

I deleted 1 of the sofa luas

Infixo commented 6 years ago

I reworked Sofa, all is ok now.

pineappledan commented 6 years ago

Still need last Qadi lua, not yet written

Infixo commented 6 years ago

Oh, so that is why somebody asked about Majority religion? There is simply pPlayer:GetMajorityReligion(), it calls GetReligionInMostCities(). But check for NO_RELIGION (-1). Also for cities there is: GetNumFollowers(ReligionTypes eReligion). Note that some citizens may be not religious at all, idk if this effect is for "followers but not your religion" or "anyone not following your religion, even if they don't follow any religion". The second is much easier to implement, the first requires additional for loop.

pineappledan commented 6 years ago

What I had planned was for something like: Gold per turn= (TotalCityPopulation - PopulationFollowing(GetMajorityReligion(Player)))

adaneslavo commented 6 years ago

I asked for religion to Teutonic Order's Chapter promotion btw :P.

Infixo commented 6 years ago

Done.