Advertisement
Guest User

Untitled

a guest
Oct 20th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Sheriff() {
  2. var roleName = "Sheriff";
  3. var alignment = "Town";
  4. var alive = true;
  5. var health = 0;
  6. var killers = new Array;
  7. var lynchVote;
  8. var targets = new Array;
  9. var parentPlayer;
  10.  
  11. this.init = function(player) {
  12.     parentPlayer = player;
  13. }
  14.  
  15. this.getRoleName = function() {
  16.     return roleName;
  17. }
  18.  
  19. this.getAlignment = function() {
  20.     return alignment;
  21. }
  22.  
  23. this.isAlive = function() {
  24.     return alive;
  25. }
  26.  
  27. this.getPriority = function() {
  28.     return 0;
  29. }
  30.  
  31. this.dayStart = function(game) {
  32.     targets = new Array;
  33.     if (health < 0) {
  34.         alive = false;
  35.     }
  36.     health = 0;
  37. }
  38.  
  39. this.nightEnd = function(game) {
  40.     if (targets.length != 0) {
  41.         if (targets[0].getAlignment().indexOf("Mafia") == 0 &&
  42.                 targets[0].getRoleName() != "Godfather") {
  43.             game.sendSystemMessage("Your target is a member of the Mafia!",
  44.                 new Array(parentPlayer));
  45.             return;
  46.         }
  47.         game.sendSystemMessage("Your target appears to be innocent.",
  48.             new Array(parentPlayer));
  49.     }
  50. }
  51.  
  52. this.attack = function(attacker, game) {
  53.     health--;
  54.     if (health < 0) {
  55.         killers.push(attacker);
  56.     }
  57. }
  58.  
  59. this.heal = function(healer, game) {
  60.     if (health < 0) {
  61.         killers.pop();
  62.     }
  63.     health++;
  64. }
  65.  
  66. this.lynched = function(game) {
  67.     alive = true;
  68. }
  69.  
  70. this.setTargets = function(targets, game) {
  71.     if (targets.length > 1) {
  72.         game.sendSystemMessage("You can only have a maximum of one target",
  73.             new Array(parentPlayer));
  74.         return;
  75.     }
  76.     this.targets = targets;
  77. }
  78.  
  79. this.handleMessage = function(message, game) {
  80.     handleMessageTown(message, game, this);
  81. }
  82.  
  83. this.getKillers = function() {
  84.     return killers;
  85. }
  86.  
  87. this.setLynchVote = function(vote) {
  88.     lynchVote = vote;
  89. }
  90.  
  91. this.getLynchVote = function() {
  92.     return lynchVote;
  93. }
  94.  
  95. this.voteWeight = function() {
  96.     return 1;
  97. }
  98.  
  99. this.canGameEnd = function(game) {
  100.     return canGameEndTown(game, this); 
  101. }
  102.  
  103. this.isWinner = function(game) {
  104.     return isWinnerTown(game, this);   
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement