Beispiel #1
0
		public static void initNego( byte player, byte otherPlayer )
		{
			if ( !Form1.game.playerList[ player ].memory.attemptedNegoRecently( otherPlayer ) )
			{
				int p = 1;
				negoList nl = new negoList( new byte[] { otherPlayer, player } );
				int[] whw = nl.whatHeWants( p );
				int totInterestings = 0, totInterest = 0;

				for ( int i = 0; i < whw.Length; i++ )
					if ( whw[ i ] > 0 )
					{
						totInterestings ++;
						totInterest += whw[ i ];
					}

				if ( totInterestings > 0 )
					for ( int i = 0; i < nl.Length; i++ )
						if ( 
							whw[ i ] > totInterestings * 33 / 100 /*&&
							whw[ i ] < totInterestings * 66 / 100*/
							)
							nl.add( i );

				nl = fillProp( nl, (p+1)%2 );
				if ( nl != null )
				{
					for ( int p1 = 0; p1 < 2; p1 ++ )
						Form1.game.playerList[ nl.players[ p1 ] ].memory.addAttemptedNego( nl.players[ (p1+1)%2 ] );

					if ( acceptToInitNego( nl, p ) )
					{
						if ( otherPlayer == Form1.game.curPlayerInd )
						{
							wC.show = false;
							frmNegociation fn = new frmNegociation( Form1.game.curPlayerInd, player, -1 );

							fn.list = nl;
							fn.populateLBs();
							fn.ShowDialog();
							wC.show = true;
						}
						else
						{
							nl = fillProp( nl, p );
							if ( nl != null )
								nl.executeExchange();
						}
					}
				}
			}
		}
Beispiel #2
0
        private void cmdNegotiate_Click(object sender, EventArgs e)
        {
            frmNegociation civNegFrm = new frmNegociation(player, other, -1);

            if (aiNego.acceptToInitNego(civNegFrm.list, 0))
            {
                string titre = this.Text;
                platformSpec.manageWindows.prepareForDialog(this);                   //this.Text = "";
                civNegFrm.ShowDialog();
                this.Text = titre;
                this.Close();
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(
                    String.Format(language.getAString(language.order.tradeRefusesTo), Form1.game.playerList[other].playerName),
                    String.Format(language.getAString(language.order.panNegociatingWith), Form1.game.playerList[other].civName)
                    );
            }
        }
Beispiel #3
0
		private void cmdNegotiate_Click(object sender, EventArgs e)
		{

			frmNegociation civNegFrm = new frmNegociation( player, other, -1 );

			if ( aiNego.acceptToInitNego( civNegFrm.list, 0 ) )
			{
				string titre = this.Text;
				platformSpec.manageWindows.prepareForDialog( this ); //this.Text = "";
				civNegFrm.ShowDialog();
				this.Text = titre;
				this.Close();
			}
			else
				System.Windows.Forms.MessageBox.Show( 
					String.Format( language.getAString( language.order.tradeRefusesTo ), Form1.game.playerList[ other ].playerName ), 
					String.Format( language.getAString( language.order.panNegociatingWith ), Form1.game.playerList[ other ].civName )
					);
		}
Beispiel #4
0
        public static void initNego(byte player, byte otherPlayer)
        {
            if (!Form1.game.playerList[player].memory.attemptedNegoRecently(otherPlayer))
            {
                int      p = 1;
                negoList nl = new negoList(new byte[] { otherPlayer, player });
                int[]    whw = nl.whatHeWants(p);
                int      totInterestings = 0, totInterest = 0;

                for (int i = 0; i < whw.Length; i++)
                {
                    if (whw[i] > 0)
                    {
                        totInterestings++;
                        totInterest += whw[i];
                    }
                }

                if (totInterestings > 0)
                {
                    for (int i = 0; i < nl.Length; i++)
                    {
                        if (
                            whw[i] > totInterestings * 33 / 100                               /*&&
                                                                                               * whw[ i ] < totInterestings * 66 / 100*/
                            )
                        {
                            nl.add(i);
                        }
                    }
                }

                nl = fillProp(nl, (p + 1) % 2);
                if (nl != null)
                {
                    for (int p1 = 0; p1 < 2; p1++)
                    {
                        Form1.game.playerList[nl.players[p1]].memory.addAttemptedNego(nl.players[(p1 + 1) % 2]);
                    }

                    if (acceptToInitNego(nl, p))
                    {
                        if (otherPlayer == Form1.game.curPlayerInd)
                        {
                            wC.show = false;
                            frmNegociation fn = new frmNegociation(Form1.game.curPlayerInd, player, -1);

                            fn.list = nl;
                            fn.populateLBs();
                            fn.ShowDialog();
                            wC.show = true;
                        }
                        else
                        {
                            nl = fillProp(nl, p);
                            if (nl != null)
                            {
                                nl.executeExchange();
                            }
                        }
                    }
                }
            }
        }