Skip to content

Commit

Permalink
lets cryyy
Browse files Browse the repository at this point in the history
  • Loading branch information
aheldis committed Jul 10, 2019
1 parent 348c3c0 commit c9b0702
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/controller/client/TransferController.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static void fromServerTransmitter(Transmitter transmitter) {
}

private static void battleHandler(Transmitter transmitter) {
System.out.println("battleHandler");
if (transmitter.battleEnum == BattleEnum.START_GAME) {
SelectGameScene.startGame(transmitter.match,
transmitter.numberOfMap, transmitter.imPlayer0);
Expand Down
15 changes: 10 additions & 5 deletions src/controller/server/RequestEnumController.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ else if (!allAccount.passwordMatcher(clientTransmitter.name, clientTransmitter.p
socketClass.opponent = opponentSocketClass;
if (opponentSocketClass != null) {
waiterHashMap.put(opponentSocketClass, socketClass);
waiterHashMap.put(socketClass, opponentSocketClass);
opponentSocketClass.changeTransmitter();
Transmitter personTransmitter = opponentSocketClass.getTransmitter();
personTransmitter.transmitterId = 0;
Expand All @@ -276,7 +277,6 @@ else if (!allAccount.passwordMatcher(clientTransmitter.name, clientTransmitter.p
SocketClass waiter = waiterHashMap.get(socketClass);
waiter.changeTransmitter();
socketClass.changeTransmitter();
socketClass.opponent = waiter;
Game game = new Game();
game.checkPlayerDeck(waiter.getAccount(), 1);
game.checkPlayerDeck(socketClass.getAccount(), 2);
Expand Down Expand Up @@ -391,10 +391,15 @@ private static void battleCheck(Transmitter clientTransmitter, SocketClass socke
break;
}
transfer(socketClass);
if (transmitter.errorType == null && socketClass.opponent != null) {
System.out.println("i sent!");
socketClass.opponent.setTransmitter(clientTransmitter);
transfer(socketClass.opponent);
if (transmitter.errorType == null) {
SocketClass opponent = waiterHashMap.get(socketClass);
System.out.println("i sent to " + opponent.getAccount().getUserName() + "!");
opponent.changeTransmitter();
opponent.getTransmitter().requestEnum = clientTransmitter.requestEnum;
opponent.getTransmitter().name = clientTransmitter.name;
opponent.getTransmitter().srcPosition = clientTransmitter.srcPosition;
opponent.getTransmitter().desPosition = clientTransmitter.desPosition;
transfer(opponent);
}
}

Expand Down

0 comments on commit c9b0702

Please sign in to comment.