Starsector API
Loading...
Searching...
No Matches
LuddicChurchStandardActivityCause.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.events;
2
3import com.fs.starfarer.api.Global;
4import com.fs.starfarer.api.campaign.FactionAPI;
5import com.fs.starfarer.api.campaign.StarSystemAPI;
6import com.fs.starfarer.api.campaign.econ.MarketAPI;
7import com.fs.starfarer.api.impl.campaign.ids.Conditions;
8import com.fs.starfarer.api.impl.campaign.ids.Factions;
9import com.fs.starfarer.api.ui.TooltipMakerAPI;
10import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipCreator;
11import com.fs.starfarer.api.util.Misc;
12
14
15 public static float MAX_MAG = 0.3f;
16
20
21 @Override
22 public TooltipCreator getTooltip() {
23 return new BaseFactorTooltip() {
24 public void createTooltip(TooltipMakerAPI tooltip, boolean expanded, Object tooltipParam) {
25 float opad = 10f;
26 tooltip.addPara("Negotiating with the Luddic Church about controlling the "
27 + "immigration of the faithful to your colonies "
28 + "is likely to get this harassment to stop. If "
29 + "left unchecked, this low-grade conflict will eventually come to a head and is likely to "
30 + "be resolved one way or another.", 0f, Misc.getHighlightColor(),
31 "Negotiating");
32
33 FactionAPI f = Global.getSector().getFaction(Factions.LUDDIC_CHURCH);
34 tooltip.addPara("Event progress value is based on the number and size of colonies "
35 + "with the \"Luddic Majority\" condition.", opad, f.getBaseUIColor(),
36 "Luddic Majority");
37 }
38 };
39 }
40
41 public int getProgress() {
44
45
46 int score = 0;
47 for (MarketAPI market : Misc.getPlayerMarkets(false)) {
48 if (!market.hasCondition(Conditions.LUDDIC_MAJORITY)) continue;
49
50 int size = market.getSize();
51 score += size;
52// if (size <= 4) {
53// score += size * 2;
54// } else if (size == 5) {
55// score += size * 2 + 2;
56// } else if (size == 6) {
57// score += size * 2 + 4;
58// } else {
59// score += size * 3;
60// }
61 }
62
63 int progress = score;
64
65 return progress;
66 }
67
68
69 public String getDesc() {
70 return "Colonies with a Luddic Majority";
71 }
72
73
74 public float getMagnitudeContribution(StarSystemAPI system) {
75 //if (KantaCMD.playerHasProtection()) return 0f;
76 if (getProgress() <= 0) return 0f;
77
78 float total = 0f;
79 for (MarketAPI market : Misc.getMarketsInLocation(system, Factions.PLAYER)) {
80 if (!market.hasCondition(Conditions.LUDDIC_MAJORITY)) continue;
81 total += market.getSize();
82 }
83
84 float f = total / 6f;
85 if (f > 1f) f = 1f;
86
87 return f * MAX_MAG;
88 }
89
90}
91
92
93
94
95
96
97
98
static SectorAPI getSector()
Definition Global.java:59