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

Change default value of FormatEffectType to Rule #10637

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/chat-commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ export const commands: Chat.ChatCommands = {

if (!this.runBroadcast(`!formathelp ${format ? format.id : target}`)) return;

if (format) {
if (format?.exists) {
const rules: string[] = [];
let rulesetHtml = '';
if (['Format', 'Rule', 'ValidatorRule'].includes(format.effectType)) {
Expand Down
2 changes: 1 addition & 1 deletion server/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export abstract class MessageContext {
}

const format = Dex.formats.get(formatOrMod);
if (format.effectType === 'Format' || allowRules && format.effectType === 'Rule') {
if (format.exists && (format.effectType === 'Format' || allowRules && format.effectType === 'Rule')) {
return {dex: Dex.forFormat(format), format: format, isMatch: true};
}

Expand Down
4 changes: 2 additions & 2 deletions sim/dex-formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type ModdedFormatData = FormatData | Omit<FormatData, 'name'> & {inherit:
export interface FormatDataTable {[id: IDEntry]: FormatData}
export interface ModdedFormatDataTable {[id: IDEntry]: ModdedFormatData}

type FormatEffectType = 'Format' | 'Ruleset' | 'Rule' | 'ValidatorRule';
type FormatEffectType = 'Format' | 'Rule' | 'ValidatorRule';

/** rule, source, limit, bans */
export type ComplexBan = [string, string, number, string[]];
Expand Down Expand Up @@ -480,7 +480,7 @@ export class Format extends BasicEffect implements Readonly<BasicEffect> {
super(data);

this.mod = Utils.getString(data.mod) || 'gen9';
this.effectType = Utils.getString(data.effectType) as FormatEffectType || 'Format';
this.effectType = Utils.getString(data.effectType) as FormatEffectType || 'Rule';
this.debug = !!data.debug;
this.rated = (typeof data.rated === 'string' ? data.rated : data.rated !== false);
this.gameType = data.gameType || 'singles';
Expand Down
Loading