public void kill(PlayerList killer) { kill(); if (ind == 1) { player.kill(killer); } }
public void transfertToPlayer(PlayerList nextOwner) { // state = (byte)enums.cityState.dead; /* nextOwner.cityNumber ++; * * if ( nextOwner.cityNumber >= nextOwner.cityList.Length ) * { * CityList[] cityListBuffer = nextOwner.cityList; * nextOwner.cityList = new CityList[ cityListBuffer.Length + 5 ]; * * for ( int i = 0; i < cityListBuffer.Length; i ++ ) * nextOwner.cityList[ i ] = cityListBuffer[ i ]; * } * * newCity = new CityList( nextOwner, nextOwner.cityNumber );*/ CityList newCity = nextOwner.addCity(); // getTreasure( nextOwner.player, player, game.grid[ xDest, yDest ].city ); #region get treasure byte[] posTechno = new byte[Statistics.technologies.Length]; byte nbr = 0; for (int i = 1; i < Statistics.technologies.Length; i++) { if ( nextOwner.technos[i].researched && !player.technos[i].researched ) { posTechno[nbr] = (byte)i; nbr++; } } if (nbr > 0) { Random r = new Random(); byte technoChose = posTechno[r.Next(nbr - 1) + 1]; nextOwner.technos[technoChose].researched = true; } if ( ( player.cityList[city].population > 6 || player.cityList[city].isCapitale ) && player.technos[(byte)Form1.technoList.mapMaking].researched ) { for (int x = 0; x < Form1.game.width; x++) { for (int y = 0; y < Form1.game.height; y++) { if (Form1.game.grid[x, y].territory - 1 == player.player || player.discovered[x, y]) { nextOwner.discovered[x, y] = true; } } } } else if ( player.cityList[city].population > 3 && player.technos[(byte)Form1.technoList.mapMaking].researched) { for (int x = 0; x < Form1.game.width; x++) { for (int y = 0; y < Form1.game.height; y++) { if (Form1.game.grid[x, y].territory - 1 == player.player) { nextOwner.discovered[x, y] = true; } } } } #endregion labor.removeAllLabor(player.player, city); newCity.buildingList = this.buildingList; newCity.foodReserve = this.foodReserve; newCity.name = this.name; newCity.population = this.population; newCity.X = this.X; newCity.Y = this.Y; newCity.originalOwner = this.originalOwner; state = (byte)enums.cityState.dead; // game.grid[ xDest, yDest ].territory - 1 = owner; player.game.grid[X, Y].city = newCity.city; if ( nextOwner.economyType == (byte)enums.economies.slaveryRacial && newCity.population > 0 ) { int slavesToTransfert = newCity.population / 2; nextOwner.slaves.addSlave(slavesToTransfert); newCity.population -= (byte)slavesToTransfert; System.Windows.Forms.MessageBox.Show( String.Format(language.getAString(language.order.slaveryAquiredFromCity), slavesToTransfert, newCity.name), language.getAString(language.order.slaveryTitle) ); } ai.chooseConstruction(nextOwner.player, nextOwner.cityNumber); player.game.frontier.setFrontiers(); newCity.laborPos = new Point[0]; labor.addAllLabor(nextOwner.player, nextOwner.cityNumber); newCity.setHasDirectAccessToRessource(); bool oneCityLeft = false; for (int i = 1; i <= player.cityNumber; i++) { if (player.cityList[i].state != (byte)enums.cityState.dead) { oneCityLeft = true; break; } } if (!oneCityLeft) { player.kill(nextOwner); } else if (this.isCapitale) { bool found = false; for (int c = 1; c <= player.cityNumber && !found; c++) { if (player.cityList[c].state != (byte)enums.cityState.dead) { found = true; player.cityList[c].isCapitale = true; } } if (!found) { System.Windows.Forms.MessageBox.Show("error in finding a capital"); } } if (player.player == Form1.game.curPlayerInd) { open.cityFrm(newCity); //owner, city, this ); } // openCityFrm( owner, nextOwner.cityNumber ); }