forked from MagicBane/Server
starting of new power manager
This commit is contained in:
@@ -66,4 +66,44 @@ public class Power {
|
||||
public boolean isProjectile = false;
|
||||
public HashMap<String, Float> conditions = new HashMap<>();
|
||||
|
||||
public int getRecycleTime(int trains) { // returns cast time in ms
|
||||
if (this.curves.get("RECYCLETIME") != null)
|
||||
return (int) (((this.recycle_time + (this.curves.get("RECYCLETIME").getValue() * trains)) * 1000) + getCastTime(trains));
|
||||
else
|
||||
return (int) (((this.recycle_time * (1 + (this.curves.get("RECYCLETIME").getValue() * trains))) * 1000) + getCastTime(trains));
|
||||
}
|
||||
public int getCastTime(int trains) { // returns cast time in ms
|
||||
if (this.curves.get("INITTIME") != null)
|
||||
return (int) ((this.init_time + (this.curves.get("INITTIME").getValue() * trains)) * 1000);
|
||||
else
|
||||
return (int) ((this.init_time * (1 + (this.curves.get("INITTIME").getValue() * trains))) * 1000);
|
||||
}
|
||||
|
||||
public boolean allowedInCombat() {
|
||||
switch(castingMode.name()){
|
||||
case "NONE":
|
||||
case "BOTH":
|
||||
case "COMBAT":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean allowedOutOfCombat() {
|
||||
switch(castingMode.name()){
|
||||
case "NONE":
|
||||
case "BOTH":
|
||||
case "NONCOMBAT":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public float getCost(int trains) {
|
||||
if (this.curves.get("COSTAMT") != null)
|
||||
return this.cost + (float)(this.curves.get("COSTAMT").getValue() * trains);
|
||||
else
|
||||
return this.cost * (1 + (float)(this.curves.get("COSTAMT").getValue() * trains));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user