This commit is contained in:
syuilo 2020-01-26 05:21:25 +09:00
parent 56a5718cbd
commit 9d05f97942
2 changed files with 26 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import Module from '../../module';
import Message from '../../message'; import Message from '../../message';
import serifs from '../../serifs'; import serifs from '../../serifs';
import * as seedrandom from 'seedrandom'; import * as seedrandom from 'seedrandom';
import { blessing, itemPrefixes, items } from './vocabulary'; import { blessing, itemPrefixes, items, and } from './vocabulary';
export default class extends Module { export default class extends Module {
public readonly name = 'fortune'; public readonly name = 'fortune';
@ -22,9 +22,15 @@ export default class extends Module {
const seed = `${date.getFullYear()}/${date.getMonth()}/${date.getDate()}@${msg.userId}`; const seed = `${date.getFullYear()}/${date.getMonth()}/${date.getDate()}@${msg.userId}`;
const rng = seedrandom(seed); const rng = seedrandom(seed);
const omikuji = blessing[Math.floor(rng() * blessing.length)]; const omikuji = blessing[Math.floor(rng() * blessing.length)];
const itemPrefix = Math.floor(rng() * 5) != 0 ? itemPrefixes[Math.floor(rng() * itemPrefixes.length)] : ''; let item = '';
const item = items[Math.floor(rng() * items.length)]; if (Math.floor(rng() * 5) !== 0) item += itemPrefixes[Math.floor(rng() * itemPrefixes.length)];
msg.reply(`**${omikuji}🎉**\nラッキーアイテム: ${itemPrefix}${item}`, serifs.fortune.cw(msg.friend.name)); item += items[Math.floor(rng() * items.length)];
if (Math.floor(rng() * 3) === 0) {
item += and[Math.floor(rng() * and.length)];
if (Math.floor(rng() * 5) !== 0) item += itemPrefixes[Math.floor(rng() * itemPrefixes.length)];
item += items[Math.floor(rng() * items.length)];
}
msg.reply(`**${omikuji}🎉**\nラッキーアイテム: ${item}`, serifs.fortune.cw(msg.friend.name));
return true; return true;
} else { } else {
return false; return false;

View file

@ -210,4 +210,20 @@ export const items = [
'油圧ジャッキ', '油圧ジャッキ',
'タピオカ', 'タピオカ',
'トイレットペーパーの芯', 'トイレットペーパーの芯',
'ダンボール箱',
'ハニワ',
'ボールペン',
'シャーペン',
];
export const and = [
'に擬態した',
'入りの',
'が埋め込まれた',
'を連想させる',
'っぽい',
'に見せかけて',
'を虐げる',
'が上に乗った',
'のそばにある',
]; ];