Skip to content

Commit

Permalink
Cyber-Wolf.js -> Cyber-Wolf.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
allmtz committed Feb 18, 2024
1 parent 5861211 commit e2f3615
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/abilities/Cyber-Wolf.js → src/abilities/Cyber-Wolf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { Team, isTeam } from '../utility/team';
import * as matrices from '../utility/matrices';
import * as arrayUtils from '../utility/arrayUtils';
import { Creature } from '../creature';
import Game from '../game';
import { Hex } from '../utility/hex';

/** Creates the abilities
* @param {Object} G the game object
* @return {void}
*/
export default (G) => {
export default (G: Game) => {
G.abilities[31] = [
// First Ability: Bad Doggie
{
Expand All @@ -29,7 +31,7 @@ export default (G) => {

activate: function () {
// Check if there's an enemy creature in front
const hexesInFront = this.creature.getHexMap(matrices.inlinefront2hex);
const hexesInFront = this.creature.getHexMap(matrices.inlinefront2hex, false);
if (hexesInFront.length < 1) {
return;
}
Expand Down Expand Up @@ -72,7 +74,7 @@ export default (G) => {
}

if (
!this.atLeastOneTarget(this.creature.getHexMap(matrices.frontnback2hex), {
!this.atLeastOneTarget(this.creature.getHexMap(matrices.frontnback2hex, false), {
team: this._targetTeam,
})
) {
Expand All @@ -88,17 +90,18 @@ export default (G) => {

G.grid.queryCreature({
fnOnConfirm: function () {
// eslint-disable-next-line
ability.animation(...arguments);
}, // fnOnConfirm
team: this._targetTeam,
id: crea.id,
flipped: crea.player.flipped,
hexes: crea.getHexMap(matrices.frontnback2hex),
hexes: crea.getHexMap(matrices.frontnback2hex, false),
});
},

// activate() :
activate: function (target) {
activate: function (target: Creature) {
const ability = this;
ability.end();
G.Phaser.camera.shake(0.01, 150, true, G.Phaser.camera.SHAKE_HORIZONTAL, true);
Expand Down Expand Up @@ -210,14 +213,12 @@ export default (G) => {
),
];

choices[0].choiceId = 0;
choices[1].choiceId = 1;

G.grid.queryChoice({
fnOnCancel: function () {
G.activeCreature.queryMove();
},
fnOnConfirm: function () {
// eslint-disable-next-line
ability.animation(...arguments);
},
team: Team.Both,
Expand All @@ -228,7 +229,7 @@ export default (G) => {
},

// activate() :
activate: function (choice) {
activate: function (choice: Hex[]) {
const ability = this;
ability.end();
G.Phaser.camera.shake(0.02, 350, true, G.Phaser.camera.SHAKE_HORIZONTAL, true);
Expand All @@ -239,7 +240,8 @@ export default (G) => {
const bellowrow = matrices.bellowrow;

let rows;
if (choice.choiceId === 0) {
// Check to first hex to determine which direction was chosen
if (choice[0].x >= this.creature.x) {
// Front
rows = [
arrayUtils.filterCreature(
Expand Down Expand Up @@ -338,6 +340,7 @@ export default (G) => {

G.grid.queryCreature({
fnOnConfirm: function () {
// eslint-disable-next-line
ability.animation(...arguments);
}, // fnOnConfirm
team: Team.Enemy,
Expand Down

0 comments on commit e2f3615

Please sign in to comment.