erklärt sich von selbst
master
SariusRu 9 years ago
parent de1771978d
commit 680aa07c13

@ -0,0 +1,57 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Fight here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Fight extends Map_World
{
/**
* Constructor for objects of class Fight.
*
*/
Province offenderProvince;
Province defenderProvince;
public Fight()
{
}
public void act()
{
for ( int i = 0; i <= provinceCount; i++)
{
if (provinces[i].hasClicked() == true)
{
provinces[i] = offenderProvince;
chooser(provinces[i], i);
break;
}
}
}
private void chooser(Province offenderProvince, int i)
{
int EntitiesOffender = provinces[i].getEntityCount();
i = 0;
for (i = 0; i <= provinceCount; i++)
{
if (provinces[i].hasClicked() == true && provinces[i] != offenderProvince)
{
provinces[i] = defenderProvince;
int EntitiesDefender = provinces[i].getEntityCount();
chooser(offenderProvince,defenderProvince,EntitiesOffender,EntitiesDefender);
break;
}
}
}
private void chooser(Province offenderProvince, Province defenderProvince, int EntitiesOffender, int EntitiesDefender)
{
int diceDefender = Dice_Defender.dice_defender(EntitiesDefender);
}
}

@ -23,15 +23,16 @@ public class Map_World extends GeneralMap
public Map_World()
{
super(1600,900,1);
Province[] provinces;
int[] neighbours;
super();
Province[] provinces;
/**
* Hier werden später sämtliche Provinzen der Standard-Map erstellt.
* Dies funktioniert folgendermassen:
* =================================================================
*
* VERALTETER KOMMENTAR VON GruenerWal:
* Im Folgenden wird nun jede Provinz einzeln erstellt:
* |---
* nextProvinces = new int[<Anzahl angrenzende Provinzen>];
@ -41,6 +42,13 @@ public class Map_World extends GeneralMap
* ---|
*
* =================================================================
*
* NEUES FORMAT VON FELIX STUPP:
* 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.
@ -57,307 +65,58 @@ public class Map_World extends GeneralMap
// ACHTUNG! Gaaaaanz viel Code!
// cID 1 - Nordamerika
neighbours = new int[3];
neighbours[0] = 2;
neighbours[1] = 3;
neighbours[2] = 36;
provinces[1] = new Province(1,1,64,106,1,"Alaska",neighbours);
neighbours = new int[4];
neighbours[0] = 1;
neighbours[1] = 3;
neighbours[2] = 4;
neighbours[3] = 9;
provinces[2] = new Province(2,1,162,106,1,"NW-Territorien",neighbours);
neighbours = new int[4];
neighbours[0] = 1;
neighbours[1] = 2;
neighbours[2] = 4;
neighbours[3] = 5;
provinces[3] = new Province(3,1,53,170,1,"Alberta",neighbours);
neighbours = new int[6];
neighbours[0] = 2;
neighbours[1] = 3;
neighbours[2] = 5;
neighbours[3] = 6;
neighbours[4] = 7;
neighbours[5] = 9;
provinces[4] = new Province(4,1,223,177,2,"Ontario",neighbours);
neighbours = new int[4];
neighbours[0] = 3;
neighbours[1] = 4;
neighbours[2] = 6;
neighbours[3] = 8;
provinces[5] = new Province(5,1,160,236,2,"Weststaaten",neighbours);
neighbours = new int[4];
neighbours[0] = 4;
neighbours[1] = 5;
neighbours[2] = 7;
neighbours[3] = 8;
provinces[6] = new Province(6,1,232,273,2,"Oststaaten",neighbours);
neighbours = new int[3];
neighbours[0] = 4;
neighbours[1] = 6;
neighbours[2] = 9;
provinces[7] = new Province(7,1,300,180,2,"Quebec",neighbours);
neighbours = new int[3];
neighbours[0] = 5;
neighbours[1] = 6;
neighbours[2] = 17;
provinces[8] = new Province(8,1,181,347,1,"Mittelamerika",neighbours);
neighbours = new int[4];
neighbours[0] = 2;
neighbours[1] = 4;
neighbours[2] = 7;
neighbours[3] = 10;
provinces[9] = new Province(9,1,365,55,1,"Groenland",neighbours);
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 , 53 , 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
neighbours = new int[3];
neighbours[0] = 9;
neighbours[1] = 11;
neighbours[2] = 12;
provinces[10] = new Province(10,2,454,142,1,"Island",neighbours);
neighbours = new int[4];
neighbours[0] = 10;
neighbours[1] = 12;
neighbours[2] = 14;
neighbours[3] = 15;
provinces[11] = new Province(11,2,424,221,2,"Grossbritannien",neighbours);
neighbours = new int[4];
neighbours[0] = 10;
neighbours[1] = 11;
neighbours[2] = 13;
neighbours[3] = 14;
provinces[12] = new Province(12,2,520,153,1,"Skandinavien",neighbours);
neighbours = new int[6];
neighbours[0] = 12;
neighbours[1] = 14;
neighbours[2] = 16;
neighbours[3] = 27;
neighbours[4] = 31;
neighbours[5] = 32;
provinces[13] = new Province(13,2,636,180,2,"Russland",neighbours);
neighbours = new int[5];
neighbours[0] = 11;
neighbours[1] = 12;
neighbours[2] = 13;
neighbours[3] = 15;
neighbours[4] = 16;
provinces[14] = new Province(14,2,528,232,2,"Nordeuropa",neighbours);
neighbours = new int[4];
neighbours[0] = 11;
neighbours[1] = 14;
neighbours[2] = 16;
neighbours[3] = 25;
provinces[15] = new Province(15,2,449,335,2,"Westeuropa",neighbours);
neighbours = new int[6];
neighbours[0] = 13;
neighbours[1] = 14;
neighbours[2] = 15;
neighbours[3] = 25;
neighbours[4] = 26;
neighbours[5] = 27;
provinces[16] = new Province(16,2,537,296,2,"Suedeuropa",neighbours);
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
neighbours = new int[3];
neighbours[0] = 8;
neighbours[1] = 18;
neighbours[2] = 19;
provinces[17] = new Province(17,3,245,396,1,"Venezuela",neighbours);
neighbours = new int[3];
neighbours[0] = 17;
neighbours[1] = 19;
neighbours[2] = 20;
provinces[18] = new Province(18,3,255,498,1,"Peru",neighbours);
neighbours = new int[4];
neighbours[0] = 17;
neighbours[1] = 18;
neighbours[2] = 20;
neighbours[3] = 25;
provinces[19] = new Province(19,3,327,467,2,"Brasilien",neighbours);
neighbours = new int[2];
neighbours[0] = 18;
neighbours[1] = 19;
provinces[20] = new Province(20,3,274,572,1,"Argentinien",neighbours);
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
neighbours = new int[2];
neighbours [0] = 24;
neighbours [1] = 22;
provinces[21] = new Province (21,4,680,630,1,"Madagaskar",neighbours);
neighbours = new int[3];
neighbours [0] = 21;
neighbours [1] = 23;
neighbours [2] = 24;
provinces[22] = new Province (22,4,580,624,1,"Südafrika",neighbours);
neighbours = new int[3];
neighbours [0] = 22;
neighbours [1] = 25;
neighbours [2] = 24;
provinces[23] = new Province (23,4,572,537,2,"Zentralafrika",neighbours);
neighbours = new int[5];
neighbours [0] = 21;
neighbours [1] = 22;
neighbours [2] = 25;
neighbours [3] = 23;
neighbours [4] = 26;
provinces[24] = new Province (24,4,632,500,2,"Ostafrika",neighbours);
addObject(provinces[24],632,500);
neighbours = new int[5];
neighbours [0] = 15;
neighbours [1] = 16;
neighbours [2] = 26;
neighbours [3] = 23;
neighbours [4] = 24;
provinces[25] = new Province (25,4,491,444,1,"Nordafrika",neighbours);
neighbours = new int[4];
neighbours [0] = 27;
neighbours [1] = 25;
neighbours [2] = 24;
neighbours [3] = 16;
provinces[26] = new Province (26,4,574,414,1,"Aegypten",neighbours);
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
neighbours = new int[6];
neighbours [0] = 24;
neighbours [1] = 26;
neighbours [2] = 16;
neighbours [3] = 13;
neighbours [4] = 31;
neighbours [5] = 28;
provinces[27] = new Province (27,5,664,345,2,"Mittlerer Osten",neighbours);
neighbours = new int[4];
neighbours [0] = 29;
neighbours [1] = 31;
neighbours [2] = 27;
neighbours [3] = 30;
provinces[28] = new Province (28,5,784,370,2,"Indien",neighbours);
neighbours = new int[6];
neighbours [0] = 30;
neighbours [1] = 28;
neighbours [2] = 31;
neighbours [3] = 32;
neighbours [4] = 33;
neighbours [5] = 37;
provinces[29] = new Province (29,5,863,322,2,"China",neighbours);
neighbours = new int[3];
neighbours [0] = 29;
neighbours [1] = 39;
neighbours [2] = 28;
provinces[30] = new Province (30,5,867,400,1,"Südost Asien",neighbours);
neighbours = new int[5];
neighbours [0] = 29;
neighbours [1] = 28;
neighbours [2] = 27;
neighbours [3] = 13;
neighbours [4] = 32;
provinces[31] = new Province (31,5,724,262,1,"Afganistan",neighbours);
neighbours = new int[4];
neighbours [0] = 29;
neighbours [1] = 33;
neighbours [2] = 31;
neighbours [3] = 13;
provinces[32] = new Province (32,5,740,163,1,"Ural",neighbours);
neighbours = new int[5];
neighbours [0] = 34;
neighbours [1] = 35;
neighbours [2] = 37;
neighbours [3] = 29;
neighbours [4] = 32;
provinces[33] = new Province (33,5,802,128,1,"Sibirien",neighbours);
neighbours = new int[3];
neighbours [0] = 36;
neighbours [1] = 35;
neighbours [2] = 33;
provinces[34] = new Province (34,5,884,82,1,"Jakutien",neighbours);
neighbours = new int[4];
neighbours [0] = 34;
neighbours [1] = 36;
neighbours [2] = 37;
neighbours [3] = 33;
provinces[35] = new Province (35,5,867,176,2,"Irkutsk",neighbours);
neighbours = new int[5];
neighbours [0] = 1;
neighbours [1] = 38;
neighbours [2] = 37;
neighbours [3] = 35;
neighbours [4] = 34;
provinces[36] = new Province (36,5,973,89,1,"Kamtschatka",neighbours);
neighbours = new int[5];
neighbours [0] = 29;
neighbours [1] = 33;
neighbours [2] = 35;
neighbours [3] = 36;
neighbours [4] = 38;
provinces[37] = new Province (37,5,882,243,1,"Mongolei",neighbours);
neighbours = new int[2];
neighbours [0] = 37;
neighbours [1] = 36;
provinces[38] = new Province (38,5,994,249,2,"Japan",neighbours);
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
neighbours = new int[3];
neighbours [0] = 30;
neighbours [1] = 40;
neighbours [2] = 42;
provinces[39] = new Province (39,6,889,519,1,"Indonesien",neighbours);
neighbours = new int[3];
neighbours [0] = 39;
neighbours [1] = 41;
neighbours [2] = 42;
provinces[40] = new Province (40,6,983,492,2,"Neuguinea",neighbours);
neighbours = new int[2];
neighbours [0] = 40;
neighbours [1] = 42;
provinces[41] = new Province (41,6,1000,595,1,"Ost Australien",neighbours);
neighbours = new int[3];
neighbours [0] = 40;
neighbours [1] = 41;
neighbours [2] = 39;
provinces[42] = new Province (42,6,934,628,1,"West Australien",neighbours);
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});
for (int c = 1; c <= provinceCount; c++)
{

Loading…
Cancel
Save