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
Conversation
This should do it |
oh yeah babyyy |
halp Mac |
4fe29da
to
8786094
Compare
} | ||
|
||
this.add('gametype', this.gameType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intentionally removed?
There was a problem hiding this comment.
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
!
a273708
to
2daca92
Compare
server/ladders.ts
Outdated
@@ -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.`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this an oversight?
(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.)
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) { |
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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?
`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.
`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.
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]; |
There was a problem hiding this comment.
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.
Old: #7607
Client: smogon/pokemon-showdown-client#1649
Last SS: