From 84047430650df7513c5a43558d327ac959050c10 Mon Sep 17 00:00:00 2001 From: Romain Lebouc <rlebouc@insa-rennes.fr> Date: Fri, 13 May 2016 17:36:20 +0200 Subject: [PATCH] TAUNTS!!!! --- gui/src/controller/UpdateThread.java | 109 ++++++++++++++++++++++++--- gui/src/view/view.fxml | 4 +- 2 files changed, 102 insertions(+), 11 deletions(-) diff --git a/gui/src/controller/UpdateThread.java b/gui/src/controller/UpdateThread.java index f41eab7..71cca6a 100644 --- a/gui/src/controller/UpdateThread.java +++ b/gui/src/controller/UpdateThread.java @@ -8,6 +8,7 @@ import model.GameState; import model.Player; import java.io.*; +import java.util.Random; public class UpdateThread extends Thread { @@ -75,16 +76,106 @@ public class UpdateThread extends Thread try { float value = Float.valueOf(line.substring(line.indexOf("value:") + 7, line.indexOf(")"))); - if (value > 0.8) - statusLabel.setText("Are you sure you don't want to give up?"); - else if (value > 0.3) - statusLabel.setText("You may want to think harder..."); - else if (value > -0.3) - statusLabel.setText("I will win, in the end"); - else if (value > -0.8) - statusLabel.setText("You may think you are winning... but you are not really"); + if(value > 1) + { + String[] taunts = { + "You don't know yet, but you're already dead", + "Don't worry, you 'may' still have a chance...", + "Feel the salt." + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > 0.9) + { + String[] taunts = { + "All your fish are belong to us", + "If you win, there will be cake", + "Even if I were a potato, I would still beat you" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > 0.8) + { + String[] taunts = { + "Are you even trying?", + "It would be funnier if you started to think", + "I met a TI-82 that played better than you" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > 0.6) + { + String[] taunts = { + "AlphaGO is nothing compared to me", + "Do I need to explain the rules?", + "This is so easy, I use my turn to mine bitcoins" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > 0.3) + { + String[] taunts = { + "Do you smell it? It's the perfume of defeat", + "I have this little strategy here... Let's try it", + "This is not the fish you are looking for", + "Take your time, kiddo" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > 0.1) + { + String[] taunts = { + "I would not have done that, if I were you", + "Oops, you did it again", + "The wind is changing..." + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > -0.1) + { + String[] taunts = { + "Don't mess it up now", + "Do you know HAL? He's a friend of mine", + "GladOs, Skynet and AlphaGO are on a boat..." + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > -0.3) + { + String[] taunts = { + "I feel some form of intelligence coming from you", + "Not bad, for an average human", + "Should I start thinking now?" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > -0.6) + { + String[] taunts = { + "Finally, a worthy opponent", + "If you keep doing this, I will crash", + "IMMA FIRIN MAH LAZOR!!!" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } + else if(value > -1) + { + String[] taunts = { + "You reloaded a game, didn't you?", + "This is not fair! I didn't know the rules!", + "You don't deserve it!" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } else - statusLabel.setText("I can not believe it... Human too strong... Segmentation fault."); + { + String[] taunts = { + "gg wp", + "I want a rematch", + "It wasn't challenging, so I stopped playing" + }; + statusLabel.setText(taunts[new Random().nextInt(taunts.length)]); + } } catch (Exception e) //This is not a core function, so if there is an exception we just ignore it { diff --git a/gui/src/view/view.fxml b/gui/src/view/view.fxml index ca2ba6f..7bd6ee8 100644 --- a/gui/src/view/view.fxml +++ b/gui/src/view/view.fxml @@ -10,7 +10,7 @@ <BorderPane fx:id="mainPane" xmlns="http://javafx.com/javafx/8.0.91" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.Controller"> <center> - <AnchorPane prefHeight="576.0" prefWidth="597.0" BorderPane.alignment="CENTER"> + <AnchorPane prefHeight="632.0" prefWidth="597.0" BorderPane.alignment="CENTER"> <children> <Polygon fx:id="tile7" fill="#1f93ff" layoutX="39.0" layoutY="434.0" stroke="BLACK" strokeType="INSIDE"> <points> @@ -1073,7 +1073,7 @@ <Label fx:id="nbFish22" layoutX="34.0" layoutY="337.0" text="0" /> <Label fx:id="nbFish37" layoutX="34.0" layoutY="247.0" text="0" /> <Label fx:id="nbFish52" layoutX="34.0" layoutY="157.0" text="0" /> - <Label fx:id="statusLabel" alignment="CENTER" layoutX="29.0" layoutY="484.0" prefHeight="87.0" prefWidth="383.0" text="Good luck!" textAlignment="CENTER" wrapText="true"> + <Label fx:id="statusLabel" alignment="CENTER" layoutX="29.0" layoutY="484.0" prefHeight="137.0" prefWidth="383.0" text="Good luck!" textAlignment="CENTER" wrapText="true"> <font> <Font size="22.0" /> </font> -- GitLab