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

Function require

src/__tests__/abilities/snow-bunny.ts:275–299  ·  view source on GitHub ↗
(hex: any)

Source from the content-addressed store, hash-verified

273 return hex;
274 },
275 require(hex: any) {
276 if (!this.testRequirements()) return false;
277 if (this.creature === this.game.activeCreature) return false;
278
279 const creatureOnHex = getPointFacade().getCreaturesAt({ x: hex.x, y: hex.y })[0];
280 if (creatureOnHex == undefined) return false;
281
282 let triggerHexes: any[] = [];
283 if (creatureOnHex === this.creature) {
284 triggerHexes = this._detectFrontHexesWithEnemy();
285 } else if (creatureOnHex.team % 2 !== this.creature.team % 2) {
286 // isTeam Enemy
287 const frontHexWithEnemy = this._findEnemyHexInFront(hex);
288 if (frontHexWithEnemy) triggerHexes.push(frontHexWithEnemy);
289 }
290
291 const abilityCanTrigger =
292 triggerHexes.length &&
293 this.timesUsedThisTurn < this._getUsesPerTurn() &&
294 !this.creature.materializationSickness &&
295 !this.creature.isFrozen() &&
296 this._getHopHex();
297
298 return !!abilityCanTrigger;
299 },
300 };
301 return ability;
302}

Callers

nothing calls this directly

Calls 5

getPointFacadeFunction · 0.90
testRequirementsMethod · 0.80
getCreaturesAtMethod · 0.80
isFrozenMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected