Starsector API
Loading...
Searching...
No Matches
PersonBountyEventData.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.shared;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import com.fs.starfarer.api.impl.campaign.ids.Factions;
7
9
10 private List<String> participatingFactions = new ArrayList<String>();
11
12 private int level = 0;
13 private int successesThisLevel = 0;
14
16 addParticipatingFaction(Factions.HEGEMONY);
17 addParticipatingFaction(Factions.DIKTAT);
18 addParticipatingFaction(Factions.LUDDIC_CHURCH);
19 addParticipatingFaction(Factions.TRITACHYON);
20 addParticipatingFaction(Factions.INDEPENDENT);
21 addParticipatingFaction(Factions.PERSEAN);
22 }
23
24 public void reportSuccess() {
25 successesThisLevel++;
26
27 int threshold = getThresholdForLevel(level);
28 if (successesThisLevel >= threshold) {
29 level++;
30 successesThisLevel = 0;
31 }
32 if (level > 10) level = 10;
33 }
34
35 public int getThresholdForLevel(int level) {
36 if (level == 0) return 2;
37 if (level == 1) return 2;
38 if (level == 2) return 2;
39
40 if (level == 3) return 3;
41 if (level == 4) return 3;
42 if (level == 5) return 3;
43 if (level == 6) return 3;
44
45 if (level == 7) return 4;
46 if (level == 8) return 5;
47 if (level == 9) return 6;
48
49 return 6;
50 }
51
52 public int getLevel() {
53 //if (true) return 10;
54 return level;
55 }
56
57 public void setLevel(int level) {
58 this.level = level;
59 }
60
61 public void setSuccessesThisLevel(int successesThisLevel) {
62 this.successesThisLevel = successesThisLevel;
63 }
64
65 public List<String> getParticipatingFactions() {
66 return participatingFactions;
67 }
68
69 public void addParticipatingFaction(String factionId) {
70 participatingFactions.add(factionId);
71 }
72
73 public void removeParticipatingFaction(String factionId) {
74 participatingFactions.remove(factionId);
75 }
76
77 public boolean isParticipating(String factionId) {
78 return participatingFactions.contains(factionId);
79 }
80}
81