Skip to content

Commit bac7c0d

Browse files
committed
Tests work, if you dont try to fetch statuses from another file
1 parent 2f54e84 commit bac7c0d

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

rpgsaga/saga/src/saga/player.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,17 @@ export abstract class Player {
110110
this.health = this.maxHealth;
111111
}
112112
}
113-
// if (input.changer !== undefined) {
114-
// for (let i = 0; i < this.statuses.length; i++) {
115-
// const status = this.statuses[i];
116-
// for (let j = 0; j < input.changer.cancel.length; j++) {
117-
// const change = input.changer.cancel[j];
118-
// if (status === change) {
119-
// this.statuses.splice(i, 1);
120-
// }
121-
// }
122-
// }
123-
// }
113+
if (input.changer !== undefined) {
114+
for (let i = 0; i < this.statuses.length; i++) {
115+
const status = this.statuses[i];
116+
for (let j = 0; j < input.changer.cancel.length; j++) {
117+
const change = input.changer.cancel[j];
118+
if (status === change) {
119+
this.statuses.splice(i, 1);
120+
}
121+
}
122+
}
123+
}
124124
}
125125

126126
protected calcDamage(dmg: number, dmgType: ActionType): [number, Aff] {

rpgsaga/saga/tests/saga.players.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import { createPlayer } from '../src/saga/playerFactory';
22
import { PlayerGenerator } from '../src/saga/playerGenerator';
3-
import { Statuses } from '../src/saga/banks/statuses';
43
import { Skill } from '../src/saga/actions';
54
import { ActionResult, Player } from '../src/saga/player';
65
import { ActionType, Aff } from '../src/saga/affinities';
76
import { Changer } from '../src/saga/changer';
7+
import { Status } from '../src/saga/statuses';
8+
9+
export const Statuses = {
10+
burn: new Status('Burn', ActionType.Fire, 2, 3, false),
11+
freeze: new Status('Freeze', ActionType.Ice, 0, 1, true),
12+
};
813

914
describe('Testing creating players', () => {
1015
it('should return as much players as we ordered', () => {

0 commit comments

Comments
 (0)