Merge pull request #64 from HGE-IT-Course-2016/ArmyPlacer

ArmyPlacer 1.0.0
master
Felix Stupp 8 years ago committed by GitHub
commit f558d9e841

@ -1,4 +1,5 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import javax.swing.JOptionPane;
/**
* Write a description of class ArmyPlacer here.
@ -8,12 +9,8 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
*/
public class ArmyPlacer extends Map_World
{
int freeArmies = -1;
public int armiesToPlace;
public int armyMinimum;
/**
* Constructor for objects of class ArmyPlacer.
*
@ -37,38 +34,141 @@ public class ArmyPlacer extends Map_World
// Grüßen
// ,
// GruenerWal
//
//
//
// I'll be back.
}
public int calculateArmies()
{
int armiesToPlace;
Province[] continentArray;
boolean continentChecked = false;
// 1. ArmyMinimum einbeziehen
armiesToPlace = armyMinimum;
// 2. Einheiten durch Provinzen einbeziehen
armiesToPlace = armiesToPlace + Math.round(players[currentPlayer].getProvinceCount() / 3);
return 0;
// 3. Einheiten durch Kontinente
// Kontinente durchgehen
for ( int i = 1; i < continentBoni.length; i++ )
{
continentArray = giveContinentArray(i);
// Provinzen des aktuellen Kontinents durchgehen
for ( int p = 1; p >= continentArray.length; p++ )
{
// Prüfen, ob eine Provinz NICHT dem aktuellen Spieler gehört
if ( continentArray[p].getOwner() != currentPlayer )
{
break;
}
// Wenn nicht, wird der Kontinent als gecheckt markiert
else
{
continentChecked = true;
}
}
if ( continentChecked == true )
{
armiesToPlace = armiesToPlace + continentBoni[i];
continentChecked = false;
}
}
// 4. Einheiten durch Sterne
if ( players[currentPlayer].getStars() > 0)
{
String toUseString = JOptionPane.showInputDialog(null, "Wieviele Sterne willst du verwenden?");
int starsToUse = Utils.StringToInt(toUseString);
int[] starBoni = new int [] {1,2,4,7,10,13,17,21,25,30};
if ( starsToUse > 0 && starsToUse < 11 )
{
armiesToPlace = armiesToPlace + starBoni[starsToUse -1];
}
if ( starsToUse < 0 && starsToUse > 10 )
{
JOptionPane.showMessageDialog(null,"Ungültige Zahl. Bitte eine Zahl zwischen 0 und 10 eingeben");
}
}
return armiesToPlace;
}
public Province[] giveContinentArray(int cID)
{
Province[] savedProvinces = new Province[provinceCount +1];
Province[] continentProvinces;
int c = 0;
for (int i = 1; i <= provinceCount; i++)
{
if (provinces[i].getContinentID() == cID)
{
savedProvinces[i] = provinces[i];
c++;
}
}
return Utils.cutArray(savedProvinces);
if ( c < 1 )
{
return null;
}
else
{
return Utils.cutArray(savedProvinces);
}
}
public void placeArmies()
{
if ( freeArmies == -1 )
{
freeArmies = calculateArmies();
}
for ( int i = 1; i <= (provinces.length - 1); i++) {
if (provinces[i].hasClicked() == true && provinces[i].getOwner() == currentPlayer)
{
String toUseString = JOptionPane.showInputDialog(null, "Wieviele Einheiten willst du setzen? Du hast noch " + freeArmies + " freie Einheiten.");
int armiesToUse = Utils.StringToInt(toUseString);
if ( armiesToUse <= freeArmies )
{
provinces[i].addToEntities(armiesToUse);
freeArmies = freeArmies- armiesToUse;
JOptionPane.showMessageDialog(null,"Einheiten erfolgreich gesetzt, Kommandant " + getPlayerName() + ".");
}
else if ( armiesToUse > freeArmies )
{
JOptionPane.showMessageDialog(null,"Nicht genügend freie Einheiten.");
}
}
}
}
public void act()
{
placeArmies();
}
}

@ -112,282 +112,282 @@ public abstract class GeneralMap extends World implements ButtonEvent
3. [...]
*/
if(players.length==3) {
/*
Spieler 1 darf beginnen; Hauptstadt: 40
Spieler 2 ist als zweites dran; Hauptstadt: 20
Spieler 3 ist als drittes dran und bekommt eine Karte; Hauptstadt: 9
*/
dataL = new int[] {1,1,3,2,2,2,2,1,1,1,1,1,3,2,1,1,3,4,3,1,2,2,1,2,1,2,3,3,3,3,3,3,1,1,2,2,2,4,2,3,1,1,3,4,1,2,3,4,2,2,2,1,3,1,1,3,1,3,1,4,3,1,2,1,2,1,1,2,2,2,3,1,2,2,2,4,2,3,1,4,3,1,1,2};
provinces[1].setOwner(1);
provinces[1].setEntityCount(1);
provinces[2].setOwner(3);
provinces[2].setEntityCount(2);
provinces[3].setOwner(2);
provinces[3].setEntityCount(2);
provinces[4].setOwner(2); //Fabrik
provinces[4].setEntityCount(1);
provinces[5].setOwner(1);//Fabrik
provinces[5].setEntityCount(1);
provinces[6].setOwner(1);//Fabrik
provinces[6].setEntityCount(1);
provinces[7].setOwner(3);
provinces[7].setEntityCount(2);
provinces[8].setOwner(1);
provinces[8].setEntityCount(1);
provinces[9].setOwner(3);
provinces[9].setEntityCount(4);
provinces[10].setOwner(3);
provinces[10].setEntityCount(1);
provinces[11].setOwner(2);//Fabrik
provinces[11].setEntityCount(2);
provinces[12].setOwner(1);
provinces[12].setEntityCount(2);
provinces[13].setOwner(1);//Fabrik
provinces[13].setEntityCount(2);
provinces[14].setOwner(3);//Fabrik
provinces[14].setEntityCount(3);
provinces[15].setOwner(3);//Fabrik
provinces[15].setEntityCount(3);
provinces[16].setOwner(3);//Fabrik
provinces[16].setEntityCount(3);
provinces[17].setOwner(1);
provinces[17].setEntityCount(1);
provinces[18].setOwner(2);
provinces[18].setEntityCount(2);
provinces[19].setOwner(2);//Fabrik
provinces[19].setEntityCount(4);
provinces[20].setOwner(2);
provinces[20].setEntityCount(3);
provinces[21].setOwner(1);
provinces[21].setEntityCount(1);
provinces[22].setOwner(3);//Fabrik
provinces[22].setEntityCount(4);
provinces[23].setOwner(1);
provinces[23].setEntityCount(2);
provinces[24].setOwner(3);
provinces[24].setEntityCount(4);
provinces[25].setOwner(2);
provinces[25].setEntityCount(2);
provinces[26].setOwner(2);//Fabrik
provinces[26].setEntityCount(1);
provinces[27].setOwner(3);
provinces[27].setEntityCount(1);
provinces[28].setOwner(1);//Fabrik
provinces[28].setEntityCount(3);
provinces[29].setOwner(1);//Fabrik
provinces[29].setEntityCount(3);
provinces[30].setOwner(1);
provinces[30].setEntityCount(4);
provinces[31].setOwner(3);
provinces[31].setEntityCount(1);
provinces[32].setOwner(2);
provinces[32].setEntityCount(1);
provinces[33].setOwner(2);
provinces[33].setEntityCount(1);
provinces[34].setOwner(1);
provinces[34].setEntityCount(2);
provinces[35].setOwner(2);
provinces[35].setEntityCount(2);
provinces[36].setOwner(3);
provinces[36].setEntityCount(1);
provinces[37].setOwner(2);
provinces[37].setEntityCount(2);
provinces[38].setOwner(2);//Fabrik
provinces[38].setEntityCount(4);
provinces[39].setOwner(2);
provinces[39].setEntityCount(3);
provinces[40].setOwner(1);
provinces[40].setEntityCount(4);
provinces[41].setOwner(3);//Fabrik
provinces[41].setEntityCount(1);
provinces[42].setOwner(1);
provinces[42].setEntityCount(2);
} else if(players.length==4) {
/*
Spieler 1 darf beginnen; Hauptstadt:22
Spieler 2 ist als zweites dran; Hauptstadt:20
Spieler 3 ist als drittes dran und bekommt eine Karte; Hauptstadt:2
Spieler 4 ist als viertes dran und bekommt eine Karte; Hauptstadt:39
*/
dataL = new int[] {1,1,3,3,3,3,3,2,3,2,3,3,2,2,1,2,2,2,3,2,2,3,3,2,2,3,1,3,1,3,1,3,3,2,4,2,2,4,2,4,1,1,1,2,1,5,1,3,2,2,4,3,4,1,4,2,2,2,2,2,4,1,2,1,4,5,3,2,3,2,3,2,4,1,4,1,4,4,4,1,1,2,4,4};
provinces[1].setOwner(1);
provinces[1].setEntityCount(1);
provinces[2].setOwner(3);
provinces[2].setEntityCount(3);
provinces[3].setOwner(3);
provinces[3].setEntityCount(3);
provinces[4].setOwner(3);//Fabrik
provinces[4].setEntityCount(2);
provinces[5].setOwner(3);//Fabrik
provinces[5].setEntityCount(2);
provinces[6].setOwner(3);//Fabrik
provinces[6].setEntityCount(3);
provinces[7].setOwner(2);
provinces[7].setEntityCount(2);
provinces[8].setOwner(1);
provinces[8].setEntityCount(2);
provinces[9].setOwner(2);
provinces[9].setEntityCount(2);
provinces[10].setOwner(3);//Fabrik
provinces[10].setEntityCount(2);
provinces[11].setOwner(2);//Fabrik
provinces[11].setEntityCount(3);
provinces[12].setOwner(3);
provinces[12].setEntityCount(2);
provinces[13].setOwner(2);//Fabrik
provinces[13].setEntityCount(3);
provinces[14].setOwner(1);//Fabrik
provinces[14].setEntityCount(3);
provinces[15].setOwner(1);//Fabrik
provinces[15].setEntityCount(3);
provinces[16].setOwner(1);//Fabrik
provinces[16].setEntityCount(3);
provinces[17].setOwner(3);
provinces[17].setEntityCount(2);
provinces[18].setOwner(4);
provinces[18].setEntityCount(2);
provinces[19].setOwner(2);//Fabrik
provinces[19].setEntityCount(4);
provinces[20].setOwner(2);
provinces[20].setEntityCount(4);
provinces[21].setOwner(1);
provinces[21].setEntityCount(1);
provinces[22].setOwner(1);//Fabrik
provinces[22].setEntityCount(2);
provinces[23].setOwner(1);
provinces[23].setEntityCount(5);
provinces[24].setOwner(1);
provinces[24].setEntityCount(3);
provinces[25].setOwner(2);
provinces[25].setEntityCount(2);
provinces[26].setOwner(4);//Fabrik
provinces[26].setEntityCount(3);
provinces[27].setOwner(4);
provinces[27].setEntityCount(1);
provinces[28].setOwner(4);//Fabrik
provinces[28].setEntityCount(2);
provinces[29].setOwner(2);//Fabrik
provinces[29].setEntityCount(2);
provinces[30].setOwner(2);
provinces[30].setEntityCount(2);
provinces[31].setOwner(4);
provinces[31].setEntityCount(1);
provinces[32].setOwner(2);
provinces[32].setEntityCount(1);
provinces[33].setOwner(4);
provinces[33].setEntityCount(5);
provinces[34].setOwner(3);
provinces[34].setEntityCount(2);
provinces[35].setOwner(3);
provinces[35].setEntityCount(2);
provinces[36].setOwner(3);
provinces[36].setEntityCount(2);
provinces[37].setOwner(4);
provinces[37].setEntityCount(1);
provinces[38].setOwner(4);//Fabrik
provinces[38].setEntityCount(1);
provinces[39].setOwner(4);
provinces[39].setEntityCount(4);
provinces[40].setOwner(4);
provinces[40].setEntityCount(1);
provinces[41].setOwner(1);//Fabrik
provinces[41].setEntityCount(2);
provinces[42].setOwner(4);
provinces[42].setEntityCount(4);
} else if(players.length==5) {
/*
Spieler 1 darf beginnen; Hauptstadt:13
Spieler 2 ist als zweites dran; Hauptstadt:7
Spieler 3 ist als drittes dran und bekommt eine Karte; Hauptstadt:22
Spieler 4 ist als viertes dran und bekommt eine Karte; Hauptstadt:20
Spieler 5 ist als fünftes dran und bekommt zwei Karte; Hauptstadt:41
*/
dataL = new int[] {3,1,1,2,4,2,2,2,2,2,2,2,2,4,4,1,2,2,4,1,4,3,3,1,1,4,1,2,3,3,1,2,2,3,4,2,4,5,4,3,2,2,3,5,3,3,1,2,3,3,3,2,2,3,5,2,5,3,5,3,1,3,1,3,4,1,5,1,5,1,5,2,3,2,4,2,5,2,1,2,5,4,5,2};
provinces[1].setOwner(3);
provinces[1].setEntityCount(1);
provinces[2].setOwner(1);
provinces[2].setEntityCount(2);
provinces[3].setOwner(4);
provinces[3].setEntityCount(2);
provinces[4].setOwner(2);//Fabrik
provinces[4].setEntityCount(2);
provinces[5].setOwner(2);//Fabrik
provinces[5].setEntityCount(2);
provinces[6].setOwner(2);//Fabrik
provinces[6].setEntityCount(2);
provinces[7].setOwner(2);
provinces[7].setEntityCount(4);
provinces[8].setOwner(4);
provinces[8].setEntityCount(1);
provinces[9].setOwner(2);
provinces[9].setEntityCount(2);
provinces[10].setOwner(4);
provinces[10].setEntityCount(1);
provinces[11].setOwner(4);//Fabrik
provinces[11].setEntityCount(3);
provinces[12].setOwner(3);
provinces[12].setEntityCount(1);
provinces[13].setOwner(1);
provinces[13].setEntityCount(4);
provinces[14].setOwner(1);//Fabrik
provinces[14].setEntityCount(2);
provinces[15].setOwner(3);//Fabrik
provinces[15].setEntityCount(3);
provinces[16].setOwner(1);//Fabrik
provinces[16].setEntityCount(2);
provinces[17].setOwner(2);
provinces[17].setEntityCount(3);
provinces[18].setOwner(4);
provinces[18].setEntityCount(2);
provinces[19].setOwner(4);//Fabrik
provinces[19].setEntityCount(5);
provinces[20].setOwner(4);
provinces[20].setEntityCount(3);
provinces[21].setOwner(2);
provinces[21].setEntityCount(2);
provinces[22].setOwner(3);//Fabrik
provinces[22].setEntityCount(5);
provinces[23].setOwner(3);
provinces[23].setEntityCount(3);
provinces[24].setOwner(1);
provinces[24].setEntityCount(2);
provinces[25].setOwner(3);
provinces[25].setEntityCount(3);
provinces[26].setOwner(3);//Fabrik
provinces[26].setEntityCount(2);
provinces[27].setOwner(2);
provinces[27].setEntityCount(3);
provinces[28].setOwner(5);//Fabrik
provinces[28].setEntityCount(2);
provinces[29].setOwner(5);//Fabrik
provinces[29].setEntityCount(3);
provinces[30].setOwner(5);
provinces[30].setEntityCount(3);
provinces[31].setOwner(1);
provinces[31].setEntityCount(3);
provinces[32].setOwner(1);
provinces[32].setEntityCount(3);
provinces[33].setOwner(4);
provinces[33].setEntityCount(1);
provinces[34].setOwner(5);
provinces[34].setEntityCount(1);
provinces[35].setOwner(5);
provinces[35].setEntityCount(1);
provinces[36].setOwner(5);
provinces[36].setEntityCount(2);
provinces[37].setOwner(3);
provinces[37].setEntityCount(2);
provinces[38].setOwner(4);//Fabrik
provinces[38].setEntityCount(2);
provinces[39].setOwner(5);
provinces[39].setEntityCount(2);
provinces[40].setOwner(1);
provinces[40].setEntityCount(2);
provinces[41].setOwner(5);//Fabrik
provinces[41].setEntityCount(4);
provinces[42].setOwner(5);
provinces[42].setEntityCount(2);
}
/*
Spieler 1 darf beginnen; Hauptstadt: 40
Spieler 2 ist als zweites dran; Hauptstadt: 20
Spieler 3 ist als drittes dran und bekommt eine Karte; Hauptstadt: 9
*/
dataL = new int[] {0,1,2,2,1,2,1,1,0,1,0,1,2,2,0,1,2,4,2,1,1,2,0,2,0,2,2,3,2,3,2,3,0,1,1,2,1,4,1,3,0,1,2,4,0,2,2,4,1,2,1,1,2,1,0,3,0,3,0,4,2,1,1,1,1,1,0,2,1,2,2,1,1,2,1,4,1,3,0,4,2,1,0,2};
provinces[1].setOwner(0);
provinces[1].setEntityCount(1);
provinces[2].setOwner(2);
provinces[2].setEntityCount(2);
provinces[3].setOwner(1);
provinces[3].setEntityCount(2);
provinces[4].setOwner(1); //Fabrik
provinces[4].setEntityCount(1);
provinces[5].setOwner(0);//Fabrik
provinces[5].setEntityCount(1);
provinces[6].setOwner(0);//Fabrik
provinces[6].setEntityCount(1);
provinces[7].setOwner(2);
provinces[7].setEntityCount(2);
provinces[8].setOwner(0);
provinces[8].setEntityCount(1);
provinces[9].setOwner(2);
provinces[9].setEntityCount(4);
provinces[10].setOwner(2);
provinces[10].setEntityCount(1);
provinces[11].setOwner(1);//Fabrik
provinces[11].setEntityCount(2);
provinces[12].setOwner(0);
provinces[12].setEntityCount(2);
provinces[13].setOwner(0);//Fabrik
provinces[13].setEntityCount(2);
provinces[14].setOwner(2);//Fabrik
provinces[14].setEntityCount(3);
provinces[15].setOwner(2);//Fabrik
provinces[15].setEntityCount(3);
provinces[16].setOwner(2);//Fabrik
provinces[16].setEntityCount(3);
provinces[17].setOwner(0);
provinces[17].setEntityCount(1);
provinces[18].setOwner(1);
provinces[18].setEntityCount(2);
provinces[19].setOwner(1);//Fabrik
provinces[19].setEntityCount(4);
provinces[20].setOwner(1);
provinces[20].setEntityCount(3);
provinces[21].setOwner(0);
provinces[21].setEntityCount(1);
provinces[22].setOwner(2);//Fabrik
provinces[22].setEntityCount(4);
provinces[23].setOwner(0);
provinces[23].setEntityCount(2);
provinces[24].setOwner(2);
provinces[24].setEntityCount(4);
provinces[25].setOwner(1);
provinces[25].setEntityCount(2);
provinces[26].setOwner(1);//Fabrik
provinces[26].setEntityCount(1);
provinces[27].setOwner(2);
provinces[27].setEntityCount(1);
provinces[28].setOwner(0);//Fabrik
provinces[28].setEntityCount(3);
provinces[29].setOwner(0);//Fabrik
provinces[29].setEntityCount(3);
provinces[30].setOwner(0);
provinces[30].setEntityCount(4);
provinces[31].setOwner(2);
provinces[31].setEntityCount(1);
provinces[32].setOwner(1);
provinces[32].setEntityCount(1);
provinces[33].setOwner(1);
provinces[33].setEntityCount(1);
provinces[34].setOwner(0);
provinces[34].setEntityCount(2);
provinces[35].setOwner(1);
provinces[35].setEntityCount(2);
provinces[36].setOwner(2);
provinces[36].setEntityCount(1);
provinces[37].setOwner(1);
provinces[37].setEntityCount(2);
provinces[38].setOwner(1);//Fabrik
provinces[38].setEntityCount(4);
provinces[39].setOwner(1);
provinces[39].setEntityCount(3);
provinces[40].setOwner(0);
provinces[40].setEntityCount(4);
provinces[41].setOwner(2);//Fabrik
provinces[41].setEntityCount(1);
provinces[42].setOwner(0);
provinces[42].setEntityCount(2);
} else if(players.length==4) {
/*
Spieler 1 darf beginnen; Hauptstadt:22
Spieler 2 ist als zweites dran; Hauptstadt:20
Spieler 3 ist als drittes dran und bekommt eine Karte; Hauptstadt:2
Spieler 4 ist als viertes dran und bekommt eine Karte; Hauptstadt:39
*/
dataL = new int[] {0,1,2,3,2,3,2,2,2,2,2,3,1,2,0,2,1,2,2,2,1,3,2,2,1,3,0,3,0,3,0,3,2,2,3,2,1,4,1,4,0,1,0,2,0,5,0,3,1,2,3,3,3,1,3,2,1,2,1,2,3,1,1,1,3,5,2,2,2,2,2,2,3,1,3,1,3,4,3,1,0,2,3,4};
provinces[1].setOwner(0);
provinces[1].setEntityCount(1);
provinces[2].setOwner(2);
provinces[2].setEntityCount(3);
provinces[3].setOwner(2);
provinces[3].setEntityCount(3);
provinces[4].setOwner(2);//Fabrik
provinces[4].setEntityCount(2);
provinces[5].setOwner(2);//Fabrik
provinces[5].setEntityCount(2);
provinces[6].setOwner(2);//Fabrik
provinces[6].setEntityCount(3);
provinces[7].setOwner(1);
provinces[7].setEntityCount(2);
provinces[8].setOwner(0);
provinces[8].setEntityCount(2);
provinces[9].setOwner(1);
provinces[9].setEntityCount(2);
provinces[10].setOwner(2);//Fabrik
provinces[10].setEntityCount(2);
provinces[11].setOwner(1);//Fabrik
provinces[11].setEntityCount(3);
provinces[12].setOwner(2);
provinces[12].setEntityCount(2);
provinces[13].setOwner(1);//Fabrik
provinces[13].setEntityCount(3);
provinces[14].setOwner(0);//Fabrik
provinces[14].setEntityCount(3);
provinces[15].setOwner(0);//Fabrik
provinces[15].setEntityCount(3);
provinces[16].setOwner(0);//Fabrik
provinces[16].setEntityCount(3);
provinces[17].setOwner(2);
provinces[17].setEntityCount(2);
provinces[18].setOwner(3);
provinces[18].setEntityCount(2);
provinces[19].setOwner(1);//Fabrik
provinces[19].setEntityCount(4);
provinces[20].setOwner(1);
provinces[20].setEntityCount(4);
provinces[21].setOwner(0);
provinces[21].setEntityCount(1);
provinces[22].setOwner(0);//Fabrik
provinces[22].setEntityCount(2);
provinces[23].setOwner(0);
provinces[23].setEntityCount(5);
provinces[24].setOwner(0);
provinces[24].setEntityCount(3);
provinces[25].setOwner(1);
provinces[25].setEntityCount(2);
provinces[26].setOwner(3);//Fabrik
provinces[26].setEntityCount(3);
provinces[27].setOwner(3);
provinces[27].setEntityCount(1);
provinces[28].setOwner(3);//Fabrik
provinces[28].setEntityCount(2);
provinces[29].setOwner(1);//Fabrik
provinces[29].setEntityCount(2);
provinces[30].setOwner(1);
provinces[30].setEntityCount(2);
provinces[31].setOwner(3);
provinces[31].setEntityCount(1);
provinces[32].setOwner(1);
provinces[32].setEntityCount(1);
provinces[33].setOwner(3);
provinces[33].setEntityCount(5);
provinces[34].setOwner(2);
provinces[34].setEntityCount(2);
provinces[35].setOwner(2);
provinces[35].setEntityCount(2);
provinces[36].setOwner(2);
provinces[36].setEntityCount(2);
provinces[37].setOwner(3);
provinces[37].setEntityCount(1);
provinces[38].setOwner(3);//Fabrik
provinces[38].setEntityCount(1);
provinces[39].setOwner(3);
provinces[39].setEntityCount(4);
provinces[40].setOwner(3);
provinces[40].setEntityCount(1);
provinces[41].setOwner(0);//Fabrik
provinces[41].setEntityCount(2);
provinces[42].setOwner(3);
provinces[42].setEntityCount(4);
} else if(players.length==5) {
/*
Spieler 1 darf beginnen; Hauptstadt:13
Spieler 2 ist als zweites dran; Hauptstadt:7
Spieler 3 ist als drittes dran und bekommt eine Karte; Hauptstadt:22
Spieler 4 ist als viertes dran und bekommt eine Karte; Hauptstadt:20
Spieler 5 ist als fünftes dran und bekommt zwei Karte; Hauptstadt:41
*/
dataL = new int[] {2,1,0,2,3,2,1,2,1,2,1,2,1,4,3,1,1,2,3,1,3,3,2,1,0,4,0,2,2,3,0,2,1,3,3,2,3,5,3,3,1,2,2,5,2,3,0,2,2,3,2,2,1,3,4,2,4,3,4,3,0,3,0,3,3,1,4,1,4,1,4,2,2,2,3,2,4,2,0,2,4,4,4,2};
provinces[1].setOwner(2);
provinces[1].setEntityCount(1);
provinces[2].setOwner(0);
provinces[2].setEntityCount(2);
provinces[3].setOwner(3);
provinces[3].setEntityCount(2);
provinces[4].setOwner(1);//Fabrik
provinces[4].setEntityCount(2);
provinces[5].setOwner(1);//Fabrik
provinces[5].setEntityCount(2);
provinces[6].setOwner(1);//Fabrik
provinces[6].setEntityCount(2);
provinces[7].setOwner(1);
provinces[7].setEntityCount(4);
provinces[8].setOwner(3);
provinces[8].setEntityCount(1);
provinces[9].setOwner(1);
provinces[9].setEntityCount(2);
provinces[10].setOwner(3);
provinces[10].setEntityCount(1);
provinces[11].setOwner(3);//Fabrik
provinces[11].setEntityCount(3);
provinces[12].setOwner(2);
provinces[12].setEntityCount(1);
provinces[13].setOwner(0);
provinces[13].setEntityCount(4);
provinces[14].setOwner(0);//Fabrik
provinces[14].setEntityCount(2);
provinces[15].setOwner(2);//Fabrik
provinces[15].setEntityCount(3);
provinces[16].setOwner(0);//Fabrik
provinces[16].setEntityCount(2);
provinces[17].setOwner(1);
provinces[17].setEntityCount(3);
provinces[18].setOwner(3);
provinces[18].setEntityCount(2);
provinces[19].setOwner(3);//Fabrik
provinces[19].setEntityCount(5);
provinces[20].setOwner(3);
provinces[20].setEntityCount(3);
provinces[21].setOwner(1);
provinces[21].setEntityCount(2);
provinces[22].setOwner(2);//Fabrik
provinces[22].setEntityCount(5);
provinces[23].setOwner(2);
provinces[23].setEntityCount(3);
provinces[24].setOwner(0);
provinces[24].setEntityCount(2);
provinces[25].setOwner(2);
provinces[25].setEntityCount(3);
provinces[26].setOwner(2);//Fabrik
provinces[26].setEntityCount(2);
provinces[27].setOwner(1);
provinces[27].setEntityCount(3);
provinces[28].setOwner(4);//Fabrik
provinces[28].setEntityCount(2);
provinces[29].setOwner(4);//Fabrik
provinces[29].setEntityCount(3);
provinces[30].setOwner(4);
provinces[30].setEntityCount(3);
provinces[31].setOwner(0);
provinces[31].setEntityCount(3);
provinces[32].setOwner(0);
provinces[32].setEntityCount(3);
provinces[33].setOwner(3);
provinces[33].setEntityCount(1);
provinces[34].setOwner(4);
provinces[34].setEntityCount(1);
provinces[35].setOwner(4);
provinces[35].setEntityCount(1);
provinces[36].setOwner(4);
provinces[36].setEntityCount(2);
provinces[37].setOwner(2);
provinces[37].setEntityCount(2);
provinces[38].setOwner(3);//Fabrik
provinces[38].setEntityCount(2);
provinces[39].setOwner(4);
provinces[39].setEntityCount(2);
provinces[40].setOwner(0);
provinces[40].setEntityCount(2);
provinces[41].setOwner(4);//Fabrik
provinces[41].setEntityCount(4);
provinces[42].setOwner(4);
provinces[42].setEntityCount(2);
}
int errors = 0;
for(int i = 1; i < provinces.length; i++) {
Province p = provinces[i];

@ -1,105 +1,112 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
Klasse der Standard-Welt
(Also die normale Weltkarte mit allen Kontinenten)
Klasse der Standard-Welt
(Also die normale Weltkarte mit allen Kontinenten)
@author GruenerWal, MaxiJohl
@version 0.3.0
@author GruenerWal, MaxiJohl
@version 1.0.0
*/
public class Map_World extends GeneralMap
{
/**
Konstruktor der Weltkarte;
konstruiert eine GeneralMap mit den Ausmassen 1600 auf 900 Pixel.
*/
public Map_World(String[] playerList, int[] colorList)
{
super(playerList,colorList);
setBackground("MapWorld.png");
/*
Hier werden später sämtliche Provinzen der Standard-Map erstellt.
Dies funktioniert folgendermassen:
=================================================================
Dieses kürzere Format ersetzt den langen Code und sorgt eventuell sogar für einen Geschwindigkeitsschub. Dabei sollte diesselbe Funktionalität erhalten bleiben.
provinces[<Provinz-ID>] = new Province(<Provinz-ID>,<Kontinent-ID>,<X-Position>,<Y-Position>,<Anzahl Sterne>,"<Anzeigename>", new int[] { <Liste aller Nachbarprovinzen> });
=================================================================
Der Speicherplatz für provinces[0] bleibt leer, da es keine Provinz mit der ID 0 gibt!
Und ja, ich weiss, dass das scheisse viel Schreibarbeit ist.
Aber da muss man durch, wir habens auch hinbekommen :P
~GruenerWal
*/
// Festlegung der Provinz-Anzahl
provinceCount = 42;
provinces = new Province[provinceCount + 1];
// Implementierung sämtlicher Provinzen
// ACHTUNG! Gaaaaanz viel Code!
// cID 1 - Nordamerika
provinces[1] = new Province( 1 , 1 , 64 , 106 , 1 , "Alaska" , new int[] {2 , 3 , 36});
provinces[2] = new Province( 2 , 1 , 162 , 106 , 1 , "NW-Territorien" , new int[] {1 , 3 , 4 , 9});
provinces[3] = new Province( 3 , 1 , 153 , 170 , 1 , "Alberta" , new int[] {1 , 2 , 4 , 5});
provinces[4] = new Province( 4 , 1 , 223 , 177 , 2 , "Ontario" , new int[] {2 , 3 , 5 , 6 , 7 , 9});
provinces[5] = new Province( 5 , 1 , 160 , 236 , 2 , "Weststaaten" , new int[] {3 , 4 , 6 , 8});
provinces[6] = new Province( 6 , 1 , 232 , 273 , 2 , "Oststaaten" , new int[] {4 , 5 , 7 , 8});
provinces[7] = new Province( 7 , 1 , 300 , 180 , 2 , "Quebec" , new int[] {4 , 6 , 9});
provinces[8] = new Province( 8 , 1 , 181 , 347 , 1 , "Mittelamerika" , new int[] {5 , 6 , 17});
provinces[9] = new Province( 9 , 1 , 365 , 55 , 1 , "Groenland" , new int[] {2 , 4 , 7 , 10});
// cID 2 - Europa
provinces[10] = new Province(10 , 2 , 454 , 142 , 1 , "Island" , new int[] {9 , 11 , 12});
provinces[11] = new Province(11 , 2 , 424 , 221 , 2 , "Grossbritannien" , new int[] {10 , 12 , 14 , 15});
provinces[12] = new Province(12 , 2 , 520 , 153 , 1 , "Skandinavien" , new int[] {10 , 11 , 13 , 14});
provinces[13] = new Province(13 , 2 , 636 , 180 , 2 , "Russland" , new int[] {12 , 14 , 16 , 27 , 31 , 32});
provinces[14] = new Province(14 , 2 , 528 , 232 , 2 , "Nordeuropa" , new int[] {11 , 12 , 13 , 15 , 16});
provinces[15] = new Province(15 , 2 , 449 , 335 , 2 , "Westeuropa" , new int[] {11 , 14 , 16 , 25});
provinces[16] = new Province(16 , 2 , 537 , 296 , 2 , "Suedeuropa" , new int[] {13 , 14 , 15 , 25 , 26 , 27});
// cID 3 - Suedamerika
provinces[17] = new Province(17 , 3 , 245 , 396 , 1 , "Venezuela" , new int[] {8 , 18 , 19});
provinces[18] = new Province(18 , 3 , 255 , 498 , 1 , "Peru" , new int[] {17 , 19 , 20});
provinces[19] = new Province(19 , 3 , 327 , 467 , 2 , "Brasilien" , new int[] {17 , 18 , 20 , 25});
provinces[20] = new Province(20 , 3 , 274 , 572 , 1 , "Argentinien" , new int[] {18 , 19});
// cID 4 - Afrika
provinces[21] = new Province(21 , 4 , 680 , 630 , 1 , "Madagaskar" , new int[] {24 , 22});
provinces[22] = new Province(22 , 4 , 580 , 624 , 1 , "Südafrika" , new int[] {21 , 23 , 24});
provinces[23] = new Province(23 , 4 , 572 , 537 , 2 , "Zentralafrika" , new int[] {22 , 25 , 24});
provinces[24] = new Province(24 , 4 , 632 , 500 , 2 , "Ostafrika" , new int[] {21 , 22 , 25 , 23 , 26});
provinces[25] = new Province(25 , 4 , 491 , 444 , 1 , "Nordafrika" , new int[] {15 , 16 , 26 , 23 , 24});
provinces[26] = new Province(26 , 4 , 574 , 414 , 1 , "Aegypten" , new int[] {27 , 25 , 24 , 16});
// cID 5 - Asien
provinces[27] = new Province(27 , 5 , 664 , 345 , 2 , "Mittlerer Osten" , new int[] {24 , 26 , 16 , 23 , 31 , 28});
provinces[28] = new Province(28 , 5 , 784 , 370 , 2 , "Indien" , new int[] {29 , 31 , 27 , 30});
provinces[29] = new Province(29 , 5 , 863 , 322 , 2 , "China" , new int[] {30 , 28 , 31 , 32 , 33 , 37});
provinces[30] = new Province(30 , 5 , 867 , 400 , 1 , "Südost Asien" , new int[] {29 , 39 , 28});
provinces[31] = new Province(31 , 5 , 724 , 262 , 1 , "Afganistan" , new int[] {29 , 28 , 27 , 13 , 32});
provinces[32] = new Province(32 , 5 , 740 , 163 , 1 , "Ural" , new int[] {29 , 33 , 31 , 13});
provinces[33] = new Province(33 , 5 , 802 , 128 , 1 , "Sibirien" , new int[] {34 , 35 , 37 , 29 , 32});
provinces[34] = new Province(34 , 5 , 884 , 82 , 1 , "Jakutien" , new int[] {36 , 35 , 33});
provinces[35] = new Province(35 , 5 , 867 , 176 , 2 , "Irkutsk" , new int[] {34 , 36 , 37 , 33});
provinces[36] = new Province(36 , 5 , 973 , 89 , 1 , "Kamtschatka" , new int[] {1 , 38 , 37 , 35 , 34});
provinces[37] = new Province(37 , 5 , 882 , 243 , 1 , "Mongolei" , new int[] {29 , 33 , 35 , 36 , 38});
provinces[38] = new Province(38 , 5 , 994 , 249 , 2 , "Japan" , new int[] {37 , 36});
// cID 6 - Ozeanien
provinces[39] = new Province(39 , 6 , 889 , 519 , 1 , "Indonesien" , new int[] {30 , 40 , 42});
provinces[40] = new Province(40 , 6 , 983 , 492 , 2 , "Neuguinea" , new int[] {39 , 41 , 42});
provinces[41] = new Province(41 , 6 , 1000, 595 , 1 , "Ost Australien" , new int[] {40 , 42});
provinces[42] = new Province(42 , 6 , 934 , 628 , 1 , "West Australien" , new int[] {40 , 41 , 39});
initProvinces();
}
/**
Anzahl der Provinzen.
*/
/**
Konstruktor der Weltkarte;
konstruiert eine GeneralMap mit den Ausmassen 1600 auf 900 Pixel.
*/
public Map_World(String[] playerList, int[] colorList)
{
super(playerList,colorList);
setBackground("MapWorld.png");
provinceCount = 42;
armyMinimum = 3;
/*
Hier werden später sämtliche Provinzen der Standard-Map erstellt.
Dies funktioniert folgendermassen:
=================================================================
Dieses kürzere Format ersetzt den langen Code und sorgt eventuell sogar für einen Geschwindigkeitsschub. Dabei sollte diesselbe Funktionalität erhalten bleiben.
provinces[<Provinz-ID>] = new Province(<Provinz-ID>,<Kontinent-ID>,<X-Position>,<Y-Position>,<Anzahl Sterne>,"<Anzeigename>", new int[] { <Liste aller Nachbarprovinzen> });
=================================================================
Der Speicherplatz für provinces[0] bleibt leer, da es keine Provinz mit der ID 0 gibt!
Und ja, ich weiss, dass das scheisse viel Schreibarbeit ist.
Aber da muss man durch, wir habens auch hinbekommen :P
~GruenerWal
*/
continentBoni = new int[] {0,5,5,2,3,7,2};
// Festlegung der Provinz-Anzahl
provinces = new Province[provinceCount + 1];
// Implementierung sämtlicher Provinzen
// ACHTUNG! Gaaaaanz viel Code!
// cID 1 - Nordamerika
provinces[1] = new Province( 1 , 1 , 64 , 106 , 1 , "Alaska" , new int[] {2 , 3 , 36});
provinces[2] = new Province( 2 , 1 , 162 , 106 , 1 , "NW-Territorien" , new int[] {1 , 3 , 4 , 9});
provinces[3] = new Province( 3 , 1 , 153 , 170 , 1 , "Alberta" , new int[] {1 , 2 , 4 , 5});
provinces[4] = new Province( 4 , 1 , 223 , 177 , 2 , "Ontario" , new int[] {2 , 3 , 5 , 6 , 7 , 9});
provinces[5] = new Province( 5 , 1 , 160 , 236 , 2 , "Weststaaten" , new int[] {3 , 4 , 6 , 8});
provinces[6] = new Province( 6 , 1 , 232 , 273 , 2 , "Oststaaten" , new int[] {4 , 5 , 7 , 8});
provinces[7] = new Province( 7 , 1 , 300 , 180 , 2 , "Quebec" , new int[] {4 , 6 , 9});
provinces[8] = new Province( 8 , 1 , 181 , 347 , 1 , "Mittelamerika" , new int[] {5 , 6 , 17});
provinces[9] = new Province( 9 , 1 , 365 , 55 , 1 , "Groenland" , new int[] {2 , 4 , 7 , 10});
// cID 2 - Europa
provinces[10] = new Province(10 , 2 , 454 , 142 , 1 , "Island" , new int[] {9 , 11 , 12});
provinces[11] = new Province(11 , 2 , 424 , 221 , 2 , "Grossbritannien" , new int[] {10 , 12 , 14 , 15});
provinces[12] = new Province(12 , 2 , 520 , 153 , 1 , "Skandinavien" , new int[] {10 , 11 , 13 , 14});
provinces[13] = new Province(13 , 2 , 636 , 180 , 2 , "Russland" , new int[] {12 , 14 , 16 , 27 , 31 , 32});
provinces[14] = new Province(14 , 2 , 528 , 232 , 2 , "Nordeuropa" , new int[] {11 , 12 , 13 , 15 , 16});
provinces[15] = new Province(15 , 2 , 449 , 335 , 2 , "Westeuropa" , new int[] {11 , 14 , 16 , 25});
provinces[16] = new Province(16 , 2 , 537 , 296 , 2 , "Suedeuropa" , new int[] {13 , 14 , 15 , 25 , 26 , 27});
// cID 3 - Suedamerika
provinces[17] = new Province(17 , 3 , 245 , 396 , 1 , "Venezuela" , new int[] {8 , 18 , 19});
provinces[18] = new Province(18 , 3 , 255 , 498 , 1 , "Peru" , new int[] {17 , 19 , 20});
provinces[19] = new Province(19 , 3 , 327 , 467 , 2 , "Brasilien" , new int[] {17 , 18 , 20 , 25});
provinces[20] = new Province(20 , 3 , 274 , 572 , 1 , "Argentinien" , new int[] {18 , 19});
// cID 4 - Afrika
provinces[21] = new Province(21 , 4 , 680 , 630 , 1 , "Madagaskar" , new int[] {24 , 22});
provinces[22] = new Province(22 , 4 , 580 , 624 , 1 , "Südafrika" , new int[] {21 , 23 , 24});
provinces[23] = new Province(23 , 4 , 572 , 537 , 2 , "Zentralafrika" , new int[] {22 , 25 , 24});
provinces[24] = new Province(24 , 4 , 632 , 500 , 2 , "Ostafrika" , new int[] {21 , 22 , 25 , 23 , 26});
provinces[25] = new Province(25 , 4 , 491 , 444 , 1 , "Nordafrika" , new int[] {15 , 16 , 26 , 23 , 24});
provinces[26] = new Province(26 , 4 , 574 , 414 , 1 , "Aegypten" , new int[] {27 , 25 , 24 , 16});
// cID 5 - Asien
provinces[27] = new Province(27 , 5 , 664 , 345 , 2 , "Mittlerer Osten" , new int[] {24 , 26 , 16 , 23 , 31 , 28});
provinces[28] = new Province(28 , 5 , 784 , 370 , 2 , "Indien" , new int[] {29 , 31 , 27 , 30});
provinces[29] = new Province(29 , 5 , 863 , 322 , 2 , "China" , new int[] {30 , 28 , 31 , 32 , 33 , 37});
provinces[30] = new Province(30 , 5 , 867 , 400 , 1 , "Südost Asien" , new int[] {29 , 39 , 28});
provinces[31] = new Province(31 , 5 , 724 , 262 , 1 , "Afganistan" , new int[] {29 , 28 , 27 , 13 , 32});
provinces[32] = new Province(32 , 5 , 740 , 163 , 1 , "Ural" , new int[] {29 , 33 , 31 , 13});
provinces[33] = new Province(33 , 5 , 802 , 128 , 1 , "Sibirien" , new int[] {34 , 35 , 37 , 29 , 32});
provinces[34] = new Province(34 , 5 , 884 , 82 , 1 , "Jakutien" , new int[] {36 , 35 , 33});
provinces[35] = new Province(35 , 5 , 867 , 176 , 2 , "Irkutsk" , new int[] {34 , 36 , 37 , 33});
provinces[36] = new Province(36 , 5 , 973 , 89 , 1 , "Kamtschatka" , new int[] {1 , 38 , 37 , 35 , 34});
provinces[37] = new Province(37 , 5 , 882 , 243 , 1 , "Mongolei" , new int[] {29 , 33 , 35 , 36 , 38});
provinces[38] = new Province(38 , 5 , 994 , 249 , 2 , "Japan" , new int[] {37 , 36});
// cID 6 - Ozeanien
provinces[39] = new Province(39 , 6 , 889 , 519 , 1 , "Indonesien" , new int[] {30 , 40 , 42});
provinces[40] = new Province(40 , 6 , 983 , 492 , 2 , "Neuguinea" , new int[] {39 , 41 , 42});
provinces[41] = new Province(41 , 6 , 1000, 595 , 1 , "Ost Australien" , new int[] {40 , 42});
provinces[42] = new Province(42 , 6 , 934 , 628 , 1 , "West Australien" , new int[] {40 , 41 , 39});
initProvinces();
}
}

Loading…
Cancel
Save