starting of new power manager

This commit is contained in:
2024-09-07 19:57:20 -05:00
parent 1417760f5b
commit aece43a3bc
7 changed files with 391 additions and 8 deletions
+40
View File
@@ -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));
}
}