|
|
@ -5,6 +5,8 @@ import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.net.ServerSocket; |
|
|
|
import java.net.ServerSocket; |
|
|
|
import java.net.Socket; |
|
|
|
import java.net.Socket; |
|
|
|
|
|
|
|
import java.util.Timer; |
|
|
|
|
|
|
|
import java.util.TimerTask; |
|
|
|
import java.util.Map.Entry; |
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
import javax.imageio.ImageIO; |
|
|
@ -92,14 +94,27 @@ class Client { |
|
|
|
System.out.println(event); |
|
|
|
System.out.println(event); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// establish a connection
|
|
|
|
// establish a connection
|
|
|
|
try { |
|
|
|
try { |
|
|
|
socket = new Socket(address, port); |
|
|
|
socket = new Socket(address, port); |
|
|
|
System.out.println("Connected"); |
|
|
|
System.out.println("Connected"); |
|
|
|
|
|
|
|
|
|
|
|
// takes input from terminal
|
|
|
|
// takes input from terminal
|
|
|
|
input = new DataInputStream(System.in); |
|
|
|
input = new DataInputStream(System.in); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer updateTimer=new Timer(); |
|
|
|
|
|
|
|
updateTimer.schedule(new TimerTask(){ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
out.writeUTF("UPDATE"); |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
throw new UnsupportedOperationException("Unimplemented method 'run'"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
},100,100); |
|
|
|
// sends output to the socket
|
|
|
|
// sends output to the socket
|
|
|
|
out = new DataOutputStream( |
|
|
|
out = new DataOutputStream( |
|
|
|
socket.getOutputStream()); |
|
|
|
socket.getOutputStream()); |
|
|
@ -324,6 +339,9 @@ class Server |
|
|
|
System.out.println("Mythra's Health: "+GetMythraHealth()+"%"); |
|
|
|
System.out.println("Mythra's Health: "+GetMythraHealth()+"%"); |
|
|
|
System.out.println("Aya's Health: "+GetAyaHealth()+"%"); |
|
|
|
System.out.println("Aya's Health: "+GetAyaHealth()+"%"); |
|
|
|
System.out.println("Target's Health: "+GetTargetHealth()+"%"); |
|
|
|
System.out.println("Target's Health: "+GetTargetHealth()+"%"); |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case "UPDATE":{ |
|
|
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
}break; |
|
|
|
default:{ |
|
|
|
default:{ |
|
|
|
System.out.println("Unknown command: "+line); |
|
|
|
System.out.println("Unknown command: "+line); |
|
|
@ -404,7 +422,6 @@ class Server |
|
|
|
break fightLoop; |
|
|
|
break fightLoop; |
|
|
|
} |
|
|
|
} |
|
|
|
long difference=System.currentTimeMillis()-lastFrame; |
|
|
|
long difference=System.currentTimeMillis()-lastFrame; |
|
|
|
System.out.println("Difference:"+difference); |
|
|
|
|
|
|
|
bioTimer=Math.max(0,bioTimer-difference); |
|
|
|
bioTimer=Math.max(0,bioTimer-difference); |
|
|
|
lucidDreamingTimer=Math.max(0,lucidDreamingTimer-difference); |
|
|
|
lucidDreamingTimer=Math.max(0,lucidDreamingTimer-difference); |
|
|
|
nextActionTimer=Math.max(0,nextActionTimer-difference); |
|
|
|
nextActionTimer=Math.max(0,nextActionTimer-difference); |
|
|
|