Game loop and fight
This commit is contained in:
parent
9a24645cab
commit
228c410a1a
9 changed files with 34 additions and 2 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -58,5 +58,19 @@ public class ElementGraph {
|
|||
return elements;
|
||||
}
|
||||
|
||||
public int getInteractionBetween(Element fromElement, Element toElement) {
|
||||
for (GraphElement el : elements) {
|
||||
if (el.getElement().equals(fromElement)){
|
||||
for (ElementLink link : el.getLinks()) {
|
||||
if (link.getElement().equals(toElement)){
|
||||
return link.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
5
src/FightEsit.java
Normal file
5
src/FightEsit.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package it.arnaldo.unibs.tamagolem;
|
||||
|
||||
public enum FightEsit {
|
||||
GOLEM1, GOLEM2
|
||||
}
|
|
@ -14,6 +14,7 @@ public class Game {
|
|||
this.player1 = player1;
|
||||
this.player2 = player2;
|
||||
this.worldBalance = worldBalance;
|
||||
this.stonesPerElement = new HashMap<>();
|
||||
}
|
||||
|
||||
public Player getPlayer1() {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class GameLoop {
|
|||
|
||||
Player p2 = new Player(InputData.readNonEmptyString("""
|
||||
\s
|
||||
Player 1:
|
||||
Player 2:
|
||||
\tChoose your name:\s""", true));
|
||||
|
||||
int difficultyChoise = difficultyMenu.choose();
|
||||
|
|
|
@ -18,7 +18,9 @@ public class TamaGolem {
|
|||
|
||||
public Element useElementalStone() {
|
||||
if (!elementalStones.isEmpty()) {
|
||||
return elementalStones.poll();
|
||||
Element removedStone = elementalStones.removeFirst();
|
||||
elementalStones.add(removedStone);
|
||||
return removedStone;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -35,4 +37,14 @@ public class TamaGolem {
|
|||
public boolean isAlive() {
|
||||
return lifePoints > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LP: " + lifePoints + ", Elemental stones:" + elementalStones.toString();
|
||||
}
|
||||
|
||||
public void print() {
|
||||
System.out.println(toString());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue