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

View file

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