MCPcopy
hub / github.com/FreezingMoon/AncientBeast / scoreBoomBox

Function scoreBoomBox

src/bots/Gumble.ts:242–285  ·  view source on GitHub ↗
(hex: Hex, activeCreature: Creature, controller: BotController)

Source from the content-addressed store, hash-verified

240}
241
242function scoreBoomBox(hex: Hex, activeCreature: Creature, controller: BotController): number {
243 const target = hex.creature;
244 if (!(target instanceof Creature) || !isTeam(activeCreature, target, Team.Enemy)) {
245 return Number.NEGATIVE_INFINITY;
246 }
247
248 let score = 620 - target.health + target.size * 18;
249
250 if (target.health <= BOOM_BOX_DAMAGE) {
251 score += 1100;
252 }
253
254 if (target.health / target.stats.health < 0.45) {
255 score += 180;
256 }
257
258 if (isDarkPriest(target)) {
259 score += 760;
260 }
261
262 if (activeCreature.adjacentHexes(1).some((adjacentHex) => adjacentHex.creature === target)) {
263 score += 140;
264 }
265
266 const targetStrategy = unitStrategies[target.type as string];
267 score +=
268 targetStrategy?.getTargetingPenalty?.(activeCreature, target, ABILITY.BOOM_BOX, controller) ??
269 0;
270 score +=
271 targetStrategy?.getCounterTargetingModifier?.(
272 activeCreature,
273 target,
274 ABILITY.BOOM_BOX,
275 controller,
276 ) ?? 0;
277
278 const hasUpgradedGooeyBody =
279 activeCreature.abilities[ABILITY.GOOEY_BODY]?.isUpgraded?.() ?? false;
280 if (hasUpgradedGooeyBody && isDarkPriest(target)) {
281 score += 180;
282 }
283
284 return score;
285}
286
287function hasWoundedRibbonTarget(creature: Creature): boolean {
288 return creature.hexagons

Callers 1

scoreAbilityHexFunction · 0.85

Calls 6

isTeamFunction · 0.90
isDarkPriestFunction · 0.85
adjacentHexesMethod · 0.80
getTargetingPenaltyMethod · 0.80
isUpgradedMethod · 0.80

Tested by

no test coverage detected