@@ -19,6 +19,16 @@ class ScoreAndDamage {
19
19
var lastSurvivorCount: Int = 0
20
20
private set
21
21
22
+ /* * Clears all registered scores and damages when a new round is started. */
23
+ fun clear () {
24
+ bulletDamage.clear()
25
+ ramHits.clear()
26
+ bulletKillEnemyIds.clear()
27
+ ramKillEnemyIds.clear()
28
+ survivalCount = 0
29
+ lastSurvivorCount = 0
30
+ }
31
+
22
32
/* * The total bullet damage dealt by this bot to other bots. */
23
33
fun getTotalBulletDamage () = bulletDamage.keys.sumOf { getBulletDamage(it) }
24
34
@@ -33,23 +43,28 @@ class ScoreAndDamage {
33
43
34
44
/* *
35
45
* Returns the bullet damage dealt by this bot to specific bot.
36
- * @param enemyId is the enemy bot to retrieve the damage for.
46
+ * @param enemyId is the identifier of the specific enemy bot
37
47
* @return the bullet damage dealt to a specific bot.
38
48
*/
39
49
private fun getBulletDamage (enemyId : ParticipantId ): Double = bulletDamage[enemyId] ? : 0.0
40
50
41
51
/* *
42
52
* Returns the number of times ram damage has been dealt by this bot to specific bot.
43
- * @param enemyId is the enemy bot to retrieve the ram count for.
53
+ * @param enemyId is the identifier of the specific enemy bot
44
54
* @return the ram count for a specific bot.
45
55
*/
46
56
private fun getRamHits (enemyId : ParticipantId ): Int = ramHits[enemyId] ? : 0
47
57
58
+ /* *
59
+ * Returns the total damage dealt to a specific bot.
60
+ * @param enemyId is the identifier of the specific enemy bot
61
+ * @return the total damage dealt to the bot.
62
+ */
48
63
fun getTotalDamage (enemyId : ParticipantId ): Double = getBulletDamage(enemyId) + getRamHits(enemyId) * RAM_DAMAGE
49
64
50
65
/* *
51
66
* Adds bullet damage to a specific enemy bot.
52
- * @param enemyId is the identifier of the enemy bot
67
+ * @param enemyId is the identifier of the specific enemy bot
53
68
* @param damage is the amount of damage that the enemy bot has received
54
69
*/
55
70
fun addBulletDamage (enemyId : ParticipantId , damage : Double ) {
0 commit comments