001package com.fs.starfarer.api.impl.campaign;
002
003import java.awt.Color;
004
005import com.fs.starfarer.api.campaign.FactionAPI;
006import com.fs.starfarer.api.impl.campaign.ids.Personalities;
007import com.fs.starfarer.api.plugins.FactionPersonalityPickerPlugin;
008import com.fs.starfarer.api.ui.TooltipMakerAPI;
009import com.fs.starfarer.api.util.Misc;
010import com.fs.starfarer.api.util.WeightedRandomPicker;
011
012public class FactionPersonalityPickerPluginImpl implements FactionPersonalityPickerPlugin {
013
014        public WeightedRandomPicker<String> createPersonalityPicker(FactionAPI faction) {
015                int aggression = faction.getDoctrine().getAggression();
016                
017                WeightedRandomPicker<String> result = new WeightedRandomPicker<String>();
018                if (aggression == 1) {
019                        result.add(Personalities.CAUTIOUS, 20);
020                        //result.add(Personalities.CAUTIOUS, 10);
021                        //result.add(Personalities.STEADY, 10);
022                } else if (aggression == 2) {
023                        result.add(Personalities.STEADY, 20);
024                } else if (aggression == 3) {
025                        result.add(Personalities.AGGRESSIVE, 20);
026                } else if (aggression == 4) {
027                        result.add(Personalities.AGGRESSIVE, 10);
028                        result.add(Personalities.RECKLESS, 10);
029                } else if (aggression == 5) {
030                        result.add(Personalities.RECKLESS, 20);
031                }
032                
033                return result;
034        }
035
036        public void addDescToTooltip(TooltipMakerAPI tooltip, int level) {
037                float opad = 10f;
038                
039                Color pH = Misc.getHighlightColor();
040                if (level == 1) {
041                        tooltip.addPara("%s officers and ship commanders.", opad,
042                                                        pH, "Cautious");
043                } else if (level == 2) {
044                        tooltip.addPara("%s officers and ship commanders.", opad, pH, "Steady");
045                } else if (level == 3) {
046                        tooltip.addPara("%s officers and ship commanders.", opad, pH, "Aggressive");
047                } else if (level == 4) {
048                        tooltip.addPara("A mix of %s and %s officers and ship commanders.", opad, 
049                                        pH, "aggressive", "reckless");
050                } else if (level == 5) {
051                        tooltip.addPara("%s officers and ship commanders.", opad, pH, "Reckless");
052                }               
053        }
054
055}