Starsector API
Loading...
Searching...
No Matches
MilitaryCustomBounty.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.missions.cb;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import com.fs.starfarer.api.campaign.econ.MarketAPI;
7import com.fs.starfarer.api.impl.campaign.ids.Factions;
8import com.fs.starfarer.api.impl.campaign.ids.Ranks;
9import com.fs.starfarer.api.impl.campaign.ids.Tags;
10import com.fs.starfarer.api.util.Misc;
11
13
14 public static List<CustomBountyCreator> CREATORS = new ArrayList<CustomBountyCreator>();
15 static {
16 CREATORS.add(new CBPirate());
17 CREATORS.add(new CBDeserter());
18 CREATORS.add(new CBDerelict());
19 CREATORS.add(new CBMerc());
20 CREATORS.add(new CBPather());
21 CREATORS.add(new CBRemnant());
22 CREATORS.add(new CBRemnantPlus());
23 CREATORS.add(new CBRemnantStation());
24 CREATORS.add(new CBEnemyStation());
25 }
26
27 @Override
28 public List<CustomBountyCreator> getCreators() {
29 return CREATORS;
30 }
31
32 @Override
33 protected boolean create(MarketAPI createdAt, boolean barEvent) {
34 if (Factions.PIRATES.equals(createdAt.getFaction().getId())) {
35 return false;
36 }
37 return super.create(createdAt, barEvent);
38 }
39
40 @Override
41 protected void createBarGiver(MarketAPI createdAt) {
42 List<String> posts = new ArrayList<String>();
43 if (Misc.isMilitary(createdAt)) {
44 posts.add(Ranks.POST_BASE_COMMANDER);
45 }
46 if (Misc.hasOrbitalStation(createdAt)) {
47 posts.add(Ranks.POST_STATION_COMMANDER);
48 }
49 if (posts.isEmpty()) {
50 posts.add(Ranks.POST_GENERIC_MILITARY);
51 }
52 String post = pickOne(posts);
53 setGiverPost(post);
54 if (post.equals(Ranks.POST_GENERIC_MILITARY)) {
55 setGiverRank(Ranks.SPACE_COMMANDER);
56 setGiverImportance(pickImportance());
57 } else if (post.equals(Ranks.POST_BASE_COMMANDER)) {
58 setGiverRank(Ranks.GROUND_COLONEL);
59 setGiverImportance(pickImportance());
60 } else if (post.equals(Ranks.POST_STATION_COMMANDER)) {
61 setGiverRank(Ranks.SPACE_CAPTAIN);
62 setGiverImportance(pickHighImportance());
63 }
64 setGiverTags(Tags.CONTACT_MILITARY);
65 findOrCreateGiver(createdAt, false, false);
66 setGiverIsPotentialContactOnSuccess();
67 }
68
69
70}
71
72
73
74
75
76
77
78
79
80
81