1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package nl.tudelft.goal.unreal.messages;
21
22 import java.util.logging.Level;
23
24 import nl.tudelft.goal.ut2004.util.Skin;
25 import nl.tudelft.goal.ut2004.util.Team;
26 import cz.cuni.amis.pogamut.base.agent.impl.AgentId;
27 import cz.cuni.amis.pogamut.base.agent.params.IAgentParameters;
28 import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
29 import cz.cuni.amis.pogamut.base3d.worldview.object.Rotation;
30 import cz.cuni.amis.pogamut.ut2004.bot.params.UT2004BotParameters;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 public class BotParameters extends Parameters {
53
54
55 private Level logLevel;
56 private Boolean shouldLeadTarget;
57 private Integer skill;
58 private Skin skin;
59
60
61 @Override
62 public void assignDefaults(IAgentParameters defaults) {
63 super.assignDefaults(defaults);
64
65 if (defaults instanceof BotParameters) {
66 BotParameters parameters = (BotParameters) defaults;
67
68 if (logLevel == null)
69 logLevel = parameters.getLogLevel();
70 if (shouldLeadTarget == null)
71 shouldLeadTarget = parameters.shouldLeadTarget();
72 if (skill == null)
73 skill = parameters.getSkill();
74 if (skin == null)
75 skin = parameters.getSkin();
76 }
77 }
78
79 public Level getLogLevel() {
80 return logLevel;
81 }
82
83 public int getSkill() {
84 return skill;
85 }
86
87 public Skin getSkin() {
88
89 return skin;
90 }
91
92 public BotParameters setLogLevel(Level level) {
93 assert level != null;
94 this.logLevel = level;
95 return this;
96 }
97
98 public BotParameters setShouldLeadTarget(boolean shouldLeadTarget) {
99 this.shouldLeadTarget = shouldLeadTarget;
100 return this;
101 }
102
103
104
105
106
107
108
109
110 public BotParameters setSkill(int skill) {
111
112 this.skill = Math.min(7, Math.max(skill, 0));
113 return this;
114 }
115
116 public BotParameters setSkin(Skin skin) {
117 this.skin = skin;
118 return this;
119 }
120
121
122
123
124
125
126 public BotParameters setTeam(Team team) {
127 super.setTeam(team.id());
128 return this;
129 }
130
131 @Override
132 public BotParameters setInitialLocation(Location location) {
133 super.setInitialLocation(location);
134 return this;
135 }
136
137 @Override
138 public BotParameters setInitialRotation(Rotation rotation) {
139 super.setInitialRotation(rotation);
140 return this;
141 }
142
143 public Boolean shouldLeadTarget() {
144 return shouldLeadTarget;
145 }
146
147 @Override
148 public String toString() {
149 return "BotParameters [logLevel=" + logLevel + ", shouldLeadTarget=" + shouldLeadTarget + ", skill=" + skill
150 + ", skin=" + skin + ", getTeam()=" + getTeam() + ", getWorldAddress()=" + getWorldAddress()
151 + ", getAgentId()=" + getAgentId() + "]";
152 }
153
154 public UT2004BotParameters setAgentId(String agentName) {
155 super.setAgentId(new AgentId(agentName));
156 return this;
157 }
158
159
160 public static BotParameters getDefaults() {
161
162 BotParameters parameters = new BotParameters();
163
164 parameters.logLevel = Level.WARNING;
165 parameters.shouldLeadTarget = true;
166 parameters.skill = 3;
167 parameters.skin = Skin.BotB;
168
169 return parameters;
170 }
171
172
173
174
175 }