1package com.fs.starfarer.api.impl.campaign.econ;
3import java.util.LinkedHashMap;
6import com.fs.starfarer.api.Global;
7import com.fs.starfarer.api.campaign.econ.Industry;
8import com.fs.starfarer.api.campaign.econ.MarketAPI;
9import com.fs.starfarer.api.campaign.econ.MarketImmigrationModifier;
10import com.fs.starfarer.api.impl.campaign.ids.Conditions;
11import com.fs.starfarer.api.impl.campaign.ids.Factions;
12import com.fs.starfarer.api.impl.campaign.ids.Industries;
13import com.fs.starfarer.api.impl.campaign.intel.events.LuddicChurchHostileActivityFactor;
14import com.fs.starfarer.api.impl.campaign.population.PopulationComposition;
15import com.fs.starfarer.api.ui.TooltipMakerAPI;
16import com.fs.starfarer.api.util.Misc;
47 market.addTransientImmigrationModifier(
this);
51 market.getStability().modifyFlat(
id, stability,
"Luddic majority");
55 for (Industry ind :
market.getIndustries()) {
56 if (ind.getSpec().hasTag(Industries.TAG_RURAL) ||
PRODUCTION_OVERRIDES.containsKey(ind.getId())) {
61 if (production != 0) {
62 ind.getSupplyBonusFromOther().modifyFlat(
id, production,
"Luddic majority");
69 market.removeTransientImmigrationModifier(
this);
71 market.getStability().unmodify(
id);
73 for (Industry ind :
market.getIndustries()) {
74 if (ind.getSpec().hasTag(Industries.TAG_RURAL) ||
PRODUCTION_OVERRIDES.containsKey(ind.getId())) {
75 ind.getSupplyBonusFromOther().unmodifyFlat(
id);
83 incoming.add(Factions.LUDDIC_CHURCH, bonus);
84 incoming.getWeight().modifyFlat(
getModId(), bonus,
"Luddic immigration (Luddic majority)");
95 if (
market.isPlayerOwned() &&
96 LuddicChurchHostileActivityFactor.isDefeatedExpedition()) {
104 super.createTooltipAfterDescription(tooltip, expanded);
106 String name =
market.getName();
109 tooltip.addPara(
"A majority of the population of " + name +
" are Luddic faithful. "
110 +
"This may result in a substantial boost "
111 +
"to stability and productivity.", opad);
113 tooltip.addPara(
"For colonies outside the core, it may also result in increased population growth, "
114 +
"from Luddic immigrants seeking to escape the sometimes oppressive influence of the Luddic Church.", opad);
116 tooltip.addPara(
"%s stability",
117 opad, Misc.getHighlightColor(),
120 tooltip.addPara(
"%s production for Farming, Light Industry, and similar",
121 opad, Misc.getHighlightColor(),
124 if (
market.isPlayerOwned()) {
125 tooltip.addPara(
"%s population growth",
126 opad, Misc.getHighlightColor(),
141 boolean madeDeal = LuddicChurchHostileActivityFactor.isMadeDeal() &&
market.isPlayerOwned();
142 boolean freePort =
market.isFreePort();
144 boolean habitable =
market.hasCondition(Conditions.HABITABLE);
146 boolean hasRural =
false;
147 boolean hasIndustrial =
false;
148 boolean hasMilitary =
false;
150 String military =
null;
154 for (Industry ind :
market.getIndustries()) {
155 if (ind.getSpec().hasTag(Industries.TAG_INDUSTRIAL)) {
156 if (heavy ==
null) heavy = ind.getCurrentName();
157 hasIndustrial =
true;
159 if (ind.getSpec().hasTag(Industries.TAG_MILITARY) || ind.getSpec().hasTag(Industries.TAG_COMMAND)) {
160 if (military ==
null) military = ind.getCurrentName();
164 if (ind.getSpec().hasTag(Industries.TAG_RURAL)) {
165 if (rural ==
null) rural = ind.getCurrentName();
173 if (
market.isPlayerOwned()) {
174 tooltip.addPara(
"The following factors result in these bonuses being negated, and, "
175 +
"unless addressed, will result in the \"Luddic Majority\" condition "
176 +
"being removed if the colony increases in size:", opad,
177 Misc.getNegativeHighlightColor(),
"negated",
"removed");
179 tooltip.addPara(
"The following factors result in these bonuses being negated:", opad,
180 Misc.getNegativeHighlightColor(),
"negated",
"removed");
183 tooltip.setBulletedListMode(
" - ");
185 tooltip.addPara(
"Deal made with Luddic Church to curtail immigration", opad);
189 tooltip.addPara(
"The colony is a free port", opad);
193 tooltip.addPara(
"The colony is not habitable", opad);
197 tooltip.addPara(
"The colony has no suitable employment for the faithful, such as farming or light industry", opad);
201 tooltip.addPara(
"The colony has heavy industrial facilities (" + heavy +
")", opad);
205 tooltip.addPara(
"The colony has military facilities (" + military +
")", opad);
208 tooltip.setBulletedListMode(
null);
210 if (
market.isPlayerOwned() && LuddicChurchHostileActivityFactor.isDefeatedExpedition()) {
211 tooltip.addPara(
"The bonus is doubled due to the faithful " +
market.getOnOrAt() +
" " +
212 market.getName() +
" feeling securely out from under the direct "
213 +
"influence of the Luddic Church.", opad, Misc.getPositiveHighlightColor(),
"doubled");
217 tooltip.setBulletedListMode(
" - ");
218 tooltip.setBulletedListMode(
null);
223 if (
market.isPlayerOwned() && LuddicChurchHostileActivityFactor.isMadeDeal())
return false;
228 if (!
market.hasCondition(Conditions.HABITABLE))
return false;
230 boolean hasRural =
false;
231 for (Industry ind :
market.getIndustries()) {
232 if (ind.getSpec().hasTag(Industries.TAG_INDUSTRIAL))
return false;
233 if (ind.getSpec().hasTag(Industries.TAG_MILITARY))
return false;
234 if (ind.getSpec().hasTag(Industries.TAG_COMMAND))
return false;
236 hasRural |= ind.getSpec().hasTag(Industries.TAG_RURAL);
245 return super.getIconName();
static SettingsAPI getSettings()
static float IMMIGRATION_BASE
void modifyIncoming(MarketAPI market, PopulationComposition incoming)
static Map< String, Integer > PRODUCTION_OVERRIDES
static String[] luddicFactions
void createTooltipAfterDescription(TooltipMakerAPI tooltip, boolean expanded)
static boolean matchesBonusConditions(MarketAPI market)
static int BONUS_MULT_DEFEATED_EXPEDITION
static void addConditions(TooltipMakerAPI tooltip, MarketAPI market, float opad)
float getImmigrationBonus(boolean withEffectMult)
static float PRODUCTION_BASE_RURAL
String getSpriteName(String category, String id)