Starsector API
Loading...
Searching...
No Matches
FactionPersonalityPickerPluginImpl.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.campaign.FactionAPI;
6import com.fs.starfarer.api.impl.campaign.ids.Personalities;
7import com.fs.starfarer.api.plugins.FactionPersonalityPickerPlugin;
8import com.fs.starfarer.api.ui.TooltipMakerAPI;
9import com.fs.starfarer.api.util.Misc;
10import com.fs.starfarer.api.util.WeightedRandomPicker;
11
12public class FactionPersonalityPickerPluginImpl implements FactionPersonalityPickerPlugin {
13
14 public WeightedRandomPicker<String> createPersonalityPicker(FactionAPI faction) {
15 int aggression = faction.getDoctrine().getAggression();
16
17 WeightedRandomPicker<String> result = new WeightedRandomPicker<String>();
18 if (aggression == 1) {
19 result.add(Personalities.CAUTIOUS, 20);
20 //result.add(Personalities.CAUTIOUS, 10);
21 //result.add(Personalities.STEADY, 10);
22 } else if (aggression == 2) {
23 result.add(Personalities.STEADY, 20);
24 } else if (aggression == 3) {
25 result.add(Personalities.AGGRESSIVE, 20);
26 } else if (aggression == 4) {
27 result.add(Personalities.AGGRESSIVE, 10);
28 result.add(Personalities.RECKLESS, 10);
29 } else if (aggression == 5) {
30 result.add(Personalities.RECKLESS, 20);
31 }
32
33 return result;
34 }
35
36 public void addDescToTooltip(TooltipMakerAPI tooltip, int level) {
37 float opad = 10f;
38
39 Color pH = Misc.getHighlightColor();
40 if (level == 1) {
41 tooltip.addPara("%s officers and ship commanders.", opad,
42 pH, "Cautious");
43 } else if (level == 2) {
44 tooltip.addPara("%s officers and ship commanders.", opad, pH, "Steady");
45 } else if (level == 3) {
46 tooltip.addPara("%s officers and ship commanders.", opad, pH, "Aggressive");
47 } else if (level == 4) {
48 tooltip.addPara("A mix of %s and %s officers and ship commanders.", opad,
49 pH, "aggressive", "reckless");
50 } else if (level == 5) {
51 tooltip.addPara("%s officers and ship commanders.", opad, pH, "Reckless");
52 }
53 }
54
55}