UNPKG

la-cosa-nostra

Version:

A Mafia bot designed to run in Discord - beware the traitors and the lies!

37 lines (25 loc) 1.17 kB
var rs = require("../../../rolesystem/rolesystem.js"); var auxils = require("../../../systems/auxils.js"); module.exports = function (actionable, game, params) { var visit_log = game.actions.visit_log; var visited_names = new Array(); var visitor_names = new Array(); for (var i = 0; i < visit_log.length; i++) { if (visit_log[i].visitor === actionable.to) { // Target var visited = game.getPlayerByIdentifier(visit_log[i].target); visited_names.push("**" + visited.getDisplayName() + "**"); }; if (visit_log[i].target === actionable.to) { // Target var visitor = game.getPlayerByIdentifier(visit_log[i].visitor); visitor_names.push("**" + visitor.getDisplayName() + "**"); }; }; var nightwatcher = game.getPlayerByIdentifier(actionable.from); visited_names.sort(); visitor_names.sort(); visits = visited_names.length > 0 ? auxils.pettyFormat(visited_names) : "nobody"; visitors = visitor_names.length > 0 ? auxils.pettyFormat(visitor_names) : "nobody"; game.addMessage(nightwatcher, ":eye: Your target visited " + visits + " and was visited by " + visitors + " last night."); };