Permalink
Browse files

added rounds

  • Loading branch information...
1 parent 53aee24 commit d7105956b23c09435df46b325681487a4fa2acfa @kpj committed Mar 17, 2012
Showing with 27 additions and 5 deletions.
  1. +26 −0 fight_handler.java
  2. +1 −5 key_handler.java
View
@@ -186,6 +186,11 @@ public int get_distance(Place p1, Place p2) {
}
public void move_char(Place from, Place to) {
+ if (from.cur.did_something_this_round) {
+ System.out.println("This character can only act in the next round.");
+ return;
+ }
+ from.cur.did_something_this_round = true;
boolean was_fighting = false;
boolean successful_combat = false;
if (to.cur != null) {
@@ -223,6 +228,18 @@ public boolean attack_char(Place attacker, Place defender) {
return true;
return false;
}
+ public void next_round() {
+ System.out.println("Let the next round begin!");
+ for (Object o : field) {
+ ArrayList l = (ArrayList) o;
+ for (Object ob : l) {
+ Place p = (Place) ob;
+ if (p.cur != null) {
+ p.cur.did_something_this_round = false;
+ }
+ }
+ }
+ }
public void compute_selection(Graphics2D g, ArrayList<Place> sel) {
if (sel.size() == 0) {
@@ -367,4 +384,13 @@ else if(button.equals("MIDDLE")) {
old_move_y = move_y;
}
}
+
+ public void on_key(Character key) {
+ switch (key) {
+ case 'n': {
+ next_round();
+ break;
+ }
+ }
+ }
}
View
@@ -47,7 +47,7 @@ public void handle_key(Character c) {
world_movement(c);
}
else if (content.fight_active) {
- fight_movement(c);
+ content.fight.on_key(c);
}
else if (content.map_active){
map_movement(c);
@@ -57,10 +57,6 @@ else if (content.map_active){
public void map_movement(Character c) {
System.out.println("USE MOUSE");
}
-
- public void fight_movement(Character c) {
- //System.out.println(c);
- }
public void world_movement (Character c) {
if (content.characters.size() == 0) {

0 comments on commit d710595

Please sign in to comment.