ArmySchubser-Aktualisierung

Neuer Armyschubser
master
Achim 10 years ago committed by GitHub
parent e26f927c93
commit ce83de8e8e

@ -6,10 +6,13 @@ import javax.swing.JOptionPane;
* Schubst Einheiten umher.
*
* @author MaxiJohl, GruenerWal
* @version 0.1.1
* @version 0.2.0
*/
public class ArmySchubser extends Map_World
{
Province firstProvince = null;
Province secondProvince = null;
/**
* Constructor for objects of class ArmySchubser.
@ -22,10 +25,9 @@ public class ArmySchubser extends Map_World
public void act()
{
Province firstProvince = null;
Province secondProvince = null;
for ( int i = 0; i <= provinceCount; i++)
if (firstProvince == null)
{
for ( int i = 1; i <= provinceCount; i++)
{
if (provinces[i].hasClicked() == true)
{
@ -33,7 +35,10 @@ public class ArmySchubser extends Map_World
break;
}
}
}
if (firstProvince != null)
{
for ( int i = 0; i <= provinceCount; i++)
{
if (provinces[i].hasClicked() == true && provinces[i] != firstProvince)
@ -43,8 +48,8 @@ public class ArmySchubser extends Map_World
}
}
String toMove = JOptionPane.showInputDialog(null, "Wieviele Einheiten willst du verschieben?");
Integer entitiesToMove = Integer.valueOf(toMove);
String toMoveString = JOptionPane.showInputDialog(null, "Wieviele Einheiten willst du verschieben?");
Integer entitiesToMove = Integer.valueOf(toMoveString);
if ( (firstProvince.getEntityCount() - entitiesToMove) > 0 && firstProvince.isProvinceNear(secondProvince.getID()) == true )
{
@ -52,9 +57,15 @@ public class ArmySchubser extends Map_World
secondProvince.addToEntities(entitiesToMove);
}
else
if ( (firstProvince.getEntityCount() - entitiesToMove) <= 0 )
{
System.out.println("Du hast nicht genügend Einheiten, um die gewünschte Anzahl von " + firstProvince.getDisplayName() + " nach " + secondProvince.getDisplayName() + " zu verschieben, Köhler.");
JOptionPane.showMessageDialog(null,"Du hast nicht genügend Einheiten, um die gewünschte Anzahl von " + firstProvince.getDisplayName() + " nach " + secondProvince.getDisplayName() + " zu verschieben, Köhler.");
}
if ( firstProvince.isProvinceNear(secondProvince.getID()) == false )
{
JOptionPane.showMessageDialog(null,"Die Provinzen müssen nebeneinander liegen, wenn du Einheiten verschieben willst.");
}
}
}
}

Loading…
Cancel
Save