Skip to content

Commit a8e7e94

Browse files
authored
Merge branch 'master' into feat/secret-playable-units-2184
2 parents 954e4c9 + 08a078a commit a8e7e94

File tree

18 files changed

+179
-179
lines changed

18 files changed

+179
-179
lines changed

.github/workflows/config.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,9 @@ jobs:
2323
name: deploy
2424
path: deploy
2525

26-
codeanalysis:
27-
runs-on: ubuntu-22.04
28-
needs: build
29-
30-
steps:
31-
- name: Checkout code
32-
uses: actions/checkout@v2
33-
with:
34-
path: /home/runner/work/AncientBeast/AncientBeast
35-
36-
- run: npm ci
37-
- name: Static Code Analysis (ESLint)
38-
run: npm run lint > eslint-report.log
39-
- name: Static Code Analysis (ESLint)
40-
run: cat eslint-report.log
41-
- name: Archive ESLint Report
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: eslint-report
45-
path: eslint-report.log
46-
4726
test:
4827
runs-on: ubuntu-22.04
49-
needs: codeanalysis
28+
needs: build
5029

5130
steps:
5231
- name: Checkout code

src/__tests__/creature.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,12 @@ beforeAll(() => {
335335
return { Easing: { Linear: { None: 1 } } };
336336
},
337337
});
338-
338+
339339
// Mock jQuery globally
340340
(global as any).$j = jest.fn(() => ({
341341
removeClass: jest.fn(),
342342
}));
343-
343+
344344
// Mock the jquery module
345345
jest.doMock('jquery', () => ({
346346
__esModule: true,

src/abilities/Abolished.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ export default (G: Game) => {
2121
if (!this.testRequirements()) {
2222
return false;
2323
}
24-
// Commented out due to typescript conflicts, but I don't know if that would cause errors, hence why it's not deleted
25-
/*if (damage === undefined) {
26-
damage = {
27-
// NOTE : This code produce array with doubles
28-
type: 'target',
29-
}; // For the test function to work
30-
}*/
3124
return true;
3225
},
3326

@@ -54,7 +47,7 @@ export default (G: Game) => {
5447
if (this.isUpgraded()) {
5548
this.creature.addEffect(
5649
new Effect(
57-
'Burning Heart', // Name
50+
'Burning Spirit', // Name
5851
this.creature, // Caster
5952
this.creature, // Target
6053
'', // Trigger
@@ -114,8 +107,8 @@ export default (G: Game) => {
114107
const abolished = this.creature;
115108

116109
G.grid.queryDirection({
117-
fnOnConfirm: function () {
118-
ability.animation(...arguments);
110+
fnOnConfirm: function (...args) {
111+
ability.animation(...args);
119112
},
120113
flipped: abolished.player.flipped,
121114
team: this._targetTeam,
@@ -211,9 +204,11 @@ export default (G: Game) => {
211204
query() {
212205
const ability = this;
213206
const crea = this.creature;
214-
let totalRange = 3;
207+
// Base relocation range; upgraded version increases this by 1 per successful use
208+
let totalRange = 6;
215209
if (this.isUpgraded()) {
216-
totalRange += this.creature.accumulatedTeleportRange - 1;
210+
// Increase range based on successful prior uses
211+
totalRange += this.creature.accumulatedTeleportRange;
217212
}
218213

219214
// Relocates to any hex within range except for the current hex
@@ -227,15 +222,17 @@ export default (G: Game) => {
227222
ability.query();
228223
return;
229224
}
230-
delete arguments[1];
231-
ability.animation(...arguments);
225+
ability.animation(hex);
232226
},
233227
});
234228
},
235229
activate(hex) {
236230
const ability = this;
237231
ability.end();
238-
this.creature.accumulatedTeleportRange = 0;
232+
// When upgraded, each successful use increases future range by 1
233+
if (this.isUpgraded()) {
234+
this.creature.accumulatedTeleportRange += 1;
235+
}
239236
const targets = ability.getTargets(ability.creature.adjacentHexes(1));
240237

241238
targets.forEach(function (item) {
@@ -322,8 +319,8 @@ export default (G: Game) => {
322319
const range = crea.adjacentHexes(1);
323320

324321
G.grid.queryHexes({
325-
fnOnConfirm: function () {
326-
ability.animation(...arguments);
322+
fnOnConfirm: function (...args) {
323+
ability.animation(...args);
327324
},
328325
fnOnSelect: function (hex) {
329326
range.forEach(function (item) {

src/abilities/Chimera.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ export default (G: Game) => {
8787
// activate() :
8888
activate: function (target) {
8989
const ability = this;
90-
const game = this.game;
91-
90+
const game = this.game;
9291

9392
ability.end();
9493

@@ -101,11 +100,11 @@ export default (G: Game) => {
101100
);
102101
target.takeDamage(damage);
103102
if (this.isUpgraded()) {
104-
// Second attack with sound effect
105-
setTimeout(() => {
106-
game.soundsys.playSFX('sounds/swing2');
107-
target.takeDamage(damage);
108-
}, 500);
103+
// Second attack with sound effect
104+
setTimeout(() => {
105+
game.soundsys.playSFX('sounds/swing2');
106+
target.takeDamage(damage);
107+
}, 500);
109108
}
110109
},
111110
},

src/abilities/Dark-Priest.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ export default (G: Game) => {
9494
const dpriest = this.creature;
9595

9696
G.grid.queryCreature({
97-
fnOnConfirm: function () {
98-
ability.animation(...arguments);
97+
fnOnConfirm: function (...args) {
98+
ability.animation(...args);
9999
},
100100
team: this._targetTeam,
101101
id: dpriest.id,
@@ -176,8 +176,8 @@ export default (G: Game) => {
176176
const dpriest = this.creature;
177177

178178
G.grid.queryCreature({
179-
fnOnConfirm: function () {
180-
ability.animation(...arguments);
179+
fnOnConfirm: function (...args) {
180+
ability.animation(...args);
181181
},
182182
optTest: function (creature) {
183183
return creature.size <= dpriest.player.plasma;
@@ -298,8 +298,8 @@ export default (G: Game) => {
298298
fnOnCancel: function () {
299299
G.activeCreature.queryMove();
300300
},
301-
fnOnConfirm: function () {
302-
ability.animation(...arguments);
301+
fnOnConfirm: function (...args) {
302+
ability.animation(...args);
303303
},
304304
args: {
305305
creature: creature,

src/abilities/Impaler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export default (G: Game) => {
8484
const ability = this;
8585
const creature = this.creature;
8686
G.grid.queryCreature({
87-
fnOnConfirm: function () {
88-
ability.animation(...arguments);
87+
fnOnConfirm: function (...args: any[]) {
88+
ability.animation(...args);
8989
},
9090
team: this._targetTeam,
9191
id: creature.id,
@@ -162,8 +162,8 @@ export default (G: Game) => {
162162
const creature = this.creature;
163163

164164
G.grid.queryCreature({
165-
fnOnConfirm: function () {
166-
ability.animation(...arguments);
165+
fnOnConfirm: function (...args: any[]) {
166+
ability.animation(...args);
167167
},
168168
team: this._targetTeam,
169169
id: creature.id,
@@ -284,8 +284,8 @@ export default (G: Game) => {
284284
const ability = this;
285285

286286
G.grid.queryCreature({
287-
fnOnConfirm: function () {
288-
ability.animation(...arguments);
287+
fnOnConfirm: function (...args: any[]) {
288+
ability.animation(...args);
289289
},
290290
team: this._targetTeam,
291291
id: this.creature.id,

src/abilities/Knightmare.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export default (G: Game) => {
9393
const ability = this;
9494

9595
G.grid.queryCreature({
96-
fnOnConfirm: function () {
97-
ability.animation(...arguments);
96+
fnOnConfirm: function (...args) {
97+
ability.animation(...args);
9898
},
9999
team: this._targetTeam,
100100
id: this.creature.id,
@@ -172,8 +172,8 @@ export default (G: Game) => {
172172
const ability = this;
173173

174174
G.grid.queryCreature({
175-
fnOnConfirm: function () {
176-
ability.animation(...arguments);
175+
fnOnConfirm: function (...args) {
176+
ability.animation(...args);
177177
},
178178
team: this._targetTeam,
179179
id: this.creature.id,
@@ -270,8 +270,8 @@ export default (G: Game) => {
270270
const x = crea.player.flipped ? crea.x - crea.size + 1 : crea.x;
271271

272272
G.grid.queryDirection({
273-
fnOnConfirm: function () {
274-
ability.animation(...arguments);
273+
fnOnConfirm: function (...args) {
274+
ability.animation(...args);
275275
},
276276
team: this._targetTeam,
277277
id: crea.id,

src/abilities/Nutcase.ts

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as matrices from '../utility/matrices';
55
import * as arrayUtils from '../utility/arrayUtils';
66
import { Creature } from '../creature';
77
import { Effect } from '../effect';
8+
import { once } from 'underscore';
89
import { Direction } from '../utility/hex';
910
import Game from '../game';
1011
import { QueryOptions } from '../utility/hexgrid';
@@ -233,33 +234,13 @@ export default (G: Game) => {
233234
target, // Target
234235
'onStepOut', // Trigger
235236
{
236-
effectFn: function (eff) {
237-
const waitForMovementComplete = (message, payload) => {
238-
if (
239-
message === 'movementComplete' &&
240-
eff.target instanceof Creature &&
241-
payload.creature.id === eff.target.id
242-
) {
243-
this.game.signals.creature.remove(waitForMovementComplete);
244-
245-
eff.target.takeDamage(
246-
new Damage(
247-
eff.owner as Creature,
248-
{
249-
pierce: ability.damages.pierce,
250-
},
251-
1,
252-
[],
253-
G,
254-
),
255-
);
256-
eff.deleteEffect();
257-
}
258-
};
237+
// Listener activates just once
238+
effectFn: once((eff) => {
239+
if (!(eff.target instanceof Creature)) return;
240+
eff.target.takeDamage(new Damage(eff.owner as Creature, { slash: 10 }, 1, [], G));
259241

260-
// Wait until movement is completely finished before processing effects.
261-
this.game.signals.creature.add(waitForMovementComplete);
262-
},
242+
eff.deleteEffect();
243+
}),
263244
},
264245
G,
265246
);

src/abilities/Scavenger.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export default (G: Game) => {
9696
const ability = this;
9797

9898
G.grid.queryCreature({
99-
fnOnConfirm: function () {
100-
ability.animation(...arguments);
99+
fnOnConfirm: function (...args) {
100+
ability.animation(...args);
101101
},
102102
team: this._targetTeam,
103103
id: this.creature.id,
@@ -251,10 +251,10 @@ export default (G: Game) => {
251251
};
252252

253253
G.grid.queryHexes({
254-
fnOnConfirm: function () {
254+
fnOnConfirm: function (...args) {
255255
G.grid.fadeOutTempCreature();
256256
G.grid.fadeOutTempCreature(G.grid.secondary_overlay);
257-
ability.animation(...arguments);
257+
ability.animation(...args);
258258
}, // fnOnConfirm
259259
fnOnSelect: select, // fnOnSelect,
260260
team: this._targetTeam,
@@ -360,8 +360,8 @@ export default (G: Game) => {
360360
const ability = this;
361361

362362
G.grid.queryCreature({
363-
fnOnConfirm: function () {
364-
ability.animation(...arguments);
363+
fnOnConfirm: function (...args) {
364+
ability.animation(...args);
365365
},
366366
team: this._targetTeam,
367367
id: this.creature.id,

src/abilities/Vehemoth.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ export default (G: Game) => {
121121
const vehemoth = this.creature;
122122

123123
const object: Partial<QueryOptions> = {
124-
fnOnConfirm: function () {
125-
ability.animation(...arguments);
124+
fnOnConfirm: function (...args) {
125+
ability.animation(...args);
126126
},
127127
flipped: vehemoth.player.flipped,
128128
id: vehemoth.id,
@@ -326,8 +326,8 @@ export default (G: Game) => {
326326
const vehemoth = this.creature;
327327

328328
G.grid.queryDirection({
329-
fnOnConfirm: function () {
330-
ability.animation(...arguments);
329+
fnOnConfirm: function (...args) {
330+
ability.animation(...args);
331331
},
332332
flipped: vehemoth.player.flipped,
333333
team: this._targetTeam,
@@ -464,8 +464,8 @@ export default (G: Game) => {
464464
const vehemoth = this.creature;
465465

466466
this.game.grid.queryCreature({
467-
fnOnConfirm: function () {
468-
ability.animation(...arguments);
467+
fnOnConfirm: function (...args) {
468+
ability.animation(...args);
469469
},
470470
team: this._targetTeam,
471471
id: vehemoth.id,

0 commit comments

Comments
 (0)