Skip to content

Commit

Permalink
Remove check for multiple targets
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNisnevich committed Oct 1, 2017
1 parent 3f6fbea commit def09dd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
8 changes: 1 addition & 7 deletions src/common/components/cards/CardCreationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { capitalize, compact } from 'lodash';

import { CREATABLE_TYPES, TYPE_ROBOT, TYPE_EVENT, typeToString } from '../../constants';
import { ensureInRange } from '../../util/common';
import { getSentencesFromInput, requestParse, numTargetsPerLogicalUnit, CardTextExampleStore } from '../../util/cards';
import { getSentencesFromInput, requestParse, CardTextExampleStore } from '../../util/cards';
import { getCardTextCorpus } from '../../util/firebase';
import { prepareBigramProbs } from '../../util/language';
import Tooltip from '../Tooltip';
Expand Down Expand Up @@ -133,12 +133,6 @@ export default class CardCreationForm extends Component {
return this.parseErrors.join(' ');
} else if (this.nonEmptySentences.find(s => !s.result.js)) {
return 'Sentences are still being parsed ...';
} else {
// Check for >1 target in each logical unit of the parsed JS.
const tooManyTargets = numTargetsPerLogicalUnit(this.fullParse).find(n => n > 1);
if (tooManyTargets) {
return `We do not yet support multiple target selection (expected 0 or 1 targets, got ${tooManyTargets}).`;
}
}
}

Expand Down
9 changes: 0 additions & 9 deletions src/common/util/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,6 @@ function parseCard(card, callback) {
});
}

// How many targets are there in each logical unit of the parsed JS?
export function numTargetsPerLogicalUnit(parsedJS) {
// Activated abilities separate logical units:
// BAD <- "Deal 2 damage. Destroy a structure."
// GOOD <- "Activate: Deal 2 damage. Activate: Destroy a structure."
const units = compact(parsedJS.split('abilities[\'activated\']'));
return units.map(unit => (unit.match(/choose/g) || []).length);
}

//
// 3.5. Keyword abilities.
//
Expand Down

0 comments on commit def09dd

Please sign in to comment.