-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResourceManager.java
More file actions
71 lines (57 loc) · 2.06 KB
/
ResourceManager.java
File metadata and controls
71 lines (57 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//package Bla1AI;
import com.springrts.ai.oo.clb.Resource;
/**
* Returns information on the economy of the AI.
*
* @author Richard Nai
* @version (a version number or a date)
*/
public class ResourceManager
{
int teamid;
public ResourceManager(int teamID){
teamid = teamID;
}
public float getMetalIncome(){
return CallbackHelper.getCallback().getGame().getTeamResourceIncome(teamid, 0);
}
public float getMetalUsage(){
return CallbackHelper.getCallback().getGame().getTeamResourceUsage(teamid, 0);
}
public float getMetalUsagePercentage(){
return getMetalIncome()/getMetalUsage();
}
public float getEnergyIncome(){
return CallbackHelper.getCallback().getGame().getTeamResourceIncome(teamid, 1);
}
public float getEnergyUsage(){
return CallbackHelper.getCallback().getGame().getTeamResourceUsage(teamid, 1);
}
public float getEnergyUsagePercentage(){
return getEnergyIncome()/getEnergyUsage();
}
public float getCurrentMetal(){
return CallbackHelper.getCallback().getGame().getTeamResourceCurrent(teamid, 0);
}
public float getCurrentMetalMax(){
return CallbackHelper.getCallback().getGame().getTeamResourceStorage(teamid, 0);
}
public float getCurrentMetalStoragePercentage(){
return getCurrentMetal()/getCurrentMetalMax();
}
public float getCurrentEnergy(){
return CallbackHelper.getCallback().getGame().getTeamResourceCurrent(teamid, 1);
}
public float getCurrentEnergyMax(){
return CallbackHelper.getCallback().getGame().getTeamResourceStorage(teamid, 1);
}
public float getCurrentEnergyStoragePercentage(){
return getCurrentEnergy()/getCurrentEnergyMax();
}
public static Resource getMetalReference(){
return CallbackHelper.getCallback().getResourceByName("Metal");
}
public static Resource getEnergyReference(){
return CallbackHelper.getCallback().getResourceByName("Energy");
}
}