|
|
|
@ -5,6 +5,8 @@ import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.net.ServerSocket; |
|
|
|
|
import java.net.Socket; |
|
|
|
|
import java.util.Timer; |
|
|
|
|
import java.util.TimerTask; |
|
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
@ -92,14 +94,27 @@ class Client { |
|
|
|
|
System.out.println(event); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// establish a connection
|
|
|
|
|
try { |
|
|
|
|
socket = new Socket(address, port); |
|
|
|
|
System.out.println("Connected"); |
|
|
|
|
|
|
|
|
|
// takes input from terminal
|
|
|
|
|
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
|
|
|
|
|
out = new DataOutputStream( |
|
|
|
|
socket.getOutputStream()); |
|
|
|
@ -324,6 +339,9 @@ class Server |
|
|
|
|
System.out.println("Mythra's Health: "+GetMythraHealth()+"%"); |
|
|
|
|
System.out.println("Aya's Health: "+GetAyaHealth()+"%"); |
|
|
|
|
System.out.println("Target's Health: "+GetTargetHealth()+"%"); |
|
|
|
|
}break; |
|
|
|
|
case "UPDATE":{ |
|
|
|
|
|
|
|
|
|
}break; |
|
|
|
|
default:{ |
|
|
|
|
System.out.println("Unknown command: "+line); |
|
|
|
@ -404,7 +422,6 @@ class Server |
|
|
|
|
break fightLoop; |
|
|
|
|
} |
|
|
|
|
long difference=System.currentTimeMillis()-lastFrame; |
|
|
|
|
System.out.println("Difference:"+difference); |
|
|
|
|
bioTimer=Math.max(0,bioTimer-difference); |
|
|
|
|
lucidDreamingTimer=Math.max(0,lucidDreamingTimer-difference); |
|
|
|
|
nextActionTimer=Math.max(0,nextActionTimer-difference); |
|
|
|
|