Starsector API
Loading...
Searching...
No Matches
RepLevel.java
Go to the documentation of this file.
1
package
com.fs.starfarer.api.campaign;
2
3
public
enum
RepLevel
{
4
5
VENGEFUL
(
"Vengeful"
, getT4(), 1f),
6
HOSTILE
(
"Hostile"
, getT3(), getT4()),
7
INHOSPITABLE
(
"Inhospitable"
, getT2(), getT3()),
8
SUSPICIOUS
(
"Suspicious"
, getT1(), getT2()),
9
NEUTRAL
(
"Neutral"
, 0, getT1()),
10
FAVORABLE
(
"Favorable"
, getT1(), getT2()),
11
WELCOMING
(
"Welcoming"
, getT2(), getT3()),
12
FRIENDLY
(
"Friendly"
, getT3(), getT4()),
13
COOPERATIVE
(
"Cooperative"
, getT4(), 1f);
14
15
16
private
final
String displayName;
17
private
final
float
max;
18
private
final
float
min;
19
private
RepLevel
(String displayName,
float
min,
float
max) {
20
this.displayName = displayName;
21
this.min = min;
22
this.max = max;
23
}
24
public
String
getDisplayName
() {
25
return
displayName;
26
}
27
28
public
RepLevel
getOneBetter
() {
29
if
(
this
== VENGEFUL)
return
HOSTILE;
30
if
(
this
== HOSTILE)
return
INHOSPITABLE;
31
if
(
this
== INHOSPITABLE)
return
SUSPICIOUS;
32
if
(
this
== SUSPICIOUS)
return
NEUTRAL;
33
if
(
this
== NEUTRAL)
return
FAVORABLE;
34
if
(
this
== FAVORABLE)
return
WELCOMING;
35
if
(
this
== WELCOMING)
return
FRIENDLY;
36
if
(
this
== FRIENDLY)
return
COOPERATIVE;
37
38
return
COOPERATIVE;
39
}
40
41
public
RepLevel
getOneWorse
() {
42
if
(
this
== HOSTILE)
return
VENGEFUL;
43
if
(
this
== INHOSPITABLE)
return
HOSTILE;
44
if
(
this
== SUSPICIOUS)
return
INHOSPITABLE;
45
if
(
this
== NEUTRAL)
return
SUSPICIOUS;
46
if
(
this
== FAVORABLE)
return
NEUTRAL;
47
if
(
this
== WELCOMING)
return
FAVORABLE;
48
if
(
this
== FRIENDLY)
return
WELCOMING;
49
if
(
this
== COOPERATIVE)
return
FRIENDLY;
50
51
return
VENGEFUL;
52
}
53
58
public
float
getMin
() {
59
return
min;
60
}
65
public
float
getMax
() {
66
return
max;
67
}
68
public
boolean
isAtWorst
(
RepLevel
level) {
69
return
ordinal() >= level.ordinal();
70
}
71
public
boolean
isAtBest
(
RepLevel
level) {
72
return
ordinal() <= level.ordinal();
73
}
74
75
public
boolean
isNeutral
() {
76
return
this
== NEUTRAL;
77
}
78
79
public
boolean
isPositive
() {
80
return
isAtWorst(
RepLevel
.
FAVORABLE
);
81
}
82
83
public
boolean
isNegative
() {
84
return
isAtBest(
RepLevel
.
SUSPICIOUS
);
85
}
86
87
private
static
final
float
T1 = 0.09f;
88
private
static
final
float
T2 = 0.24f;
89
private
static
final
float
T3 = 0.49f;
90
private
static
final
float
T4 = 0.74f;
91
// private static final float T1 = 0.1f;
92
// private static final float T2 = 0.25f;
93
// private static final float T3 = 0.5f;
94
// private static final float T4 = 0.75f;
95
public
static
RepLevel
getLevelFor
(
float
r) {
96
if
(r >= 0) {
97
int
rel = getRepInt(r);
98
if
(rel <= getRepInt(T1))
return
NEUTRAL;
99
if
(rel <= getRepInt(T2))
return
FAVORABLE;
100
if
(rel <= getRepInt(T3))
return
WELCOMING;
101
if
(rel <= getRepInt(T4))
return
FRIENDLY;
102
return
COOPERATIVE;
103
}
else
{
104
r = -r;
105
int
rel = getRepInt(r);
106
if
(rel <= getRepInt(T1))
return
NEUTRAL;
107
if
(rel <= getRepInt(T2))
return
SUSPICIOUS;
108
if
(rel <= getRepInt(T3))
return
INHOSPITABLE;
109
if
(rel <= getRepInt(T4))
return
HOSTILE;
110
return
VENGEFUL;
111
}
112
}
113
114
public
static
int
getRepInt
(
float
f) {
115
return
(
int
) Math.round(f * 100f);
116
}
117
118
public
static
float
getT1
() {
119
return
T1;
120
}
121
public
static
float
getT2
() {
122
return
T2;
123
}
124
public
static
float
getT3
() {
125
return
T3;
126
}
127
public
static
float
getT4
() {
128
return
T4;
129
}
130
131
132
}
133
134
135
136
137
com.fs.starfarer.api.campaign.RepLevel
Definition
RepLevel.java:3
com.fs.starfarer.api.campaign.RepLevel.HOSTILE
HOSTILE
Definition
RepLevel.java:6
com.fs.starfarer.api.campaign.RepLevel.getDisplayName
String getDisplayName()
Definition
RepLevel.java:24
com.fs.starfarer.api.campaign.RepLevel.FAVORABLE
FAVORABLE
Definition
RepLevel.java:10
com.fs.starfarer.api.campaign.RepLevel.WELCOMING
WELCOMING
Definition
RepLevel.java:11
com.fs.starfarer.api.campaign.RepLevel.SUSPICIOUS
SUSPICIOUS
Definition
RepLevel.java:8
com.fs.starfarer.api.campaign.RepLevel.COOPERATIVE
COOPERATIVE
Definition
RepLevel.java:13
com.fs.starfarer.api.campaign.RepLevel.getT2
static float getT2()
Definition
RepLevel.java:121
com.fs.starfarer.api.campaign.RepLevel.isNeutral
boolean isNeutral()
Definition
RepLevel.java:75
com.fs.starfarer.api.campaign.RepLevel.getLevelFor
static RepLevel getLevelFor(float r)
Definition
RepLevel.java:95
com.fs.starfarer.api.campaign.RepLevel.getT1
static float getT1()
Definition
RepLevel.java:118
com.fs.starfarer.api.campaign.RepLevel.getMin
float getMin()
Definition
RepLevel.java:58
com.fs.starfarer.api.campaign.RepLevel.getT3
static float getT3()
Definition
RepLevel.java:124
com.fs.starfarer.api.campaign.RepLevel.isPositive
boolean isPositive()
Definition
RepLevel.java:79
com.fs.starfarer.api.campaign.RepLevel.FRIENDLY
FRIENDLY
Definition
RepLevel.java:12
com.fs.starfarer.api.campaign.RepLevel.VENGEFUL
VENGEFUL
Definition
RepLevel.java:5
com.fs.starfarer.api.campaign.RepLevel.getRepInt
static int getRepInt(float f)
Definition
RepLevel.java:114
com.fs.starfarer.api.campaign.RepLevel.INHOSPITABLE
INHOSPITABLE
Definition
RepLevel.java:7
com.fs.starfarer.api.campaign.RepLevel.isAtWorst
boolean isAtWorst(RepLevel level)
Definition
RepLevel.java:68
com.fs.starfarer.api.campaign.RepLevel.isAtBest
boolean isAtBest(RepLevel level)
Definition
RepLevel.java:71
com.fs.starfarer.api.campaign.RepLevel.isNegative
boolean isNegative()
Definition
RepLevel.java:83
com.fs.starfarer.api.campaign.RepLevel.getOneBetter
RepLevel getOneBetter()
Definition
RepLevel.java:28
com.fs.starfarer.api.campaign.RepLevel.getMax
float getMax()
Definition
RepLevel.java:65
com.fs.starfarer.api.campaign.RepLevel.getT4
static float getT4()
Definition
RepLevel.java:127
com.fs.starfarer.api.campaign.RepLevel.NEUTRAL
NEUTRAL
Definition
RepLevel.java:9
com.fs.starfarer.api.campaign.RepLevel.getOneWorse
RepLevel getOneWorse()
Definition
RepLevel.java:41
src
com
fs
starfarer
api
campaign
RepLevel.java
Generated by
1.9.8