mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
TypeScript: Enable noImplicitOverride
This commit is contained in:
parent
f301e930f6
commit
73a04cdcba
|
|
@ -15,10 +15,10 @@ interface Gen1RandomBattleSpecies {
|
|||
}
|
||||
|
||||
export class RandomGen1Teams extends RandomGen2Teams {
|
||||
randomData: { [species: IDEntry]: Gen1RandomBattleSpecies } = require('./data.json');
|
||||
override randomData: { [species: IDEntry]: Gen1RandomBattleSpecies } = require('./data.json');
|
||||
|
||||
// Challenge Cup or CC teams are basically fully random teams.
|
||||
randomCCTeam() {
|
||||
override randomCCTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const team = [];
|
||||
|
|
@ -103,7 +103,7 @@ export class RandomGen1Teams extends RandomGen2Teams {
|
|||
}
|
||||
|
||||
// Random team generation for Gen 1 Random Battles.
|
||||
randomTeam() {
|
||||
override randomTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
// Get what we need ready.
|
||||
|
|
@ -219,7 +219,7 @@ export class RandomGen1Teams extends RandomGen2Teams {
|
|||
/**
|
||||
* Random set generation for Gen 1 Random Battles.
|
||||
*/
|
||||
randomSet(species: string | Species): RandomTeamsTypes.RandomSet {
|
||||
override randomSet(species: string | Species): RandomTeamsTypes.RandomSet {
|
||||
species = this.dex.species.get(species);
|
||||
if (!species.exists) species = this.dex.species.get('pikachu'); // Because Gen 1.
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ export class RandomGen1Teams extends RandomGen2Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomHCTeam(): PokemonSet[] {
|
||||
override randomHCTeam(): PokemonSet[] {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const team = [];
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const MOVE_PAIRS = [
|
|||
];
|
||||
|
||||
export class RandomGen2Teams extends RandomGen3Teams {
|
||||
randomSets: { [species: IDEntry]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
override randomSets: { [species: IDEntry]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
constructor(format: string | Format, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
|
|
@ -47,7 +47,7 @@ export class RandomGen2Teams extends RandomGen3Teams {
|
|||
};
|
||||
}
|
||||
|
||||
cullMovePool(
|
||||
override cullMovePool(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities = {},
|
||||
|
|
@ -138,7 +138,7 @@ export class RandomGen2Teams extends RandomGen3Teams {
|
|||
}
|
||||
|
||||
// Generate random moveset for a given species, role, preferred type.
|
||||
randomMoveset(
|
||||
override randomMoveset(
|
||||
types: string[],
|
||||
abilities: string[],
|
||||
teamDetails: RandomTeamsTypes.TeamDetails,
|
||||
|
|
@ -349,7 +349,7 @@ export class RandomGen2Teams extends RandomGen3Teams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
getItem(
|
||||
override getItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -378,7 +378,7 @@ export class RandomGen2Teams extends RandomGen3Teams {
|
|||
return 'Leftovers';
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
battleHasDitto: boolean;
|
||||
battleHasWobbuffet: boolean;
|
||||
|
||||
randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
override randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
constructor(format: string | Format, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
|
|
@ -60,7 +60,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
};
|
||||
}
|
||||
|
||||
cullMovePool(
|
||||
override cullMovePool(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -164,7 +164,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
}
|
||||
|
||||
// Generate random moveset for a given species, role, preferred type.
|
||||
randomMoveset(
|
||||
override randomMoveset(
|
||||
types: string[],
|
||||
abilities: string[],
|
||||
teamDetails: RandomTeamsTypes.TeamDetails,
|
||||
|
|
@ -386,7 +386,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
shouldCullAbility(
|
||||
override shouldCullAbility(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -410,7 +410,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
return false;
|
||||
}
|
||||
|
||||
getAbility(
|
||||
override getAbility(
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -449,7 +449,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
return this.sample(abilities);
|
||||
}
|
||||
|
||||
getItem(
|
||||
override getItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -520,7 +520,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
return 'Leftovers';
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
@ -635,7 +635,7 @@ export class RandomGen3Teams extends RandomGen4Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomTeam() {
|
||||
override randomTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const seed = this.prng.getSeed();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const PRIORITY_POKEMON = [
|
|||
];
|
||||
|
||||
export class RandomGen4Teams extends RandomGen5Teams {
|
||||
randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
override randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
constructor(format: string | Format, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
|
|
@ -81,7 +81,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
.map(move => move.id);
|
||||
}
|
||||
|
||||
cullMovePool(
|
||||
override cullMovePool(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -229,7 +229,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
}
|
||||
|
||||
// Generate random moveset for a given species, role, preferred type.
|
||||
randomMoveset(
|
||||
override randomMoveset(
|
||||
types: string[],
|
||||
abilities: string[],
|
||||
teamDetails: RandomTeamsTypes.TeamDetails,
|
||||
|
|
@ -464,7 +464,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
shouldCullAbility(
|
||||
override shouldCullAbility(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -490,7 +490,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
return false;
|
||||
}
|
||||
|
||||
getAbility(
|
||||
override getAbility(
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -530,7 +530,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
return this.sample(abilities);
|
||||
}
|
||||
|
||||
getPriorityItem(
|
||||
override getPriorityItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -571,7 +571,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
if (role === 'Staller') return 'Leftovers';
|
||||
}
|
||||
|
||||
getItem(
|
||||
override getItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -646,7 +646,7 @@ export class RandomGen4Teams extends RandomGen5Teams {
|
|||
return 'Leftovers';
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const PRIORITY_POKEMON = [
|
|||
];
|
||||
|
||||
export class RandomGen5Teams extends RandomGen6Teams {
|
||||
randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
override randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
constructor(format: string | Format, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
|
|
@ -95,7 +95,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
.map(move => move.id);
|
||||
}
|
||||
|
||||
cullMovePool(
|
||||
override cullMovePool(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -249,7 +249,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
}
|
||||
|
||||
// Generate random moveset for a given species, role, preferred type.
|
||||
randomMoveset(
|
||||
override randomMoveset(
|
||||
types: string[],
|
||||
abilities: string[],
|
||||
teamDetails: RandomTeamsTypes.TeamDetails,
|
||||
|
|
@ -491,7 +491,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
shouldCullAbility(
|
||||
override shouldCullAbility(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -521,7 +521,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
return false;
|
||||
}
|
||||
|
||||
getAbility(
|
||||
override getAbility(
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -564,7 +564,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
return this.sample(abilities);
|
||||
}
|
||||
|
||||
getPriorityItem(
|
||||
override getPriorityItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -614,7 +614,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
if (role === 'Staller') return 'Leftovers';
|
||||
}
|
||||
|
||||
getItem(
|
||||
override getItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -699,7 +699,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
return 'Leftovers';
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
@ -840,7 +840,7 @@ export class RandomGen5Teams extends RandomGen6Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomTeam() {
|
||||
override randomTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const seed = this.prng.getSeed();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ const PRIORITY_POKEMON = [
|
|||
];
|
||||
|
||||
export class RandomGen6Teams extends RandomGen7Teams {
|
||||
randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
override randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
constructor(format: Format | string, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
|
|
@ -108,7 +108,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
.map(move => move.id);
|
||||
}
|
||||
|
||||
cullMovePool(
|
||||
override cullMovePool(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -284,7 +284,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
}
|
||||
|
||||
// Generate random moveset for a given species, role, preferred type.
|
||||
randomMoveset(
|
||||
override randomMoveset(
|
||||
types: string[],
|
||||
abilities: string[],
|
||||
teamDetails: RandomTeamsTypes.TeamDetails,
|
||||
|
|
@ -527,7 +527,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
shouldCullAbility(
|
||||
override shouldCullAbility(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -561,7 +561,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
return false;
|
||||
}
|
||||
|
||||
getAbility(
|
||||
override getAbility(
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -607,7 +607,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
return this.sample(abilities);
|
||||
}
|
||||
|
||||
getPriorityItem(
|
||||
override getPriorityItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -664,7 +664,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
if (role === 'Staller') return 'Leftovers';
|
||||
}
|
||||
|
||||
getItem(
|
||||
override getItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -757,7 +757,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
return 'Leftovers';
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
@ -889,9 +889,9 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomFactorySets: { [format: string]: { [species: string]: BattleFactorySpecies } } = require('./factory-sets.json');
|
||||
override randomFactorySets: { [format: string]: { [species: string]: BattleFactorySpecies } } = require('./factory-sets.json');
|
||||
|
||||
randomFactorySet(
|
||||
override randomFactorySet(
|
||||
species: Species,
|
||||
teamData: RandomTeamsTypes.FactoryTeamDetails,
|
||||
tier: string
|
||||
|
|
@ -980,7 +980,7 @@ export class RandomGen6Teams extends RandomGen7Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomFactoryTeam(side: PlayerOptions, depth = 0): RandomTeamsTypes.RandomFactorySet[] {
|
||||
override randomFactoryTeam(side: PlayerOptions, depth = 0): RandomTeamsTypes.RandomFactorySet[] {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const forceResult = (depth >= 12);
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
shouldCullAbility(
|
||||
override shouldCullAbility(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -752,7 +752,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
return false;
|
||||
}
|
||||
|
||||
getAbility(
|
||||
override getAbility(
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -981,7 +981,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
return 'Leftovers';
|
||||
}
|
||||
|
||||
getLevel(species: Species): number {
|
||||
override getLevel(species: Species): number {
|
||||
// level set by rules
|
||||
if (this.adjustLevel) return this.adjustLevel;
|
||||
if (this.gen >= 2) {
|
||||
|
|
@ -1013,7 +1013,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
return 80;
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
@ -1178,7 +1178,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomTeam() {
|
||||
override randomTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const seed = this.prng.getSeed();
|
||||
|
|
@ -1382,9 +1382,9 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
return pokemon;
|
||||
}
|
||||
|
||||
randomFactorySets: { [format: string]: { [species: string]: BattleFactorySpecies } } = require('./factory-sets.json');
|
||||
override randomFactorySets: { [format: string]: { [species: string]: BattleFactorySpecies } } = require('./factory-sets.json');
|
||||
|
||||
randomFactorySet(
|
||||
override randomFactorySet(
|
||||
species: Species, teamData: RandomTeamsTypes.FactoryTeamDetails, tier: string
|
||||
): RandomTeamsTypes.RandomFactorySet | null {
|
||||
const id = toID(species.name);
|
||||
|
|
@ -1503,7 +1503,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomFactoryTeam(side: PlayerOptions, depth = 0): RandomTeamsTypes.RandomFactorySet[] {
|
||||
override randomFactoryTeam(side: PlayerOptions, depth = 0): RandomTeamsTypes.RandomFactorySet[] {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const forceResult = (depth >= 12);
|
||||
|
|
@ -1700,9 +1700,9 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
return pokemon;
|
||||
}
|
||||
|
||||
randomBSSFactorySets: AnyObject = require('./bss-factory-sets.json');
|
||||
override randomBSSFactorySets: AnyObject = require('./bss-factory-sets.json');
|
||||
|
||||
randomBSSFactorySet(
|
||||
override randomBSSFactorySet(
|
||||
species: Species, teamData: RandomTeamsTypes.FactoryTeamDetails
|
||||
): RandomTeamsTypes.RandomFactorySet | null {
|
||||
const id = toID(species.name);
|
||||
|
|
@ -1792,7 +1792,7 @@ export class RandomGen7Teams extends RandomGen8Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomBSSFactoryTeam(side: PlayerOptions, depth = 0): RandomTeamsTypes.RandomFactorySet[] {
|
||||
override randomBSSFactoryTeam(side: PlayerOptions, depth = 0): RandomTeamsTypes.RandomFactorySet[] {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const forceResult = (depth >= 4);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const POWERFUL_ABILITIES = [
|
|||
];
|
||||
|
||||
export class RandomGen7ApexTeams extends RandomGen7Teams {
|
||||
randomSet(
|
||||
override randomSet(
|
||||
species: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { PRNG } from '../../../sim';
|
|||
import { type MoveCounter, RandomGen8Teams, type OldRandomBattleSpecies } from '../gen8/teams';
|
||||
|
||||
export class RandomLetsGoTeams extends RandomGen8Teams {
|
||||
randomData: { [species: string]: OldRandomBattleSpecies } = require('./data.json');
|
||||
override randomData: { [species: string]: OldRandomBattleSpecies } = require('./data.json');
|
||||
|
||||
constructor(format: Format | string, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
|
|
@ -20,7 +20,7 @@ export class RandomLetsGoTeams extends RandomGen8Teams {
|
|||
Water: (movePool, moves, abilities, types, counter) => !counter.get('Water') || !counter.get('stab'),
|
||||
};
|
||||
}
|
||||
shouldCullMove(
|
||||
override shouldCullMove(
|
||||
move: Move,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -116,7 +116,7 @@ export class RandomLetsGoTeams extends RandomGen8Teams {
|
|||
|
||||
return { cull: false };
|
||||
}
|
||||
randomSet(species: string | Species, teamDetails: RandomTeamsTypes.TeamDetails = {}): RandomTeamsTypes.RandomSet {
|
||||
override randomSet(species: string | Species, teamDetails: RandomTeamsTypes.TeamDetails = {}): RandomTeamsTypes.RandomSet {
|
||||
species = this.dex.species.get(species);
|
||||
let forme = species.name;
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ export class RandomLetsGoTeams extends RandomGen8Teams {
|
|||
};
|
||||
}
|
||||
|
||||
randomTeam() {
|
||||
override randomTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const pokemon: RandomTeamsTypes.RandomSet[] = [];
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ import { type PRNG, type PRNGSeed } from '../../../sim/prng';
|
|||
import { type MoveCounter, RandomGen8Teams, type OldRandomBattleSpecies } from '../gen8/teams';
|
||||
|
||||
export class RandomBDSPTeams extends RandomGen8Teams {
|
||||
randomData: { [species: string]: OldRandomBattleSpecies } = require('./data.json');
|
||||
override randomData: { [species: string]: OldRandomBattleSpecies } = require('./data.json');
|
||||
|
||||
constructor(format: Format | string, prng: PRNG | PRNGSeed | null) {
|
||||
super(format, prng);
|
||||
this.noStab = [...this.noStab, 'gigaimpact'];
|
||||
}
|
||||
|
||||
getHighPriorityItem(
|
||||
override getHighPriorityItem(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -71,7 +71,7 @@ export class RandomBDSPTeams extends RandomGen8Teams {
|
|||
if (moves.has('bellydrum')) return 'Sitrus Berry';
|
||||
}
|
||||
|
||||
getMediumPriorityItem(
|
||||
override getMediumPriorityItem(
|
||||
ability: string,
|
||||
moves: Set<string>,
|
||||
counter: MoveCounter,
|
||||
|
|
@ -129,7 +129,7 @@ export class RandomBDSPTeams extends RandomGen8Teams {
|
|||
) return 'Leftovers';
|
||||
}
|
||||
|
||||
getLowPriorityItem(
|
||||
override getLowPriorityItem(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -177,7 +177,7 @@ export class RandomBDSPTeams extends RandomGen8Teams {
|
|||
) return 'Lum Berry';
|
||||
}
|
||||
|
||||
shouldCullMove(
|
||||
override shouldCullMove(
|
||||
move: Move,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
@ -524,7 +524,7 @@ export class RandomBDSPTeams extends RandomGen8Teams {
|
|||
return { cull: false };
|
||||
}
|
||||
|
||||
shouldCullAbility(
|
||||
override shouldCullAbility(
|
||||
ability: string,
|
||||
types: Set<string>,
|
||||
moves: Set<string>,
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
);
|
||||
}
|
||||
|
||||
cullMovePool(
|
||||
override cullMovePool(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -162,7 +162,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
}
|
||||
|
||||
// Generate random moveset for a given species, role, tera type.
|
||||
randomMoveset(
|
||||
override randomMoveset(
|
||||
types: string[],
|
||||
abilities: string[],
|
||||
teamDetails: RandomTeamsTypes.TeamDetails,
|
||||
|
|
@ -421,7 +421,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
return moves;
|
||||
}
|
||||
|
||||
getAbility(
|
||||
override getAbility(
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
abilities: string[],
|
||||
|
|
@ -466,7 +466,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
return this.sample(abilities);
|
||||
}
|
||||
|
||||
getPriorityItem(
|
||||
override getPriorityItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -495,7 +495,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
if (['Harvest', 'Ripen', 'Unburden'].includes(ability) || moves.has('bellydrum')) return 'Oran Berry';
|
||||
}
|
||||
|
||||
getItem(
|
||||
override getItem(
|
||||
ability: string,
|
||||
types: string[],
|
||||
moves: Set<string>,
|
||||
|
|
@ -515,7 +515,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
return 'Eviolite';
|
||||
}
|
||||
|
||||
getLevel(
|
||||
override getLevel(
|
||||
species: Species,
|
||||
): number {
|
||||
if (this.adjustLevel) return this.adjustLevel;
|
||||
|
|
@ -523,7 +523,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
return this.randomSets[species.id]?.level || 10;
|
||||
}
|
||||
|
||||
getForme(species: Species): string {
|
||||
override getForme(species: Species): string {
|
||||
if (typeof species.battleOnly === 'string') {
|
||||
// Only change the forme. The species has custom moves, and may have different typing and requirements.
|
||||
return species.battleOnly;
|
||||
|
|
@ -537,7 +537,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
return species.name;
|
||||
}
|
||||
|
||||
randomSet(
|
||||
override randomSet(
|
||||
s: string | Species,
|
||||
teamDetails: RandomTeamsTypes.TeamDetails = {},
|
||||
isLead = false,
|
||||
|
|
@ -662,7 +662,7 @@ export class RandomBabyTeams extends RandomTeams {
|
|||
};
|
||||
}
|
||||
|
||||
randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
override randomSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
randomBabyTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export class RandomCAPTeams extends RandomTeams {
|
|||
if (ability === 'Mountaineer') return 'Life Orb';
|
||||
}
|
||||
|
||||
getLevel(
|
||||
override getLevel(
|
||||
species: Species,
|
||||
isDoubles: boolean,
|
||||
): number {
|
||||
|
|
@ -182,7 +182,7 @@ export class RandomCAPTeams extends RandomTeams {
|
|||
|
||||
randomCAPSets: { [species: string]: RandomTeamsTypes.RandomSpeciesData } = require('./sets.json');
|
||||
|
||||
randomTeam() {
|
||||
override randomTeam() {
|
||||
this.enforceNoDirectCustomBanlistChanges();
|
||||
|
||||
const seed = this.prng.getSeed();
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ class FileReadStream extends ReadStream {
|
|||
this.atEOF = false;
|
||||
}
|
||||
|
||||
_read(size = 16384): Promise<void> {
|
||||
override _read(size = 16384): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (this.atEOF) return void resolve();
|
||||
this.ensureCapacity(size);
|
||||
|
|
@ -501,7 +501,7 @@ class FileReadStream extends ReadStream {
|
|||
});
|
||||
}
|
||||
|
||||
_destroy() {
|
||||
override _destroy() {
|
||||
return new Promise<void>(resolve => {
|
||||
void this.fd.then(fd => {
|
||||
fs.close(fd, () => resolve());
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ export class NetStream extends Streams.ReadWriteStream {
|
|||
}
|
||||
return out;
|
||||
}
|
||||
_write(data: string | Buffer): Promise<void> | void {
|
||||
override _write(data: string | Buffer): Promise<void> | void {
|
||||
if (!this.nodeWritableStream) {
|
||||
throw new Error("You must specify opts.writable to write to a request.");
|
||||
}
|
||||
|
|
@ -163,10 +163,10 @@ export class NetStream extends Streams.ReadWriteStream {
|
|||
this.drainListeners.push(resolve);
|
||||
});
|
||||
}
|
||||
_read() {
|
||||
override _read() {
|
||||
this.nodeReadableStream?.resume();
|
||||
}
|
||||
_pause() {
|
||||
override _pause() {
|
||||
this.nodeReadableStream?.pause();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class SubprocessStream extends Streams.ObjectReadWriteStream<string> {
|
|||
this.taskId = taskId;
|
||||
this.process.process.send(`${taskId}\nNEW`);
|
||||
}
|
||||
_write(message: string) {
|
||||
override _write(message: string) {
|
||||
if (!this.process.process.connected) {
|
||||
this.pushError(new Error(`Process disconnected (possibly crashed?)`));
|
||||
return;
|
||||
|
|
@ -66,10 +66,10 @@ class SubprocessStream extends Streams.ObjectReadWriteStream<string> {
|
|||
this.process.process.send(`${this.taskId}\nWRITE\n${message}`);
|
||||
// responses are handled in ProcessWrapper
|
||||
}
|
||||
_writeEnd() {
|
||||
override _writeEnd() {
|
||||
this.process.process.send(`${this.taskId}\nWRITEEND`);
|
||||
}
|
||||
_destroy() {
|
||||
override _destroy() {
|
||||
if (!this.process.process.connected) return;
|
||||
this.process.process.send(`${this.taskId}\nDESTROY`);
|
||||
this.process.deleteStream(this.taskId);
|
||||
|
|
@ -83,7 +83,7 @@ class RawSubprocessStream extends Streams.ObjectReadWriteStream<string> {
|
|||
super();
|
||||
this.process = process;
|
||||
}
|
||||
_write(message: string) {
|
||||
override _write(message: string) {
|
||||
if (!this.process.getProcess().connected) {
|
||||
// no error because the crash handler should already have shown an error, and
|
||||
// sometimes harmless messages are sent during cleanup
|
||||
|
|
@ -730,7 +730,7 @@ export class RawProcessManager extends ProcessManager<RawProcessWrapper> {
|
|||
subscribeUnspawn(callback: (worker: StreamWorker) => void) {
|
||||
this.unspawnSubscription = callback;
|
||||
}
|
||||
spawn(count?: number) {
|
||||
override spawn(count?: number) {
|
||||
super.spawn(count);
|
||||
if (!this.workers.length) {
|
||||
this.masterWorker = new StreamWorker(this._setupChild());
|
||||
|
|
@ -744,7 +744,7 @@ export class RawProcessManager extends ProcessManager<RawProcessWrapper> {
|
|||
this.spawnSubscription?.(process);
|
||||
return process;
|
||||
}
|
||||
destroyProcess(process: RawProcessWrapper) {
|
||||
override destroyProcess(process: RawProcessWrapper) {
|
||||
const index = this.workers.indexOf(process);
|
||||
if (index >= 0) this.workers.splice(index, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ export class SQLDatabaseManager extends QueryProcessManager<DatabaseQuery, any>
|
|||
}
|
||||
}
|
||||
}
|
||||
async query(input: DatabaseQuery) {
|
||||
override async query(input: DatabaseQuery) {
|
||||
const result = await super.query(input);
|
||||
if (result?.queryError) {
|
||||
const err = new Error(result.queryError.message);
|
||||
|
|
|
|||
|
|
@ -465,8 +465,8 @@ export class WriteStream {
|
|||
}
|
||||
|
||||
export class ReadWriteStream extends ReadStream implements WriteStream {
|
||||
isReadable: true;
|
||||
isWritable: true;
|
||||
override isReadable: true;
|
||||
override isWritable: true;
|
||||
nodeWritableStream: NodeJS.WritableStream | null;
|
||||
drainListeners: (() => void)[];
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ export class ReadWriteStream extends ReadStream implements WriteStream {
|
|||
* because it's valid for the read stream buffer to be filled only by
|
||||
* `_write`.
|
||||
*/
|
||||
_read(size?: number) {}
|
||||
override _read(size?: number) {}
|
||||
|
||||
_writeEnd(): void | Promise<void> {}
|
||||
|
||||
|
|
@ -818,8 +818,8 @@ interface ObjectReadWriteStreamOptions<T> {
|
|||
}
|
||||
|
||||
export class ObjectReadWriteStream<T> extends ObjectReadStream<T> implements ObjectWriteStream<T> {
|
||||
isReadable: true;
|
||||
isWritable: true;
|
||||
override isReadable: true;
|
||||
override isWritable: true;
|
||||
nodeWritableStream: NodeJS.WritableStream | null;
|
||||
|
||||
constructor(options: ObjectReadWriteStreamOptions<T> = {}) {
|
||||
|
|
@ -839,7 +839,7 @@ export class ObjectReadWriteStream<T> extends ObjectReadStream<T> implements Obj
|
|||
throw new Error(`WriteStream needs to be subclassed and the _write function needs to be implemented.`);
|
||||
}
|
||||
/** In a ReadWriteStream, _read does not need to be implemented. */
|
||||
_read() {}
|
||||
override _read() {}
|
||||
|
||||
_writeEnd(): void | Promise<void> {}
|
||||
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ export function bufReadHex(buf: Uint8Array, start = 0, end?: number) {
|
|||
}
|
||||
|
||||
export class Multiset<T> extends Map<T, number> {
|
||||
get(key: T) {
|
||||
override get(key: T) {
|
||||
return super.get(key) ?? 0;
|
||||
}
|
||||
add(key: T) {
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ class ArtemisStream extends Streams.ObjectReadWriteStream<string> {
|
|||
this.pushEnd();
|
||||
});
|
||||
}
|
||||
_write(chunk: string) {
|
||||
override _write(chunk: string) {
|
||||
const [taskId, message] = Utils.splitFirst(chunk, '\n');
|
||||
this.tasks.add(taskId);
|
||||
this.process.stdin.write(`${taskId}|${message}\n`);
|
||||
}
|
||||
destroy() {
|
||||
override destroy() {
|
||||
try {
|
||||
this.process.kill();
|
||||
} catch {}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export class Announcement extends Rooms.MinorActivity {
|
|||
}
|
||||
}
|
||||
|
||||
onConnect(user: User, connection: Connection | null = null) {
|
||||
override onConnect(user: User, connection: Connection | null = null) {
|
||||
this.displayTo(user, connection);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ export class Auction extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
}
|
||||
|
||||
onChatMessage(message: string, user: User) {
|
||||
override onChatMessage(message: string, user: User) {
|
||||
if (this.state !== 'bid' || this.type !== 'blind') return;
|
||||
if (message.startsWith('.')) message = message.slice(1);
|
||||
if (Number(message.replace(',', '.'))) {
|
||||
|
|
@ -626,7 +626,7 @@ export class Auction extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
}
|
||||
|
||||
onLogMessage(message: string, user: User) {
|
||||
override onLogMessage(message: string, user: User) {
|
||||
if (this.state !== 'bid' || this.type === 'blind') return;
|
||||
if (message.startsWith('.')) message = message.slice(1);
|
||||
if (Number(message.replace(',', '.'))) {
|
||||
|
|
@ -740,7 +740,7 @@ export class Auction extends Rooms.SimpleRoomGame {
|
|||
this.destroy();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
override destroy() {
|
||||
this.clearNomTimer();
|
||||
this.clearBidTimer();
|
||||
super.destroy();
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ export class RipgrepLogSearcher extends FSLogSearcher {
|
|||
lineCount += results.length;
|
||||
return { results, lineCount };
|
||||
}
|
||||
async searchLinecounts(room: RoomID, month: string, user?: ID) {
|
||||
override async searchLinecounts(room: RoomID, month: string, user?: ID) {
|
||||
// don't need to check if logs exist since ripgrepSearchMonth does that
|
||||
const regexString = (
|
||||
user ? `\\|c\\|${this.constructUserRegex(user)}\\|` : `\\|c\\|([^|]+)\\|`
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export class Hangman extends Rooms.SimpleRoomGame {
|
|||
letterGuesses: string[];
|
||||
lastGuesser: string;
|
||||
wordSoFar: string[];
|
||||
readonly checkChat = true;
|
||||
override readonly checkChat = true;
|
||||
|
||||
constructor(
|
||||
room: Room,
|
||||
|
|
@ -91,7 +91,7 @@ export class Hangman extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
}
|
||||
|
||||
choose(user: User, word: string) {
|
||||
override choose(user: User, word: string) {
|
||||
if (user.id === this.creator && !this.options.allowCreator) {
|
||||
throw new Chat.ErrorMessage("You can't guess in your own hangman game.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ export class HelpTicket extends Rooms.SimpleRoomGame {
|
|||
this.lastUnclaimedStart = (ticket.active ? this.createTime : 0);
|
||||
}
|
||||
|
||||
onJoin(user: User, connection: Connection) {
|
||||
override onJoin(user: User, connection: Connection) {
|
||||
if (!this.ticket.open) return false;
|
||||
if (!user.isStaff || user.id === this.ticket.userid) {
|
||||
if (this.emptyRoom) this.emptyRoom = false;
|
||||
|
|
@ -243,7 +243,7 @@ export class HelpTicket extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
}
|
||||
|
||||
onLeave(user: User, oldUserid: ID) {
|
||||
override onLeave(user: User, oldUserid: ID) {
|
||||
const player = this.playerTable[oldUserid || user.id];
|
||||
if (player) {
|
||||
this.removePlayer(player);
|
||||
|
|
@ -274,7 +274,7 @@ export class HelpTicket extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
}
|
||||
|
||||
onLogMessage(message: string, user: User) {
|
||||
override onLogMessage(message: string, user: User) {
|
||||
if (!this.ticket.open) return;
|
||||
if (user.isStaff && this.ticket.userid !== user.id) this.involvedStaff.add(user.id);
|
||||
if (this.ticket.active) return;
|
||||
|
|
@ -309,7 +309,7 @@ export class HelpTicket extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
}
|
||||
|
||||
forfeit(user: User) {
|
||||
override forfeit(user: User) {
|
||||
if (!(user.id in this.playerTable)) return;
|
||||
this.removePlayer(this.playerTable[user.id]);
|
||||
if (!this.ticket.open) return;
|
||||
|
|
@ -458,7 +458,7 @@ export class HelpTicket extends Rooms.SimpleRoomGame {
|
|||
}
|
||||
|
||||
// Modified version of RoomGame.destory
|
||||
destroy() {
|
||||
override destroy() {
|
||||
if (tickets[this.ticket.userid] && this.ticket.open) {
|
||||
// Ticket was not deleted - deleted tickets already have this done to them - and was not closed.
|
||||
// Write stats and change flags as appropriate prior to deletion.
|
||||
|
|
@ -476,7 +476,7 @@ export class HelpTicket extends Rooms.SimpleRoomGame {
|
|||
(this.players as any) = null;
|
||||
(this.playerTable as any) = null;
|
||||
}
|
||||
onChatMessage(message: string, user: User) {
|
||||
override onChatMessage(message: string, user: User) {
|
||||
HelpTicket.uploadReplaysFrom(message, user, user.connections[0]);
|
||||
}
|
||||
// workaround to modlog for no room
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ class Mafia extends Rooms.RoomGame<MafiaPlayer> {
|
|||
phase: 'signups' | 'locked' | 'IDEApicking' | 'IDEAlocked' | 'day' | 'night';
|
||||
dayNum: number;
|
||||
|
||||
timer: NodeJS.Timeout | null;
|
||||
override timer: NodeJS.Timeout | null;
|
||||
dlAt: number;
|
||||
|
||||
IDEA: MafiaIDEAModule;
|
||||
|
|
@ -1777,7 +1777,7 @@ class Mafia extends Rooms.RoomGame<MafiaPlayer> {
|
|||
}
|
||||
}
|
||||
|
||||
onChatMessage(message: string, user: User) {
|
||||
override onChatMessage(message: string, user: User) {
|
||||
const subIndex = this.hostRequestedSub.indexOf(user.id);
|
||||
if (subIndex !== -1) {
|
||||
this.hostRequestedSub.splice(subIndex, 1);
|
||||
|
|
@ -1821,11 +1821,11 @@ class Mafia extends Rooms.RoomGame<MafiaPlayer> {
|
|||
}
|
||||
}
|
||||
|
||||
onConnect(user: User) {
|
||||
override onConnect(user: User) {
|
||||
this.sendUser(user, `|uhtml|mafia|${this.roomWindow()}`);
|
||||
}
|
||||
|
||||
onJoin(user: User) {
|
||||
override onJoin(user: User) {
|
||||
const player = this.getPlayer(user.id);
|
||||
if (player) {
|
||||
return player.updateHtmlRoom();
|
||||
|
|
@ -1833,7 +1833,7 @@ class Mafia extends Rooms.RoomGame<MafiaPlayer> {
|
|||
if (user.id === this.hostid || this.cohostids.includes(user.id)) return this.updateHost(user.id);
|
||||
}
|
||||
|
||||
removeBannedUser(user: User) {
|
||||
override removeBannedUser(user: User) {
|
||||
// Player was banned, attempt to sub now
|
||||
// If we can't sub now, make subbing them out the top priority
|
||||
if (!this.getPlayer(user.id)) return;
|
||||
|
|
@ -1841,7 +1841,7 @@ class Mafia extends Rooms.RoomGame<MafiaPlayer> {
|
|||
this.nextSub();
|
||||
}
|
||||
|
||||
forfeit(user: User) {
|
||||
override forfeit(user: User) {
|
||||
// Add the player to the sub list.
|
||||
const player = this.getPlayer(user.id);
|
||||
if (!player || player.isEliminated()) return;
|
||||
|
|
|
|||
|
|
@ -303,11 +303,11 @@ export class Poll extends Rooms.MinorActivity {
|
|||
}
|
||||
}
|
||||
|
||||
onConnect(user: User, connection: Connection | null = null) {
|
||||
override onConnect(user: User, connection: Connection | null = null) {
|
||||
this.displayTo(user, connection);
|
||||
}
|
||||
|
||||
onRename(user: User, oldid: ID, joining: boolean) {
|
||||
override onRename(user: User, oldid: ID, joining: boolean) {
|
||||
if (user.id in this.voters) {
|
||||
this.updateFor(user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class Ladder {
|
|||
}
|
||||
|
||||
class PlayerLadder extends Ladder {
|
||||
addPoints(name: string, aspect: string, points: number, noUpdate?: boolean) {
|
||||
override addPoints(name: string, aspect: string, points: number, noUpdate?: boolean) {
|
||||
if (!aspect.startsWith('cumulative-')) {
|
||||
this.addPoints(name, `cumulative-${aspect}`, points, noUpdate);
|
||||
}
|
||||
|
|
@ -338,9 +338,9 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
staffHostName: string;
|
||||
scavGame: true;
|
||||
timerEnd: number | null;
|
||||
timer: NodeJS.Timeout | null;
|
||||
override timer: NodeJS.Timeout | null;
|
||||
|
||||
readonly checkChat = true;
|
||||
override readonly checkChat = true;
|
||||
|
||||
[k: string]: any; // for purposes of adding new temporary properties for the purpose of twists.
|
||||
constructor({ room, staffHost, hosts, gameType, questions, isHTML, mod }:
|
||||
|
|
@ -433,7 +433,7 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
}
|
||||
|
||||
// alert new users that are joining the room about the current hunt.
|
||||
onConnect(user: User, connection: Connection) {
|
||||
override onConnect(user: User, connection: Connection) {
|
||||
// send the fact that a hunt is currently going on.
|
||||
connection.sendTo(this.room, this.getCreationMessage());
|
||||
this.runEvent('Connect', user, connection);
|
||||
|
|
@ -462,7 +462,7 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
`(To answer, use <kbd>/scavenge <em>ANSWER</em></kbd>)</div>`;
|
||||
}
|
||||
|
||||
joinGame(user: User) {
|
||||
override joinGame(user: User) {
|
||||
if (this.hosts.some(h => h.id === user.id) || user.id === this.staffHostId) {
|
||||
return user.sendTo(
|
||||
this.room,
|
||||
|
|
@ -492,7 +492,7 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
}
|
||||
}
|
||||
|
||||
leaveGame(user: User) {
|
||||
override leaveGame(user: User) {
|
||||
const player = this.playerTable[user.id];
|
||||
|
||||
if (!player) return user.sendTo(this.room, "You have not joined the scavenger hunt.");
|
||||
|
|
@ -589,7 +589,7 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
return minutes;
|
||||
}
|
||||
|
||||
choose(user: User, originalValue: string) {
|
||||
override choose(user: User, originalValue: string) {
|
||||
if (!(user.id in this.playerTable)) {
|
||||
if (!this.joinGame(user)) return false;
|
||||
}
|
||||
|
|
@ -858,7 +858,7 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
}
|
||||
|
||||
// modify destroy to get rid of any timers in the current roomgame.
|
||||
destroy() {
|
||||
override destroy() {
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
}
|
||||
|
|
@ -925,9 +925,9 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
return true;
|
||||
}
|
||||
|
||||
onUpdateConnection() {}
|
||||
override onUpdateConnection() {}
|
||||
|
||||
onChatMessage(msg: string) {
|
||||
override onChatMessage(msg: string) {
|
||||
let msgId = toID(msg) as string;
|
||||
|
||||
// identify if there is a bot/dt command that failed
|
||||
|
|
@ -1004,7 +1004,7 @@ export class ScavengerHunt extends Rooms.RoomGame<ScavengerHuntPlayer> {
|
|||
|
||||
export class ScavengerHuntPlayer extends Rooms.RoomGamePlayer<ScavengerHunt> {
|
||||
lastGuess: number;
|
||||
completed: boolean;
|
||||
override completed: boolean;
|
||||
joinIps: string[];
|
||||
currentQuestion: number;
|
||||
|
||||
|
|
@ -1040,7 +1040,7 @@ export class ScavengerHuntPlayer extends Rooms.RoomGamePlayer<ScavengerHunt> {
|
|||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
override destroy() {
|
||||
const user = Users.getExact(this.id);
|
||||
if (user) {
|
||||
user.games.delete(this.game.roomid);
|
||||
|
|
|
|||
|
|
@ -485,21 +485,21 @@ export class Trivia extends Rooms.RoomGame<TriviaPlayer> {
|
|||
return new TriviaPlayer(user, this);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
override destroy() {
|
||||
if (this.phaseTimeout) clearTimeout(this.phaseTimeout);
|
||||
this.phaseTimeout = null;
|
||||
this.kickedUsers.clear();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
onConnect(user: User) {
|
||||
override onConnect(user: User) {
|
||||
const player = this.playerTable[user.id];
|
||||
if (!player?.isAbsent) return false;
|
||||
|
||||
player.toggleAbsence();
|
||||
}
|
||||
|
||||
onLeave(user: User, oldUserID: ID) {
|
||||
override onLeave(user: User, oldUserID: ID) {
|
||||
// The user cannot participate, but their score should be kept
|
||||
// regardless in cases of disconnects.
|
||||
const player = this.playerTable[oldUserID || user.id];
|
||||
|
|
@ -886,7 +886,7 @@ const hrtimeToNanoseconds = (hrtime: number[]) => hrtime[0] * 1e9 + hrtime[1];
|
|||
* correctly.
|
||||
*/
|
||||
export class FirstModeTrivia extends Trivia {
|
||||
answerQuestion(answer: string, user: User) {
|
||||
override answerQuestion(answer: string, user: User) {
|
||||
const player = this.playerTable[user.id];
|
||||
if (!player) throw new Chat.ErrorMessage(this.room.tr`You are not a player in the current trivia game.`);
|
||||
if (this.isPaused) throw new Chat.ErrorMessage(this.room.tr`The trivia game is paused.`);
|
||||
|
|
@ -923,11 +923,11 @@ export class FirstModeTrivia extends Trivia {
|
|||
this.setAskTimeout();
|
||||
}
|
||||
|
||||
calculatePoints() {
|
||||
override calculatePoints() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
tallyAnswers(): void {
|
||||
override tallyAnswers(): void {
|
||||
if (this.isPaused) return;
|
||||
this.phase = INTERMISSION_PHASE;
|
||||
|
||||
|
|
@ -957,7 +957,7 @@ export class FirstModeTrivia extends Trivia {
|
|||
* depending on how quickly they answer the question.
|
||||
*/
|
||||
export class TimerModeTrivia extends Trivia {
|
||||
answerQuestion(answer: string, user: User) {
|
||||
override answerQuestion(answer: string, user: User) {
|
||||
const player = this.playerTable[user.id];
|
||||
if (!player) throw new Chat.ErrorMessage(this.room.tr`You are not a player in the current trivia game.`);
|
||||
if (this.isPaused) throw new Chat.ErrorMessage(this.room.tr`The trivia game is paused.`);
|
||||
|
|
@ -973,11 +973,11 @@ export class TimerModeTrivia extends Trivia {
|
|||
* The difference between the time scoring began and the time the question
|
||||
* was asked, in nanoseconds.
|
||||
*/
|
||||
calculatePoints(diff: number, totalDiff: number) {
|
||||
override calculatePoints(diff: number, totalDiff: number) {
|
||||
return Math.floor(6 - 5 * diff / totalDiff);
|
||||
}
|
||||
|
||||
tallyAnswers() {
|
||||
override tallyAnswers() {
|
||||
if (this.isPaused) return;
|
||||
this.phase = INTERMISSION_PHASE;
|
||||
|
||||
|
|
@ -1062,7 +1062,7 @@ export class TimerModeTrivia extends Trivia {
|
|||
* better).
|
||||
*/
|
||||
export class NumberModeTrivia extends Trivia {
|
||||
answerQuestion(answer: string, user: User) {
|
||||
override answerQuestion(answer: string, user: User) {
|
||||
const player = this.playerTable[user.id];
|
||||
if (!player) throw new Chat.ErrorMessage(this.room.tr`You are not a player in the current trivia game.`);
|
||||
if (this.isPaused) throw new Chat.ErrorMessage(this.room.tr`The trivia game is paused.`);
|
||||
|
|
@ -1072,15 +1072,15 @@ export class NumberModeTrivia extends Trivia {
|
|||
player.setAnswer(answer, isCorrect);
|
||||
}
|
||||
|
||||
calculatePoints(correctPlayers: number) {
|
||||
override calculatePoints(correctPlayers: number) {
|
||||
return correctPlayers && (6 - Math.floor(5 * correctPlayers / this.playerCount));
|
||||
}
|
||||
|
||||
getRoundLength() {
|
||||
override getRoundLength() {
|
||||
return 6 * 1000;
|
||||
}
|
||||
|
||||
tallyAnswers() {
|
||||
override tallyAnswers() {
|
||||
if (this.isPaused) return;
|
||||
this.phase = INTERMISSION_PHASE;
|
||||
|
||||
|
|
@ -1137,7 +1137,7 @@ export class NumberModeTrivia extends Trivia {
|
|||
* Triumvirate mode rewards points to the top three users to answer the question correctly.
|
||||
*/
|
||||
export class TriumvirateModeTrivia extends Trivia {
|
||||
answerQuestion(answer: string, user: User) {
|
||||
override answerQuestion(answer: string, user: User) {
|
||||
const player = this.playerTable[user.id];
|
||||
if (!player) throw new Chat.ErrorMessage(this.room.tr`You are not a player in the current trivia game.`);
|
||||
if (this.isPaused) throw new Chat.ErrorMessage(this.room.tr`The trivia game is paused.`);
|
||||
|
|
@ -1150,11 +1150,11 @@ export class TriumvirateModeTrivia extends Trivia {
|
|||
}
|
||||
}
|
||||
|
||||
calculatePoints(answerNumber: number) {
|
||||
override calculatePoints(answerNumber: number) {
|
||||
return 5 - answerNumber * 2; // 5 points to 1st, 3 points to 2nd, 1 point to 1st
|
||||
}
|
||||
|
||||
tallyAnswers() {
|
||||
override tallyAnswers() {
|
||||
if (this.isPaused) return;
|
||||
this.phase = INTERMISSION_PHASE;
|
||||
const correctPlayers = Object.values(this.playerTable).filter(p => p.isCorrect);
|
||||
|
|
@ -1433,9 +1433,9 @@ export class MastermindRound extends FirstModeTrivia {
|
|||
this.start();
|
||||
}
|
||||
|
||||
init() {
|
||||
override init() {
|
||||
}
|
||||
start() {
|
||||
override start() {
|
||||
const player = Object.values(this.playerTable)[0];
|
||||
const name = Utils.escapeHTML(player.name);
|
||||
broadcast(this.room, this.room.tr`A Mastermind round in the ${this.game.category} category for ${name} is starting!`);
|
||||
|
|
@ -1447,17 +1447,17 @@ export class MastermindRound extends FirstModeTrivia {
|
|||
this.setPhaseTimeout(() => void this.askQuestion(), MASTERMIND_INTERMISSION_INTERVAL);
|
||||
}
|
||||
|
||||
win(): Promise<void> {
|
||||
override win(): Promise<void> {
|
||||
if (this.phaseTimeout) clearTimeout(this.phaseTimeout);
|
||||
this.phaseTimeout = null;
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
addTriviaPlayer(user: User): string | undefined {
|
||||
override addTriviaPlayer(user: User): string | undefined {
|
||||
throw new Chat.ErrorMessage(`This is a round of Mastermind; to join the overall game of Mastermind, use /mm join`);
|
||||
}
|
||||
|
||||
setTallyTimeout() {
|
||||
override setTallyTimeout() {
|
||||
// Players must use /mastermind pass to pass on a question
|
||||
}
|
||||
|
||||
|
|
@ -1465,11 +1465,11 @@ export class MastermindRound extends FirstModeTrivia {
|
|||
this.tallyAnswers();
|
||||
}
|
||||
|
||||
setAskTimeout() {
|
||||
override setAskTimeout() {
|
||||
this.setPhaseTimeout(() => void this.askQuestion(), MASTERMIND_INTERMISSION_INTERVAL);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
override destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
|
@ -1492,7 +1492,7 @@ export class MastermindFinals extends MastermindRound {
|
|||
this.setPhaseTimeout(() => void this.askQuestion(), MASTERMIND_FINALS_START_TIMEOUT);
|
||||
}
|
||||
|
||||
async win() {
|
||||
override async win() {
|
||||
await super.win();
|
||||
const points = new Map<string, number>();
|
||||
for (const id in this.playerTable) {
|
||||
|
|
@ -1500,9 +1500,9 @@ export class MastermindFinals extends MastermindRound {
|
|||
}
|
||||
}
|
||||
|
||||
setTallyTimeout = FirstModeTrivia.prototype.setTallyTimeout;
|
||||
override setTallyTimeout = FirstModeTrivia.prototype.setTallyTimeout;
|
||||
|
||||
pass() {
|
||||
override pass() {
|
||||
throw new Chat.ErrorMessage(this.room.tr`You cannot pass in the finals.`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ abstract class Giveaway extends Rooms.SimpleRoomGame {
|
|||
gaNumber: number;
|
||||
host: User;
|
||||
giver: User;
|
||||
room: Room;
|
||||
override room: Room;
|
||||
ot: string;
|
||||
tid: string;
|
||||
game: Game;
|
||||
|
|
@ -116,7 +116,7 @@ abstract class Giveaway extends Rooms.SimpleRoomGame {
|
|||
* IP:userid
|
||||
*/
|
||||
joined: Map<string, ID>;
|
||||
timer: NodeJS.Timeout | null;
|
||||
override timer: NodeJS.Timeout | null;
|
||||
pokemonID: ID;
|
||||
sprite: Chat.VNode;
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ abstract class Giveaway extends Rooms.SimpleRoomGame {
|
|||
[this.pokemonID, this.sprite] = Giveaway.getSprite(prize);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
override destroy() {
|
||||
this.clearTimer();
|
||||
super.destroy();
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ export class QuestionGiveaway extends Giveaway {
|
|||
this.timer = setTimeout(() => this.end(false), 1000 * 60 * 5);
|
||||
}
|
||||
|
||||
choose(user: User, guess: string) {
|
||||
override choose(user: User, guess: string) {
|
||||
if (this.phase !== 'started') return user.sendTo(this.room, "The giveaway has not started yet.");
|
||||
|
||||
if (this.checkJoined(user) && ![...this.joined.values()].includes(user.id)) {
|
||||
|
|
@ -551,7 +551,7 @@ export class QuestionGiveaway extends Giveaway {
|
|||
);
|
||||
}
|
||||
|
||||
checkExcluded(user: User) {
|
||||
override checkExcluded(user: User) {
|
||||
if (user === this.host) return true;
|
||||
if (this.host.ips.includes(user.latestIp) && !Config.noipchecks) return true;
|
||||
if (this.host.previousIDs.includes(toID(user))) return true;
|
||||
|
|
@ -631,7 +631,7 @@ export class LotteryGiveaway extends Giveaway {
|
|||
};
|
||||
}
|
||||
|
||||
generateReminder(joined = false) {
|
||||
override generateReminder(joined = false) {
|
||||
const cmd = (joined ? 'Leave' : 'Join');
|
||||
return this.generateWindow(<>
|
||||
The lottery drawing will occur in 2 minutes, and with {Chat.count(this.maxWinners, "winners")}!<br />
|
||||
|
|
@ -739,7 +739,7 @@ export class LotteryGiveaway extends Giveaway {
|
|||
export class GTS extends Rooms.SimpleRoomGame {
|
||||
override readonly gameid = 'gts' as ID;
|
||||
gtsNumber: number;
|
||||
room: Room;
|
||||
override room: Room;
|
||||
giver: User;
|
||||
left: number;
|
||||
summary: string;
|
||||
|
|
@ -749,7 +749,7 @@ export class GTS extends Rooms.SimpleRoomGame {
|
|||
sprite: Chat.VNode;
|
||||
sent: string[];
|
||||
noDeposits: boolean;
|
||||
timer: NodeJS.Timeout | null;
|
||||
override timer: NodeJS.Timeout | null;
|
||||
|
||||
constructor(
|
||||
room: Room, giver: User, amount: number,
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ export class GroupWatch extends Rooms.SimpleRoomGame {
|
|||
this.url = url;
|
||||
this.info = videoInfo;
|
||||
}
|
||||
onJoin(user: User) {
|
||||
override onJoin(user: User) {
|
||||
const hints = this.hints();
|
||||
for (const hint of hints) {
|
||||
user.sendTo(this.room.roomid, `|html|${hint}`);
|
||||
|
|
@ -478,7 +478,7 @@ export class GroupWatch extends Rooms.SimpleRoomGame {
|
|||
this.info = info;
|
||||
this.update();
|
||||
}
|
||||
destroy() {
|
||||
override destroy() {
|
||||
GroupWatch.groupwatches.delete(this.id);
|
||||
this.room.game = null;
|
||||
this.room = null!;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export class GameChallenge extends AbstractChallenge {
|
|||
*/
|
||||
export class BattleInvite extends AbstractChallenge {
|
||||
declare acceptCommand: string;
|
||||
destroy(accepted?: boolean) {
|
||||
override destroy(accepted?: boolean) {
|
||||
if (accepted) return;
|
||||
|
||||
const room = Rooms.get(this.roomid);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class PunishmentMap extends Map<string, Punishment[]> {
|
|||
}
|
||||
}
|
||||
}
|
||||
get(k: string) {
|
||||
override get(k: string) {
|
||||
const punishments = super.get(k);
|
||||
if (punishments) {
|
||||
this.removeExpiring(punishments);
|
||||
|
|
@ -104,7 +104,7 @@ class PunishmentMap extends Map<string, Punishment[]> {
|
|||
}
|
||||
return undefined;
|
||||
}
|
||||
has(k: string) {
|
||||
override has(k: string) {
|
||||
return !!this.get(k);
|
||||
}
|
||||
getByType(k: string, type: string) {
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ export class BestOfGame extends RoomGame<BestOfPlayer> {
|
|||
}
|
||||
}
|
||||
|
||||
onBattleWin(room: Room, winnerid: ID) {
|
||||
override onBattleWin(room: Room, winnerid: ID) {
|
||||
if (this.ended) return; // can happen if the bo3 is destroyed fsr
|
||||
|
||||
const winner = winnerid ? this.playerTable[winnerid] : null;
|
||||
|
|
|
|||
|
|
@ -1951,7 +1951,7 @@ export class GameRoom extends BasicRoom {
|
|||
if (!(user.id in this.game.playerTable)) return this.getLog();
|
||||
return this.getLog(this.game.playerTable[user.id].num as 0);
|
||||
}
|
||||
update(excludeUser: User | null = null) {
|
||||
override update(excludeUser: User | null = null) {
|
||||
if (!this.log.broadcastBuffer.length) return;
|
||||
|
||||
if (this.userCount) {
|
||||
|
|
@ -1961,7 +1961,7 @@ export class GameRoom extends BasicRoom {
|
|||
|
||||
this.pokeExpireTimer();
|
||||
}
|
||||
pokeExpireTimer() {
|
||||
override pokeExpireTimer() {
|
||||
// empty rooms time out after ten minutes
|
||||
if (!this.userCount) {
|
||||
if (this.expireTimer) clearTimeout(this.expireTimer);
|
||||
|
|
@ -1980,11 +1980,11 @@ export class GameRoom extends BasicRoom {
|
|||
return "Modchat can only be changed by the user who turned it on, or by staff";
|
||||
}
|
||||
}
|
||||
onConnect(user: User, connection: Connection) {
|
||||
override onConnect(user: User, connection: Connection) {
|
||||
this.sendUser(connection, '|init|battle\n|title|' + this.title + '\n' + this.getLogForUser(user));
|
||||
this.game?.onConnect?.(user, connection);
|
||||
}
|
||||
onJoin(user: User, connection: Connection) {
|
||||
override onJoin(user: User, connection: Connection) {
|
||||
if (!user) return false; // ???
|
||||
if (this.users[user.id]) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ export class ServerStream extends Streams.ObjectReadWriteStream<string> {
|
|||
});
|
||||
}
|
||||
|
||||
_write(data: string) {
|
||||
override _write(data: string) {
|
||||
// console.log('worker received: ' + data);
|
||||
|
||||
const receiver = this.receivers[data.charAt(0)];
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ export class Tournament extends Rooms.RoomGame<TournamentPlayer> {
|
|||
room.send(`|tournament|update|${JSON.stringify(update)}`);
|
||||
this.update();
|
||||
}
|
||||
destroy() {
|
||||
override destroy() {
|
||||
this.forceEnd();
|
||||
}
|
||||
remove() {
|
||||
|
|
@ -379,7 +379,7 @@ export class Tournament extends Rooms.RoomGame<TournamentPlayer> {
|
|||
return Punishments.hasRoomPunishType(room, toID(user), 'TOURBAN');
|
||||
}
|
||||
|
||||
removeBannedUser(userid: User | ID) {
|
||||
override removeBannedUser(userid: User | ID) {
|
||||
userid = toID(userid);
|
||||
if (!(userid in this.playerTable)) return;
|
||||
if (this.isTournamentStarted) {
|
||||
|
|
@ -1078,16 +1078,16 @@ export class Tournament extends Rooms.RoomGame<TournamentPlayer> {
|
|||
getDefaultCustomName() {
|
||||
return Dex.formats.get(this.fullFormat).name + " (with custom rules)";
|
||||
}
|
||||
forfeit(user: User) {
|
||||
override forfeit(user: User) {
|
||||
return this.disqualifyUser(user.id, null, "You left the tournament", true);
|
||||
}
|
||||
onConnect(user: User, connection: Connection) {
|
||||
override onConnect(user: User, connection: Connection) {
|
||||
this.updateFor(user, connection);
|
||||
}
|
||||
onUpdateConnection(user: User, connection: Connection) {
|
||||
override onUpdateConnection(user: User, connection: Connection) {
|
||||
this.updateFor(user, connection);
|
||||
}
|
||||
onRename(user: User, oldUserid: ID) {
|
||||
override onRename(user: User, oldUserid: ID) {
|
||||
if (oldUserid in this.playerTable) {
|
||||
this.renamePlayer(user, oldUserid);
|
||||
}
|
||||
|
|
@ -1107,7 +1107,7 @@ export class Tournament extends Rooms.RoomGame<TournamentPlayer> {
|
|||
}
|
||||
}
|
||||
}
|
||||
onBattleWin(room: GameRoom, winnerid: ID) {
|
||||
override onBattleWin(room: GameRoom, winnerid: ID) {
|
||||
if (this.completedMatches.has(room.roomid)) return;
|
||||
this.completedMatches.add(room.roomid);
|
||||
room.setParent(null);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export abstract class Auth extends Map<ID, GroupSymbol | ''> {
|
|||
* Passing a User will read `user.group`, which is relevant for unregistered
|
||||
* users with temporary global auth.
|
||||
*/
|
||||
get(user: ID | User) {
|
||||
override get(user: ID | User) {
|
||||
if (typeof user !== 'string') return user.tempGroup;
|
||||
return super.get(user) || Auth.defaultSymbol();
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ export class RoomAuth extends Auth {
|
|||
super();
|
||||
this.room = room;
|
||||
}
|
||||
get(userOrID: ID | User): GroupSymbol {
|
||||
override get(userOrID: ID | User): GroupSymbol {
|
||||
const id = typeof userOrID === 'string' ? userOrID : userOrID.id;
|
||||
|
||||
const parentAuth: Auth | null = this.room.parent ? this.room.parent.auth :
|
||||
|
|
@ -280,7 +280,7 @@ export class RoomAuth extends Auth {
|
|||
|
||||
return parentGroup;
|
||||
}
|
||||
getEffectiveSymbol(user: User) {
|
||||
override getEffectiveSymbol(user: User) {
|
||||
const symbol = super.getEffectiveSymbol(user);
|
||||
if (!this.room.persist && symbol === user.tempGroup) {
|
||||
const replaceGroup = Auth.getGroup(symbol).globalGroupInPersonalRoom;
|
||||
|
|
@ -315,7 +315,7 @@ export class RoomAuth extends Auth {
|
|||
super.set(userid as ID, this.room.settings.auth[userid]);
|
||||
}
|
||||
}
|
||||
set(id: ID, symbol: GroupSymbol) {
|
||||
override set(id: ID, symbol: GroupSymbol) {
|
||||
if (symbol === 'whitelist' as GroupSymbol) {
|
||||
symbol = Auth.defaultSymbol();
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ export class RoomAuth extends Auth {
|
|||
if (user) this.room.onUpdateIdentity(user);
|
||||
return this;
|
||||
}
|
||||
delete(id: ID) {
|
||||
override delete(id: ID) {
|
||||
if (!this.has(id)) return false;
|
||||
super.delete(id);
|
||||
delete this.room.settings.auth[id];
|
||||
|
|
@ -379,7 +379,7 @@ export class GlobalAuth extends Auth {
|
|||
super.set(id, newSymbol);
|
||||
}
|
||||
}
|
||||
set(id: ID, group: GroupSymbol, username?: string) {
|
||||
override set(id: ID, group: GroupSymbol, username?: string) {
|
||||
if (!username) username = id;
|
||||
const user = Users.get(id, true);
|
||||
if (user) {
|
||||
|
|
@ -393,7 +393,7 @@ export class GlobalAuth extends Auth {
|
|||
void this.save();
|
||||
return this;
|
||||
}
|
||||
delete(id: ID) {
|
||||
override delete(id: ID) {
|
||||
if (!super.has(id)) return false;
|
||||
super.delete(id);
|
||||
const user = Users.get(id);
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ export interface UserSettings {
|
|||
// User
|
||||
export class User extends Chat.MessageContext {
|
||||
/** In addition to needing it to implement MessageContext, this is also nice for compatibility with Connection. */
|
||||
readonly user: User;
|
||||
override readonly user: User;
|
||||
/**
|
||||
* Not a source of truth - should always be in sync with
|
||||
* `[...Rooms.rooms.values()].filter(room => this.id in room.users)`
|
||||
|
|
@ -358,7 +358,7 @@ export class User extends Chat.MessageContext {
|
|||
id: ID;
|
||||
tempGroup: GroupSymbol;
|
||||
avatar: string | number;
|
||||
language: ID | null;
|
||||
override language: ID | null;
|
||||
|
||||
connected: boolean;
|
||||
connections: Connection[];
|
||||
|
|
@ -1556,7 +1556,7 @@ export class User extends Chat.MessageContext {
|
|||
this.punishmentTimer = null;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
override toString() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export class BattleStream extends Streams.ObjectReadWriteStream<string> {
|
|||
this.battle = null;
|
||||
}
|
||||
|
||||
_write(chunk: string) {
|
||||
override _write(chunk: string) {
|
||||
if (this.noCatch) {
|
||||
this._writeLines(chunk);
|
||||
} else {
|
||||
|
|
@ -235,13 +235,13 @@ export class BattleStream extends Streams.ObjectReadWriteStream<string> {
|
|||
}
|
||||
}
|
||||
|
||||
_writeEnd() {
|
||||
override _writeEnd() {
|
||||
// if battle already ended, we don't need to pushEnd.
|
||||
if (!this.atEOF) this.pushEnd();
|
||||
this._destroy();
|
||||
}
|
||||
|
||||
_destroy() {
|
||||
override _destroy() {
|
||||
if (this.battle) this.battle.destroy();
|
||||
}
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ export class BattleTextStream extends Streams.ReadWriteStream {
|
|||
this.pushEnd();
|
||||
}
|
||||
|
||||
_write(message: string | Buffer) {
|
||||
override _write(message: string | Buffer) {
|
||||
this.currentMessage += `${message}`;
|
||||
const index = this.currentMessage.lastIndexOf('\n');
|
||||
if (index >= 0) {
|
||||
|
|
@ -388,7 +388,7 @@ export class BattleTextStream extends Streams.ReadWriteStream {
|
|||
}
|
||||
}
|
||||
|
||||
_writeEnd() {
|
||||
override _writeEnd() {
|
||||
return this.battleStream.writeEnd();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export abstract class BasicEffect implements EffectData {
|
|||
}
|
||||
|
||||
export class Nature extends BasicEffect implements Readonly<BasicEffect & NatureData> {
|
||||
readonly effectType: 'Nature';
|
||||
override readonly effectType: 'Nature';
|
||||
readonly plus?: StatIDExceptHP;
|
||||
readonly minus?: StatIDExceptHP;
|
||||
constructor(data: AnyObject) {
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ export class Format extends BasicEffect implements Readonly<BasicEffect> {
|
|||
* random/fixed teams. null if players can bring teams.
|
||||
*/
|
||||
declare readonly team?: string;
|
||||
readonly effectType: FormatEffectType;
|
||||
override readonly effectType: FormatEffectType;
|
||||
readonly debug: boolean;
|
||||
/**
|
||||
* Whether or not a format will update ladder points if searched
|
||||
|
|
|
|||
|
|
@ -409,11 +409,11 @@ class CoordinatedPlayerAI extends RandomPlayerAI {
|
|||
this.pools = pools;
|
||||
}
|
||||
|
||||
protected chooseTeamPreview(team: AnyObject[]): string {
|
||||
protected override chooseTeamPreview(team: AnyObject[]): string {
|
||||
return `team ${this.choosePokemon(team.map((p, i) => ({ slot: i + 1, pokemon: p }))) || 1}`;
|
||||
}
|
||||
|
||||
protected chooseMove(active: AnyObject, moves: { choice: string, move: AnyObject }[]): string {
|
||||
protected override chooseMove(active: AnyObject, moves: { choice: string, move: AnyObject }[]): string {
|
||||
this.markUsedIfGmax(active);
|
||||
// Prefer to use a move which hasn't been used yet.
|
||||
for (const { choice, move } of moves) {
|
||||
|
|
@ -426,7 +426,7 @@ class CoordinatedPlayerAI extends RandomPlayerAI {
|
|||
return super.chooseMove(active, moves);
|
||||
}
|
||||
|
||||
protected chooseSwitch(active: AnyObject | undefined, switches: { slot: number, pokemon: AnyObject }[]): number {
|
||||
protected override chooseSwitch(active: AnyObject | undefined, switches: { slot: number, pokemon: AnyObject }[]): number {
|
||||
this.markUsedIfGmax(active);
|
||||
return this.choosePokemon(switches) || super.chooseSwitch(active, switches);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export class RandomPlayerAI extends BattlePlayer {
|
|||
this.prng = PRNG.get(options.seed);
|
||||
}
|
||||
|
||||
receiveError(error: Error) {
|
||||
override receiveError(error: Error) {
|
||||
// If we made an unavailable choice we will receive a followup request to
|
||||
// allow us the opportunity to correct our decision.
|
||||
if (error.message.startsWith('[Unavailable choice]')) return;
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ class RawBattleStream extends BattleStreams.BattleStream {
|
|||
this.rawInputLog = [];
|
||||
}
|
||||
|
||||
_write(message: string) {
|
||||
override _write(message: string) {
|
||||
if (this.input) console.log(message);
|
||||
this.rawInputLog.push(message);
|
||||
super._write(message);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"incremental": true,
|
||||
"allowUnreachableCode": false,
|
||||
"esModuleInterop": true,
|
||||
"noImplicitOverride": false,
|
||||
"noImplicitOverride": true,
|
||||
"useDefineForClassFields": false
|
||||
},
|
||||
"types": ["node"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user