Standardize on using + for move targeting

Move targets are now intended to be +1 +2 +3 for foes. The old syntax
of using 1 2 3 is still supported, but is not recommended.

(The old syntax will still be used in the old client, but the Preact
client will support the new syntax going forward.)

This makes the difference between move number and move target
clearer.

This also fixes the Conversion 2 ambiguity (although for backwards
compatibility, we do still need to special-case it).
This commit is contained in:
Guangcong Luo 2020-03-22 01:43:02 -07:00
parent 1628258371
commit 5108a62f5e
3 changed files with 9 additions and 9 deletions

View File

@ -682,15 +682,15 @@ To be exact, `CHOICE` is one of:
- `MOVESLOTSPEC` is a move name (capitalization/spacing-insensitive) or
1-based move slot number
- `TARGETSPEC` is a 1-based target slot number. Add a `-` in front of it to
refer to allies. Remember that slots oppose each other, so in a battle, the
slots go as follows:
refer to allies, and a `+` to refer to foes. Remember that slots go in
opposite directions, like this:
Triples Doubles Singles
3 2 1 2 1 1
-1 -2 -3 -1 -2 -1
Triples Doubles
+3 +2 +1 +2 +1
-1 -2 -3 -1 -2
(But note that slot numbers are unnecessary in Singles: you can never
choose a target in Singles.)
(Slot numbers are unnecessary in Singles: you can never choose a target in
Singles.)
`SWITCHSPEC` is:

View File

@ -145,7 +145,7 @@ export class Side {
switch (action.choice) {
case 'move':
let details = ``;
if (action.targetLoc && this.active.length > 1) details += ` ${action.targetLoc}`;
if (action.targetLoc && this.active.length > 1) details += ` ${action.targetLoc > 0 ? '+' : ''}${action.targetLoc}`;
if (action.mega) details += (action.pokemon!.item === 'ultranecroziumz' ? ` ultra` : ` mega`);
if (action.zmove) details += ` zmove`;
if (action.maxMove) details += ` dynamax`;

View File

@ -171,7 +171,7 @@ describe('Choice parser', function () {
assert.throws(() => battle.choose('p1', choice));
}
assert(battle.choose('p1', `move 1 1 mega, move tackle 1`));
assert(battle.choose('p1', `move 1 +1 mega, move tackle 1`));
assert(battle.choose('p2', `move Blaze Kick zmove 1, move irondefense`));
});