Home › Dev CE (experimental) › PlayerReligion

Experimental: needs Dev CE (fork of the Community Extension, release zip and source). A GameCore that adds these Lua methods by calling engine functions directly. Not part of the upstream Community Extension, single-player testing only. Descriptions on these pages were written by an AI assistant from decompiled code and are marked inferred unless a test result confirms them.

PlayerReligion

21 methods (Dev CE test build). this is found with the game's own IPlayerReligion instance resolver (plain).

Method Signature Purpose (AI-written, inferred) Tested Engine function Current
AddBeliefYield PlayerReligion:AddBeliefYield(eBeliefYieldType: integer, eYield: integer, iAmount: integer, iPerXItems: integer, eDistrict: integer) Appends a belief yield record (type, yield, amount, per-X-items, district) to the player's belief yield list at offset 0x130. plumbing ✓
this ✓ (oracle)
— 0x3131b0
AddReligiousBuildingModifier PlayerReligion:AddReligiousBuildingModifier(eYield: integer, iMultiplier: integer, bFounderOnly: boolean) Appends an entry (yield, multiplier, founder-only flag) to the religious building modifier vector at offset 0x160. plumbing ✓
this ✓ (oracle)
— 0x313220
CheckNewPurchases PlayerReligion:CheckNewPurchases(xFaithIncome: number (fixed point, 1/256 steps)) If notifications are enabled for the player, scans units and buildings for faith purchases newly affordable with income and sends notifications. Decompilation is truncated before the building part ends. plumbing ✓
this ✓ (oracle)
— 0x314080
DoReligion PlayerReligion:DoReligion() Per-turn religion update: computes faith yield, checks new purchases, changes faith balance, flags AI to found a religion when affordable, spreads religion and updates city religions. plumbing ✓
this ✓ (oracle)
— 0x314c80
GetEnableWallAttackWholeGameSameReligionPromotionClass PlayerReligion:GetEnableWallAttackWholeGameSameReligionPromotionClass(ePromotionClass: integer) → boolean Checks whether the per-promotion-class count array at 0x2f0 is positive for the given class. plumbing ✓
this ✓ (oracle)
— 0x3150c0
GetFaithFromPeacefulReligionFounders PlayerReligion:GetFaithFromPeacefulReligionFounders() → number Counts met (or self) players that founded a religion and are not at war with any major civ, and multiplies by a per-player faith amount at offset 0x230. plumbing ✓
this ✓ (oracle)
— 0x315100
GetReligiousBuildingYieldMultiplier PlayerReligion:GetReligiousBuildingYieldMultiplier(eYield: integer, bIsFounder: boolean) → number Sums multipliers in the modifier vector at 0x170 matching the yield, including founder-only entries only if bIsFounder. plumbing ✓
this ✓ (oracle)
— 0x315610
GetSpreadModifier PlayerReligion:GetSpreadModifier() → number Returns the spread modifier at 0x248, plus an extra at 0x278 if the player has the tech stored at 0x260. plumbing ✓
this ✓ (oracle)
— 0x315650
GetUnitsReligionStrengthByReligion PlayerReligion:GetUnitsReligionStrengthByReligion(eReligion: integer) → number Looks up the religion definition and returns the entry in the per-religion strength array at 0x3f0. plumbing ✓
this ✓ (oracle)
— 0x3156a0
GetWorshipBuilding PlayerReligion:GetWorshipBuilding() → number Returns the first worship building type of the religion created by the owner, or -1 if none. plumbing ✓
this ✓ (oracle)
— 0x3156f0
GetYieldFromBeliefs PlayerReligion:GetYieldFromBeliefs(eYield: integer) → number Sums belief yield records matching the yield, scaling amount by a count (cities, followers, foreign, districts, wonders) divided by per-X value. plumbing ✓
this ✓ (oracle)
— 0x315740
HasReligiousFoundingUnit PlayerReligion:HasReligiousFoundingUnit() → boolean Returns true if the owner has at least one unit of a type flagged as religion founding (flag 0x4 at offset 0x1b9). plumbing ✓
this ✓ (oracle)
— 0x315900
IsReligionCreatedBy PlayerReligion:IsReligionCreatedBy(eReligion: integer, ePlayer: integer) → boolean Checks whether the owner's created religion matches the given religion type and the given founding player. plumbing ✓
this ✓ (oracle)
— 0x315b30
SetAdoptsAllyFoundedReligions PlayerReligion:SetAdoptsAllyFoundedReligions(bshouldAdopt: boolean) Sets the flag at offset 0x398 for adopting ally-founded religions. plumbing ✓
this ✓ (oracle)
— 0x316060
SetFaithRateChange PlayerReligion:SetFaithRateChange(xNewValue: number (fixed point, 1/256 steps)) If the new value differs from the current faith rate change at 0xc8, assigns it at 0xb8 and sends a reporting event. plumbing ✓
this ✓ (oracle)
— 0x316120
SetGainsAllFollowerBeliefs PlayerReligion:SetGainsAllFollowerBeliefs(bNewValue: boolean) Sets the gains-all-follower-beliefs flag at offset 0x1f0. plumbing ✓
this ✓ (oracle)
— 0x316180
SetGreatPersonFounder PlayerReligion:SetGreatPersonFounder(eGreatPersonIndividual: integer) Stores the great person individual type at offset 0x100 as the religion's founder. plumbing ✓
this ✓ (oracle)
— 0x3161b0
SetLaunchedInquisition PlayerReligion:SetLaunchedInquisition(bNewValue: boolean) Sets the launched-inquisition flag at offset 0x1d8. plumbing ✓
this ✓ (oracle)
— 0x316250
SetSpreadModifier PlayerReligion:SetSpreadModifier(iSpreadMultiplier: integer, eSpreadEnhancingTech: integer, iTechEnabledSpreadMultiplier: integer) Stores the religion spread multiplier, the tech that enhances spread, and the multiplier used once that tech is known. plumbing ✓
this ✓ (oracle)
Player::Religion::SetSpreadModifier 0x3162b0
SetTreatAllyCapitalAsHolyCity PlayerReligion:SetTreatAllyCapitalAsHolyCity(bValue: boolean) Sets the treat-ally-capital-as-holy-city flag at offset 0x3b0. plumbing ✓
this ✓ (oracle)
— 0x316320
SetTreatHolySitesAsHolyCities PlayerReligion:SetTreatHolySitesAsHolyCities(bValue: boolean) Sets the treat-holy-sites-as-holy-cities flag at offset 0x3c8. plumbing ✓
this ✓ (oracle)
— 0x316350

Details

AddBeliefYield

Arguments: eBeliefYieldType — Kind of count the yield scales with; eYield — Yield type granted; iAmount — Amount per unit; iPerXItems — Divisor of items needed per amount; eDistrict — District type for district-based counts

Writes - Belief yield vector (offset 0x130)

Input checks: No validation of any argument.

Multiplayer: may-desync. Risk: medium (appends to synced vector). Confidence of the reading: high.

AddReligiousBuildingModifier

Arguments: eYield — Yield type to modify; iMultiplier — Multiplier amount; bFounderOnly — Whether it applies only to the founder

Writes - Religious building modifier vector (offset 0x160)

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (appends to synced vector). Confidence of the reading: high.

CheckNewPurchases

Arguments: xFaithIncome — Faith income added to current balance to test affordability

Side effects - Sends notifications; dispatches a signal

Input checks: Checks a virtual notification-enabled query; no bounds checks.

Multiplayer: read-only: only sends local notifications, no synced state. Risk: low (notification only). Confidence of the reading: low.

DoReligion

Writes - Faith balance - AI religious flag (bool in Religious AI) - City religion assignment

Side effects - Calls SpreadMyReligion, UpdateNextReligionForCities, CheckNotifications

Input checks: Checks capability and founded-religion state; no explicit input validation.

Multiplayer: may-desync. Risk: high (turn processing of synced religion state). Confidence of the reading: medium.

GetEnableWallAttackWholeGameSameReligionPromotionClass

Arguments: ePromotionClass — Unit promotion class type

Input checks: Checks index != -1 and below array size.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.

GetFaithFromPeacefulReligionFounders

Input checks: Returns the base value when it is not positive.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: medium.

GetReligiousBuildingYieldMultiplier

Arguments: eYield — Yield type to match; bIsFounder — Whether to include founder-only modifiers

Input checks: No validation.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.

GetSpreadModifier

Input checks: Skips tech check if tech is -1.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.

GetUnitsReligionStrengthByReligion

Arguments: eReligion — Religion type

Input checks: Returns 0 for -1; does not check Find result for null.

Multiplayer: read-only: pure getter. Risk: low (pure getter; may crash on invalid religion). Confidence of the reading: medium.

GetWorshipBuilding

Input checks: Checks religion exists and building list non-empty.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.

GetYieldFromBeliefs

Arguments: eYield — Yield type to compute

Input checks: Skips entries with non-positive divisor; unknown count types contribute 0.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: medium.

HasReligiousFoundingUnit

Input checks: No inputs.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: high.

IsReligionCreatedBy

Arguments: eReligion — Religion type to compare; ePlayer — Player to compare with the stored founder

Input checks: Null-checks religion data.

Multiplayer: read-only: pure getter. Risk: low (pure getter). Confidence of the reading: medium.

SetAdoptsAllyFoundedReligions

Arguments: bshouldAdopt — New flag value

Writes - Religion field at offset 0x398

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (writes synced player religion flag). Confidence of the reading: high.

SetFaithRateChange

Arguments: xNewValue — New faith rate change

Writes - Faith rate change (offset 0xb8)

Side effects - Reporting::Event::Send

Input checks: Skips when unchanged.

Multiplayer: may-desync. Risk: medium (writes synced faith rate). Confidence of the reading: high.

SetGainsAllFollowerBeliefs

Arguments: bNewValue — New flag value

Writes - Religion field at offset 0x1f0

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (writes synced player religion flag). Confidence of the reading: high.

SetGreatPersonFounder

Arguments: eGreatPersonIndividual — Great person individual type

Writes - Religion field at offset 0x100

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (writes synced player religion flag). Confidence of the reading: high.

SetLaunchedInquisition

Arguments: bNewValue — New flag value

Writes - Religion field at offset 0x1d8

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (writes synced player religion flag). Confidence of the reading: high.

SetSpreadModifier

Arguments: iSpreadMultiplier — base spread multiplier; eSpreadEnhancingTech — tech that upgrades spread; iTechEnabledSpreadMultiplier — multiplier once the tech is researched

Writes - auto-variable at this+0x238 (spread multiplier) - auto-variable at this+0x250 (enhancing tech) - auto-variable at this+0x268 (tech-enabled multiplier)

Side effects - auto-variable assigns likely mark state dirty

Input checks: None: values are stored unchecked, including an invalid tech type.

Preconditions - gameplay Lua state only - must run on the game thread

Multiplayer: may-desync: direct state write. Risk: low (plain stores, no range check but values only consumed by spread math). Confidence of the reading: medium.

Verified from the code - writes three separate auto-variables at 0x238, 0x250, 0x268 with the three parameters unchanged

Inferred - names come from the Linux debug info, so roles are reliable but consumer code was not read

Open questions - how the spread code applies the two multipliers

SetTreatAllyCapitalAsHolyCity

Arguments: bValue — New flag value

Writes - Religion field at offset 0x3b0

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (writes synced player religion flag). Confidence of the reading: high.

SetTreatHolySitesAsHolyCities

Arguments: bValue — New flag value

Writes - Religion field at offset 0x3c8

Input checks: No validation.

Multiplayer: may-desync. Risk: medium (writes synced player religion flag). Confidence of the reading: high.