Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Entity a = new Human();
- Entity b = new Human();
- Human c = new Human();
- Human d = new Human(0.80);
- Entity f = new Warrior();
- Warrior g = new Warrior();
- Warrior h = new Warrior();
- Ninja j = new Ninja();
- assassinVine k = new assassinVine();
- Daisy l =new Daisy();
- Owl m = new Owl();
- pineTree n = new pineTree();
- rabbitOfCaerbannog o = new rabbitOfCaerbannog();
- Plant p = new Plant();
- ArrayList<Entity> creatures = new ArrayList<Entity>();
- creatures.add(a);
- creatures.add(b);
- creatures.add(c);
- creatures.add(d);
- creatures.add(f);
- creatures.add(g);
- creatures.add(h);
- creatures.add(j);
- creatures.add(k);
- creatures.add(l);
- creatures.add(m);
- creatures.add(n);
- creatures.add(o);
- creatures.add(p);
- creatures.add(new Warrior());
- creatures.add(new Human());
- creatures.add(new Human(0.95));
- creatures.add(new Human(100.0));
- System.out.println(Attack.isNight());
- //Run a match between Warrior and Tree.
- Entity warriorTree = match(f,p);
- if(warriorTree == null)
- System.out.println("It's a draw!");
- else
- System.out.println(warriorTree + " is the winner");
- //Run a match between vine and Daisy.
- Entity vineDaisy = match(k,l);
- if(vineDaisy == null)
- System.out.println("It's a draw!");
- else
- System.out.println(vineDaisy + " is the winner");
- //Run a match between Rabbit & Owl.
- Entity rabbitowl = match(o,m);
- if(rabbitowl == null)
- System.out.println("It's a draw!");
- else
- System.out.println(rabbitowl + " is the winner");
- //Match between Ninja and pineTree
- Entity ninjapineTree = match(j,n);
- if(ninjapineTree == null)
- System.out.println("It's a draw!");
- else
- System.out.println(ninjapineTree + " is the winner");
- //Run a match between two humans.
- Entity winner = match(b,c);
- if(winner == null)
- System.out.println("It's a draw!");
- else
- System.out.println(winner + " is the winner");
- //Run a match between two entities.
- Entity twoEntityfight = match(a,f);
- if(twoEntityfight == null)
- System.out.println("It's a draw!");
- else
- System.out.println(twoEntityfight + " is the winner");
- //Run a match between two Warriors.
- Entity twoWarriorfight = match(g,h);
- if(twoWarriorfight == null)
- System.out.println("It's a draw!");
- else
- System.out.println(twoWarriorfight + " is the winner");
- //Run a match between a Human and a Warrior
- Entity humanWarrior = match(c,g);
- if(humanWarrior == null)
- System.out.println("It's a draw!");
- else
- System.out.println(humanWarrior + " is the winner");
- //Run a match between an Entity and a Warrior
- Entity entityWarrior = match(a,h);
- if(entityWarrior == null)
- System.out.println("It's a draw!");
- else
- System.out.println(entityWarrior + " is the winner");
- System.out.println("\uD83C\uDF84\uD83C\uDF84\uD83C\uDF84");
- }
- public static <T> void print(ArrayList<T> list){
- System.out.printf("\n------------------ %d items\n", list.size());
- for(T t : list){
- System.out.println(t);
- }
- }
- /**
- * This runs a set of rounds until at least one player is dead.
- *
- * After the rounds are completed the winner is printed
- *
- * In the postmortem both players are printed.
- *
- * @param a One player
- * @param b A second player
- * @return The Winner object, in all it's bloody glory
- */
- public static Entity match(Entity a, Entity b){
- int round = 1;
- while(round <= 10 && !a.isDead() && !b.isDead()){
- System.out.printf("\nRound %2d %s VS %s\n", round, a, b);
- Attack.round(a,b,round);
- round++;
- }
- //Find the winner, if any
- Entity winner = null;
- if(a.isDead() && !b.isDead())
- winner = b;
- else if(!a.isDead() && b.isDead())
- winner = a;
- System.out.println("Postmortem: ");
- System.out.printf("%s %s\n", a.isDead()?"\uD83D\uDC80":"\uD83D\uDE03", a);
- System.out.printf("%s %s\n", b.isDead()?"\uD83D\uDC80":"\uD83D\uDE03", b);
- return winner;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment