Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Side for Multi Battles (New) #7929

Merged
merged 5 commits into from Apr 1, 2021
Merged

Conversation

Spandamn
Copy link
Contributor

@Spandamn Spandamn commented Jan 20, 2021

@Spandamn
Copy link
Contributor Author

This should do it

@Spandamn
Copy link
Contributor Author

oh yeah babyyy

@Spandamn
Copy link
Contributor Author

halp Mac

}

this.add('gametype', this.gameType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentionally removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! It was moved to room-battle!

@Zarel Zarel mentioned this pull request Apr 1, 2021
@Zarel Zarel force-pushed the multi-dec13 branch 5 times, most recently from a273708 to 2daca92 Compare April 1, 2021 03:55
@@ -511,19 +563,37 @@ class Ladder extends LadderStore {
Ladders.searches.set(formatid, formatTable);
}
if (formatTable.has(user.id)) {
user.popup(`Couldn't search: You are already searching for a ${formatid} battle.`);
// user.popup(`Couldn't search: You are already searching for a ${formatid} battle.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this an oversight?

Spandamn and others added 5 commits March 31, 2021 21:59
(Reverting changes obsoleted by smogon#8152)

Co-authored-by: Spandamn <spandan.punwatkar@gmail.com>
Co-authored-by: MacChaeger <msaimrkon@gmail.com>
(I'd prefer to rewrite this myself.)
@Zarel Zarel merged commit b77d6cb into smogon:master Apr 1, 2021
if (this.format.gameType === 'multi') {
// Random Multi Battle uses doubles move pools, but Ally Switch fails in multi battles
const allySwitch = movePool.indexOf('allyswitch');
if (allySwitch !== undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work. Array#indexOf never returns undefined; if the value is not in the array, it returns -1. I fixed this in 2baca93.

@Zarel Zarel mentioned this pull request Apr 19, 2021
Comment on lines -1528 to +1555
this.add('teamsize', side.id, side.pokemon.length);
let teamsize = side.pokemon.length;
if (format.teamLength && format.teamLength.battle) {
teamsize = format.teamLength.battle <= teamsize ? format.teamLength.battle : teamsize;
}
this.add('teamsize', side.id, teamsize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait wtf what does this mean? Why was this done?

Zarel added a commit that referenced this pull request May 4, 2021
`maxTeamSize` is a bad variable name (not that `teamLength.battle` is
any better, but that'll get fixed in a future refactor).

- Rename `maxTeamSize` to `chosenTeamSize`, to better indicate that
  this is the size after Team Preview, and that it is also the minimum
	size after Team Preview.

- Don't limit team sizes to 6 if `teamLength.battle` isn't specified.
  This removes an unnecessary `teamLength.battle` requirement in all
	Custom Game formats.

- Stop requiring `maxTeamSize` as a parameter for `battle.getRequests`.
  It's not even used except as a hint to the Preact client, and was
	never state in the first place.

- Stop supporting partial `side.chooseTeam`. This is an unused feature
  and removing it massively simplifies the code and fixes a bug in
	`cupLevelLimit` which definitely was not written with the
	understanding that `chooseTeam` could be partial.

- Fix a bug in #7929 which seemed to misunderstand what `teamsize` was
  for.
Zarel added a commit that referenced this pull request May 4, 2021
`maxTeamSize` is a bad variable name (not that `teamLength.battle` is
any better, but that'll get fixed in a future refactor).

- Rename `maxTeamSize` to `chosenTeamSize`, to better indicate that
  this is the size after Team Preview, and that it is also the minimum
  size after Team Preview.

- Don't limit team sizes to 6 if `teamLength.battle` isn't specified.
  This removes an unnecessary `teamLength.battle` requirement in all
  Custom Game formats.

- Stop requiring `maxTeamSize` as a parameter for `battle.getRequests`.
  It's not even used except as a hint to the Preact client, and was
  never state in the first place.

- Stop supporting partial `side.chooseTeam`. This is an unused feature
  and removing it massively simplifies the code and fixes a bug in
  `cupLevelLimit` which definitely was not written with the
  understanding that `chooseTeam` could be partial.

- Fix a bug in #7929 which seemed to misunderstand what `teamsize` was
  for.
Comment on lines -2056 to +2094
const foeActives = pokemon.side.foe.active;
const frontPosition = foeActives.length - 1 - pokemon.position;
let adjacentFoes = foeActives.slice(frontPosition < 1 ? 0 : frontPosition - 1, frontPosition + 2);
adjacentFoes = adjacentFoes.filter(active => active && !active.fainted);
const adjacentFoes = pokemon.adjacentFoes();
if (adjacentFoes.length) return this.sample(adjacentFoes);
// no valid target at all, return a foe for any possible redirection
return foeActives[frontPosition];
// no valid target at all, return a possibly-fainted foe for any possible redirection
return pokemon.side.foe.active[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change broke redirection in Triples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants