Skip to content

Commit 677d4e2

Browse files
committed
battle con parte de tests pasando
1 parent f37ba18 commit 677d4e2

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

spec/Battle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('Battle type', function () {
9393

9494
});
9595

96-
xdescribe('Start', function () {
96+
describe('Start', function () {
9797

9898
it('includes the characters who are going to fight by party.',
9999
function (done) {
@@ -110,7 +110,7 @@ describe('Battle type', function () {
110110

111111
});
112112

113-
xdescribe('Turns', function () {
113+
describe('Turns', function () {
114114

115115
it('include relevant info.', function (done) {
116116
battle.on('turn', function (turn) {
@@ -140,7 +140,7 @@ describe('Battle type', function () {
140140

141141
});
142142

143-
xdescribe('Parties in battle', function () {
143+
describe('Parties in battle', function () {
144144

145145
it('can contain repeated members, each will be assigned a different id.',
146146
function () {

src/Battle.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Battle.prototype._extractGrimoiresByParty = function (parties) {
7171
Battle.prototype._extractCharactersById = function (parties) {
7272
var idCounters = {};
7373
var characters = [];
74+
var self = this;
7475
var partyIds = Object.keys(parties);
7576
partyIds.forEach(function (partyId) {
7677
var members = parties[partyId].members;
@@ -91,12 +92,14 @@ Battle.prototype._extractCharactersById = function (parties) {
9192
var name = character.name;
9293
if(idCounters[name] === undefined){
9394
idCounters[name] = 0;
95+
idCounters[name]++;
9496
}else{
9597
idCounters[name]++;
9698
name += ' ' + idCounters[name];
9799
}
98100
return name;
99101
}
102+
100103
};
101104

102105
Battle.prototype._resetStates = function (charactersById) {
@@ -141,11 +144,14 @@ Battle.prototype._checkEndOfBattle = function () {
141144

142145
function isAlive(character) {
143146
// Devuelve true si el personaje está vivo.
147+
return !character.isDead();
148+
144149
}
145150

146151
function getCommonParty(characters) {
147-
// Devuelve la party que todos los personajes tienen en común o null en caso
148-
// de que no haya común.
152+
// Devuelve la party que todos los personajes tienen en común o null en caso
153+
// de que no haya común.
154+
149155
}
150156
};
151157

0 commit comments

Comments
 (0)