Prevent vitality moving out of proper range.
This commit is contained in:
@@ -462,12 +462,12 @@ public class PcStat extends PlayableStat
|
||||
{
|
||||
return Math.min(MAX_VITALITY_POINTS, getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).getVitalityPoints());
|
||||
}
|
||||
return Math.min(MAX_VITALITY_POINTS, _vitalityPoints);
|
||||
return Math.min(Math.max(_vitalityPoints, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
|
||||
}
|
||||
|
||||
public int getBaseVitalityPoints()
|
||||
{
|
||||
return Math.min(MAX_VITALITY_POINTS, _vitalityPoints);
|
||||
return Math.min(Math.max(_vitalityPoints, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
|
||||
}
|
||||
|
||||
public double getVitalityExpBonus()
|
||||
@@ -479,10 +479,10 @@ public class PcStat extends PlayableStat
|
||||
{
|
||||
if (getActiveChar().isSubClassActive())
|
||||
{
|
||||
getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).setVitalityPoints(Math.min(MAX_VITALITY_POINTS, value));
|
||||
getActiveChar().getSubClasses().get(getActiveChar().getClassIndex()).setVitalityPoints(value);
|
||||
return;
|
||||
}
|
||||
_vitalityPoints = Math.min(MAX_VITALITY_POINTS, value);
|
||||
_vitalityPoints = Math.min(Math.max(value, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -36,6 +36,9 @@ public final class SubClass
|
||||
private int _vitalityPoints = 0;
|
||||
private boolean _dualClass = false;
|
||||
|
||||
public static final int MAX_VITALITY_POINTS = 140000;
|
||||
public static final int MIN_VITALITY_POINTS = 0;
|
||||
|
||||
public SubClass()
|
||||
{
|
||||
// Used for specifying ALL attributes of a sub class directly,
|
||||
@@ -69,12 +72,12 @@ public final class SubClass
|
||||
|
||||
public int getVitalityPoints()
|
||||
{
|
||||
return _vitalityPoints;
|
||||
return Math.min(Math.max(_vitalityPoints, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
|
||||
}
|
||||
|
||||
public void setVitalityPoints(int value)
|
||||
{
|
||||
_vitalityPoints = value;
|
||||
_vitalityPoints = Math.min(Math.max(value, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user