Last active
July 8, 2016 02:57
-
-
Save joeybrown/b5c8cc459c221f60dc09f10841f29943 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import java.util.Random; | |
public class Vampire | |
{ | |
public String Name; | |
public int Health; | |
public Vampire Bite(Human human) { | |
System.out.println(Name + " just bit " + human.Name); | |
String newName = human.Name + "cula"; | |
return new Vampire(newName); | |
} | |
public int Bite(Vampire vamp){ | |
Random rand = new Random(); | |
int damage = rand.nextInt(5) + 1; | |
vamp.Health = vamp.Health - damage; | |
System.out.println(Name + " just bit " + vamp.Name); | |
System.out.println("Damage was " + damage); | |
if (vamp.Health <= 0) { | |
System.out.println(vamp.Name + " died."); | |
} | |
return vamp.Health; | |
} | |
public Vampire(String name) | |
{ | |
Name = name; | |
Health = 10; | |
System.out.println("New Vampire created named " + | |
Name + "!"); | |
} | |
} | |
public class Human | |
{ | |
public String Name; | |
public Human(String name) | |
{ | |
Name = name; | |
System.out.println("New Human created named " + | |
Name + "!"); | |
} | |
} | |
public class Main | |
{ | |
public static void main(){ | |
System.out.println("App started!"); | |
Vampire mary = new Vampire("Mary"); | |
Vampire john = new Vampire("John Cenaaa"); | |
Human charlie = new Human("Charlie"); | |
Vampire newVampire = mary.Bite(charlie); | |
int maryHealth = john.Bite(mary); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment