mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-01-06 03:29:51 +01:00
Merge branch 'rangefix' into nut_arulir_mountain
This commit is contained in:
@@ -79,9 +79,11 @@
|
||||
"category":"food",
|
||||
"description":"Even fly larvae have died eating this.",
|
||||
"useEffect":{
|
||||
|
||||
|
||||
"increaseCurrentHP":{
|
||||
"min":-10,
|
||||
"max":-15
|
||||
"min":-15,
|
||||
"max":-10
|
||||
},
|
||||
"conditionsSource":[
|
||||
{
|
||||
|
||||
@@ -47,10 +47,18 @@ public final class ResourceParserUtils {
|
||||
public static ConstRange parseConstRange(JSONObject o) throws JSONException {
|
||||
if (o == null) return null;
|
||||
|
||||
return new ConstRange(
|
||||
ConstRange ret = new ConstRange(
|
||||
o.getInt(JsonFieldNames.Range.max),
|
||||
o.optInt(JsonFieldNames.Range.min)
|
||||
);
|
||||
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
|
||||
if (ret.current > ret.max) {
|
||||
L.log("WARNING: Detected range where max value is lower than current value");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static final ConstRange always = one;
|
||||
|
||||
@@ -25,6 +25,7 @@ public final class ConstRange {
|
||||
}
|
||||
public String toMinMaxAbsString() {
|
||||
if (isMax()) return Integer.toString(Math.abs(max));
|
||||
else if (current < 0) return Math.abs(max) + "-" + Math.abs(current);
|
||||
else return Math.abs(current) + "-" + Math.abs(max);
|
||||
}
|
||||
public boolean isMax() { return max == current; }
|
||||
|
||||
Reference in New Issue
Block a user