mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
FFA: Make Court Change always rotate 90° clockwise (#11389)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
This commit is contained in:
parent
5f9ef6e4cb
commit
c1b536d2f3
|
|
@ -3151,30 +3151,23 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
|
|||
];
|
||||
let success = false;
|
||||
if (this.gameType === "freeforall") {
|
||||
// random integer from 1-3 inclusive
|
||||
const offset = this.random(3) + 1;
|
||||
// the list of all sides in counterclockwise order
|
||||
const sides = [this.sides[0], this.sides[2]!, this.sides[1], this.sides[3]!];
|
||||
// the list of all sides in clockwise order
|
||||
const sides = [this.sides[0], this.sides[3]!, this.sides[1], this.sides[2]!];
|
||||
const temp: { [k: number]: typeof source.side.sideConditions } = { 0: {}, 1: {}, 2: {}, 3: {} };
|
||||
for (const side of sides) {
|
||||
for (const id in side.sideConditions) {
|
||||
if (!sideConditions.includes(id)) continue;
|
||||
temp[side.n][id] = side.sideConditions[id];
|
||||
delete side.sideConditions[id];
|
||||
const effectName = this.dex.conditions.get(id).name;
|
||||
this.add('-sideend', side, effectName, '[silent]');
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const sourceSideConditions = temp[sides[i].n];
|
||||
const targetSide = sides[(i + offset) % 4]; // the next side in rotation
|
||||
const targetSide = sides[(i + 1) % 4]; // the next side in rotation
|
||||
for (const id in sourceSideConditions) {
|
||||
targetSide.sideConditions[id] = sourceSideConditions[id];
|
||||
targetSide.sideConditions[id].target = targetSide;
|
||||
const effectName = this.dex.conditions.get(id).name;
|
||||
let layers = sourceSideConditions[id].layers || 1;
|
||||
for (; layers > 0; layers--) this.add('-sidestart', targetSide, effectName, '[silent]');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -3202,9 +3195,9 @@ export const Moves: import('../sim/dex-moves').MoveDataTable = {
|
|||
sourceSideConditions[id] = targetTemp[id];
|
||||
sourceSideConditions[id].target = source.side;
|
||||
}
|
||||
this.add('-swapsideconditions');
|
||||
}
|
||||
if (!success) return false;
|
||||
this.add('-swapsideconditions');
|
||||
this.add('-activate', source, 'move: Court Change');
|
||||
},
|
||||
secondary: null,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user