Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jmein
committed
Nov 19, 2011
1 parent
d9e57ca
commit 621bc42
Showing
10 changed files
with
223 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
import java.util.Random; | ||
|
||
public class Die{ | ||
|
||
public static int rolld(int sides){ | ||
Random roller=new Random(); | ||
return (roller.nextInt(sides)+1); | ||
} | ||
|
||
// public static int d6(){ | ||
// return (new Random().nextInt(6)+1); | ||
// } | ||
|
||
public static int rolld(int sides){ | ||
return (new Random().nextInt(sides)+1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,46 @@ | ||
public class Hero extends Figure{ | ||
|
||
public boolean winOnTie = false; | ||
public boolean student; | ||
public boolean strange; | ||
public boolean female; | ||
|
||
Hero(String moniker, boolean kid, boolean xx, int healthBoxes, Square start){ | ||
|
||
this.name = moniker; | ||
this.health = this.maxHealth = healthBoxes; | ||
this.fightDice = 2; | ||
this.moveThrough = Hero.throughness(); | ||
this.student = kid; | ||
this.female = xx; | ||
this.location = start; | ||
|
||
} | ||
|
||
public static boolean[] throughness(){ | ||
boolean[] answer = {true,true,true,false,false}; | ||
return answer; | ||
} | ||
|
||
public String answer(String question){ | ||
|
||
if(question == "Where are you?"){ | ||
return("I'm at "+this.location.x+","+this.location.y); | ||
} | ||
else if(question == "How well are you?"){ | ||
return ("I have "+this.health+"/"+this.maxHealth+" health."); | ||
} | ||
else | ||
return "..."; | ||
|
||
} | ||
|
||
public void die(){ | ||
System.out.println("\"Curse you, zombies!! Now you've taken everything from me!!\""); | ||
System.out.println(this.name+" dies..."); | ||
new ZombieHero(this); | ||
|
||
} | ||
|
||
|
||
public void fight(Zombie undead){ | ||
|
||
int[] hd = this.fightRoll(); | ||
int[] zd = undead.fightRoll(); | ||
|
||
if( (hd[0] > zd[0]) || ( (hd[0] > zd[0]) && this.winOnTie) ){ | ||
System.out.println(this.name + " wins!"); | ||
if( Dice.hasDoubles(hd) ){ | ||
undead.wound(); | ||
public boolean winOnTie; | ||
public boolean student; | ||
public boolean female; | ||
|
||
Hero(String moniker, boolean kid, boolean xx, int healthBoxes, Square start){ | ||
|
||
this.name = moniker; | ||
this.health = this.maxHealth = healthBoxes; | ||
this.fightDice = 2; | ||
this.moveThrough = Hero.throughness(); | ||
this.student = kid; | ||
this.female = xx; | ||
this.location = start; | ||
start.herolist.add(this); | ||
|
||
} | ||
|
||
public static boolean[] throughness(){ | ||
boolean answer = {true,true,true,false,false}; | ||
return answer; | ||
} | ||
} | ||
else { | ||
this.wound(); | ||
} | ||
|
||
} | ||
public void die(){ | ||
System.out.println(this.name + " dies..."); | ||
new ZombieHero(this); | ||
} | ||
|
||
public void fight(Zombie undead){ | ||
|
||
int[] hd = this.fightRoll(); | ||
int[] zd = undead.fightRoll(); | ||
|
||
if( (hd[0] > zd[0]) || ( (hd[0] == zd[0]) && this.winOnTie) ){ | ||
System.out.println(this.name + " wins!"); | ||
if( Dice.hasDoubles(hd) ){ | ||
undead.wound(); | ||
} | ||
} | ||
else { | ||
this.wound(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
lastnight emulates the board game "Last Night on Earth, the Zombie Game", created by Jason C. Hill and produced by Flying Frog. | ||
|
||
v0.0 | ||
|
||
2011.11.19: | ||
formatted nicely. | ||
Board contains a rectangular grid of Squares, constructors create empty boards. | ||
Building does nothing. has a name and belongs to a Board. | ||
charlist contains a list of the characters that must be included as heroes. | ||
Card,Deck nonexistent, will create decks of cards used in game. | ||
Ell has many Squares and a list of Buildings. Not yet implemented. Will create corners of the board: | ||
6x6 grid less a 3x3 corner. Random Buildings from cards selected by Ell. | ||
Figure has basics of figures( zombies and heros ): movement, wound taking, rolling dice in fights, | ||
information={name, health, fightDice, location. | ||
Hero extends figure to model human characters. Contains extra information, constructor, fight method. | ||
Square is one of the squares in the Board. contains coordinates, lists of heros and zombies in Square, | ||
connections to neighboring squares. claims a Board and a Building to belong to. | ||
TestDice,TestFight,TestMove, for testing aspects of the game. | ||
Zombie extends figure to model zombies. has constructor... | ||
ZombieHero extends Zombie to model ex-Heroes who are zombified. Constructor from Hero. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,22 @@ | ||
public class Zombie extends Figure{ | ||
|
||
Zombie(Square pit){ | ||
this.name = "Zombie"; | ||
this.health = this.maxHealth = 1; | ||
this.fightDice = 1; | ||
this.moveThrough = /*{true,true,true,true,false};*/Zombie.throughness(); | ||
this.location = pit; | ||
pit.zombielist.add(this); | ||
|
||
} | ||
|
||
public static boolean[] throughness(){ | ||
boolean[] answer = {true,true,true,true,false}; | ||
return answer; | ||
} | ||
|
||
void answer(String question){ | ||
System.out.println("Urgh...."); | ||
} | ||
Zombie(Square pit){ | ||
this.name = "Zombie"; | ||
this.health = this.maxHealth = 1; | ||
this.fightDice = 1; | ||
this.moveThrough =/*{true,true,true,true,false}*/Zombie.throughness(); | ||
this.location = pit; | ||
pit.zombielist.add(this); | ||
} | ||
|
||
void die(){ | ||
|
||
System.out.println(this.name+" dies!"); | ||
this.location.zombielist.remove(this); | ||
} | ||
public static boolean[] throughness(){ | ||
boolean[] answer = {true,true,true,true,false}; | ||
return answer; | ||
} | ||
|
||
void die(){ | ||
System.out.println(this.name + " dies!"); | ||
this.location.zombielist.remove(this); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.