diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index e0fb5087a..6483eb541 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2200,6 +2200,9 @@ pages: _mod: arg1: "A" arg2: "B" + round: "少数を丸める" + _round: + arg1: "数" eq: "AとBが同じ" _eq: arg1: "A" diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index f6165afb6..857de1308 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -162,6 +162,7 @@ export class ASEvaluator { multiply: (a: number, b: number) => a * b, divide: (a: number, b: number) => a / b, mod: (a: number, b: number) => a % b, + round: (a: number) => Math.round(a), strLen: (a: string) => a.length, strPick: (a: string, b: number) => a[b - 1], strReplace: (a: string, b: string, c: string) => a.split(b).join(c), diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts index 3a21e9b1c..f2de1bb40 100644 --- a/src/misc/aiscript/index.ts +++ b/src/misc/aiscript/index.ts @@ -24,6 +24,7 @@ import { faExchangeAlt, faRecycle, faIndent, + faCalculator, } from '@fortawesome/free-solid-svg-icons'; import { faFlag } from '@fortawesome/free-regular-svg-icons'; @@ -59,6 +60,7 @@ export const funcDefs: Record<string, { in: any[]; out: any; category: string; i multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, }, divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, }, mod: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, }, + round: { in: ['number'], out: 'number', category: 'operation', icon: faCalculator, }, eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, }, notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, }, gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, },