From def09dd766547859c245debffc7d61ee057e1ff2 Mon Sep 17 00:00:00 2001 From: Alex Nisnevich Date: Sun, 1 Oct 2017 04:19:29 -0700 Subject: [PATCH] Remove check for multiple targets --- src/common/components/cards/CardCreationForm.js | 8 +------- src/common/util/cards.js | 9 --------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/common/components/cards/CardCreationForm.js b/src/common/components/cards/CardCreationForm.js index ed0059309..ce3f7fb5a 100644 --- a/src/common/components/cards/CardCreationForm.js +++ b/src/common/components/cards/CardCreationForm.js @@ -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'; @@ -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}).`; - } } } diff --git a/src/common/util/cards.js b/src/common/util/cards.js index adde12dbe..a0f6a3d68 100644 --- a/src/common/util/cards.js +++ b/src/common/util/cards.js @@ -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. //