1
- /*
1
+ /*
2
2
3
3
The only function that is required in this file is the "move" function
4
4
9
9
10
10
The "move" function must return "North", "South", "East", "West", or "Stay"
11
11
(Anything else will be interpreted by the game as "Stay")
12
-
13
- The "move" function should accept two arguments that the website will be passing in:
12
+
13
+ The "move" function should accept two arguments that the website will be passing in:
14
14
- a "gameData" object which holds all information about the current state
15
15
of the battle
16
16
31
31
// Aggressor
32
32
var move = function(gameData, helpers) {
33
33
// Here, we ask if your hero's health is below 30
34
- if (gameData.activeHero() .health <= 30){
34
+ if (gameData.activeHero.health <= 30){
35
35
// If it is, head towards the nearest health well
36
36
return helpers.findNearestHealthWell(gameData);
37
37
} else {
@@ -40,72 +40,84 @@ var move = function(gameData, helpers) {
40
40
}
41
41
};
42
42
*/
43
+
43
44
/*
44
45
// Health Nut
45
46
var move = function(gameData, helpers) {
46
47
// Here, we ask if your hero's health is below 75
47
- if (gameData.activeHero() .health <= 75){
48
+ if (gameData.activeHero.health <= 75){
48
49
// If it is, head towards the nearest health well
49
50
return helpers.findNearestHealthWell(gameData);
50
51
} else {
51
52
// Otherwise, go mine some diamonds!!!
52
- return helpers.findNearestDiamondMine (gameData);
53
+ return helpers.findNearestNonTeamDiamondMine (gameData);
53
54
}
54
55
};
55
56
*/
57
+
56
58
// Balanced
57
59
58
60
//TL;DR: If you are new, just uncomment the 'move' function that you think sounds like fun!
59
61
// (and comment out all the other move functions)
60
62
63
+ /*
64
+ // The "Northerner"
65
+ // This hero will walk North. Always.
66
+ var move = function(gameData, helpers) {
67
+ var myHero = gameData.activeHero;
68
+ return 'North';
69
+ };
70
+ */
71
+
72
+ /*
73
+ // The "Blind Man"
74
+ // This hero will walk in a random direction each turn.
75
+ var move = function(gameData, helpers) {
76
+ var myHero = gameData.activeHero;
77
+ var choices = ['North', 'South', 'East', 'West'];
78
+ return choices[Math.floor(Math.random()*4)];
79
+ };
80
+ */
81
+
82
+ /*
83
+ // The "Priest"
84
+ // This hero will heal nearby friendly champions.
85
+ var move = function(gameData, helpers) {
86
+ var myHero = gameData.activeHero;
87
+ if (myHero.health < 60) {
88
+ return helpers.findNearestHealthWell(gameData);
89
+ } else {
90
+ return helpers.findNearestTeamMember(gameData);
91
+ }
92
+ };
93
+ */
94
+
95
+ /*
96
+ // The "Unwise Assassin"
97
+ // This hero will attempt to kill the closest enemy hero. No matter what.
98
+ var move = function(gameData, helpers) {
99
+ var myHero = gameData.activeHero;
100
+ if (myHero.health < 30) {
101
+ return helpers.findNearestHealthWell(gameData);
102
+ } else {
103
+ return helpers.findNearestEnemy(gameData);
104
+ }
105
+ };
106
+ */
107
+
108
+ /*
109
+ // The "Careful Assassin"
110
+ // This hero will attempt to kill the closest weaker enemy hero.
111
+ var move = function(gameData, helpers) {
112
+ var myHero = gameData.activeHero;
113
+ if (myHero.health < 50) {
114
+ return helpers.findNearestHealthWell(gameData);
115
+ } else {
116
+ return helpers.findNearestWeakerEnemy(gameData);
117
+ }
118
+ };
119
+ */
61
120
62
- // // The "Northerner"
63
- // // This hero will walk North. Always.
64
- // var move = function(gameData, helpers) {
65
- // var myHero = gameData.activeHero;
66
- // return 'North';
67
- // };
68
-
69
- // // The "Blind Man"
70
- // // This hero will walk in a random direction each turn.
71
- // var move = function(gameData, helpers) {
72
- // var myHero = gameData.activeHero;
73
- // var choices = ['North', 'South', 'East', 'West'];
74
- // return choices[Math.floor(Math.random()*4)];
75
- // };
76
-
77
- // // The "Priest"
78
- // // This hero will heal nearby friendly champions.
79
- // var move = function(gameData, helpers) {
80
- // var myHero = gameData.activeHero;
81
- // if (myHero.health < 60) {
82
- // return helpers.findNearestHealthWell(gameData);
83
- // } else {
84
- // return helpers.findNearestTeamMember(gameData);
85
- // }
86
- // };
87
-
88
- // // The "Unwise Assassin"
89
- // // This hero will attempt to kill the closest enemy hero. No matter what.
90
- // var move = function(gameData, helpers) {
91
- // var myHero = gameData.activeHero;
92
- // if (myHero.health < 30) {
93
- // return helpers.findNearestHealthWell(gameData);
94
- // } else {
95
- // return helpers.findNearestEnemy(gameData);
96
- // }
97
- // };
98
-
99
- // // The "Careful Assassin"
100
- // // This hero will attempt to kill the closest weaker enemy hero.
101
- // var move = function(gameData, helpers) {
102
- // var myHero = gameData.activeHero;
103
- // if (myHero.health < 50) {
104
- // return helpers.findNearestHealthWell(gameData);
105
- // } else {
106
- // return helpers.findNearestWeakerEnemy(gameData);
107
- // }
108
- // };
109
121
110
122
// The "Safe Diamond Miner"
111
123
// This hero will attempt to capture enemy diamond mines.
@@ -120,7 +132,7 @@ var move = function(gameData, helpers) {
120
132
} ) ;
121
133
var distanceToHealthWell = healthWellStats . distance ;
122
134
var directionToHealthWell = healthWellStats . direction ;
123
-
135
+
124
136
125
137
if ( myHero . health < 40 ) {
126
138
//Heal no matter what if low health
@@ -135,38 +147,42 @@ var move = function(gameData, helpers) {
135
147
} ;
136
148
137
149
138
- // // The "Selfish Diamond Miner"
139
- // // This hero will attempt to capture diamond mines (even those owned by teammates).
140
- // var move = function(gameData, helpers) {
141
- // var myHero = gameData.activeHero;
150
+ /*
151
+ // The "Selfish Diamond Miner"
152
+ // This hero will attempt to capture diamond mines (even those owned by teammates).
153
+ var move = function(gameData, helpers) {
154
+ var myHero = gameData.activeHero;
142
155
143
156
//Get stats on the nearest health well
144
- // var healthWellStats = helpers.findNearestObjectDirectionAndDistance(gameData.board, myHero, function(boardTile) {
145
- // if (boardTile.type === 'HealthWell') {
146
- // return true;
147
- // }
148
- // });
157
+ var healthWellStats = helpers.findNearestObjectDirectionAndDistance(gameData.board, myHero, function(boardTile) {
158
+ if (boardTile.type === 'HealthWell') {
159
+ return true;
160
+ }
161
+ });
149
162
150
- // var distanceToHealthWell = healthWellStats.distance;
151
- // var directionToHealthWell = healthWellStats.direction;
163
+ var distanceToHealthWell = healthWellStats.distance;
164
+ var directionToHealthWell = healthWellStats.direction;
152
165
153
- // if (myHero.health < 40) {
166
+ if (myHero.health < 40) {
154
167
//Heal no matter what if low health
155
- // return directionToHealthWell;
156
- // } else if (myHero.health < 100 && distanceToHealthWell === 1) {
168
+ return directionToHealthWell;
169
+ } else if (myHero.health < 100 && distanceToHealthWell === 1) {
157
170
//Heal if you aren't full health and are close to a health well already
158
- // return directionToHealthWell;
159
- // } else {
171
+ return directionToHealthWell;
172
+ } else {
160
173
//If healthy, go capture a diamond mine!
161
- // return helpers.findNearestUnownedDiamondMine(gameData);
162
- // }
163
- // };
164
-
165
- // // The "Coward"
166
- // // This hero will try really hard not to die.
167
- // var move = function(gameData, helpers) {
168
- // return helpers.findNearestHealthWell(gameData);
169
- // }
174
+ return helpers.findNearestUnownedDiamondMine(gameData);
175
+ }
176
+ };
177
+ */
178
+
179
+ /*
180
+ // The "Coward"
181
+ // This hero will try really hard not to die.
182
+ var move = function(gameData, helpers) {
183
+ return helpers.findNearestHealthWell(gameData);
184
+ };
185
+ */
170
186
171
187
// Export the move function here
172
188
module . exports = move ;
0 commit comments