Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Sheriff() {
- var roleName = "Sheriff";
- var alignment = "Town";
- var alive = true;
- var health = 0;
- var killers = new Array;
- var lynchVote;
- var targets = new Array;
- var parentPlayer;
- this.init = function(player) {
- parentPlayer = player;
- }
- this.getRoleName = function() {
- return roleName;
- }
- this.getAlignment = function() {
- return alignment;
- }
- this.isAlive = function() {
- return alive;
- }
- this.getPriority = function() {
- return 0;
- }
- this.dayStart = function(game) {
- targets = new Array;
- if (health < 0) {
- alive = false;
- }
- health = 0;
- }
- this.nightEnd = function(game) {
- if (targets.length != 0) {
- if (targets[0].getAlignment().indexOf("Mafia") == 0 &&
- targets[0].getRoleName() != "Godfather") {
- game.sendSystemMessage("Your target is a member of the Mafia!",
- new Array(parentPlayer));
- return;
- }
- game.sendSystemMessage("Your target appears to be innocent.",
- new Array(parentPlayer));
- }
- }
- this.attack = function(attacker, game) {
- health--;
- if (health < 0) {
- killers.push(attacker);
- }
- }
- this.heal = function(healer, game) {
- if (health < 0) {
- killers.pop();
- }
- health++;
- }
- this.lynched = function(game) {
- alive = true;
- }
- this.setTargets = function(targets, game) {
- if (targets.length > 1) {
- game.sendSystemMessage("You can only have a maximum of one target",
- new Array(parentPlayer));
- return;
- }
- this.targets = targets;
- }
- this.handleMessage = function(message, game) {
- handleMessageTown(message, game, this);
- }
- this.getKillers = function() {
- return killers;
- }
- this.setLynchVote = function(vote) {
- lynchVote = vote;
- }
- this.getLynchVote = function() {
- return lynchVote;
- }
- this.voteWeight = function() {
- return 1;
- }
- this.canGameEnd = function(game) {
- return canGameEndTown(game, this);
- }
- this.isWinner = function(game) {
- return isWinnerTown(game, this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement