⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertymanager.java

📁 This A java game to play monopoly
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				two.Money += Properties[20][1];				Properties[20][1] = 500;			}			else if( two.Position == 4 ) {	//if on 'Income Tax'				two.Money -= 200;				Properties[20][1] += 200;			}			else if( two.Position == 38 ) {	//if on 'Luxury Tax'				two.Money -= 75;				Properties[20][1] += 75;			}			else if( two.Position == 7  ||	//if on 'Chance'				   two.Position == 22 ||				   two.Position == 36   ) {					return Chance( 2 );			}			else if( two.Position == 2  ||	//if on 'Comm. Chest'				   two.Position == 17 ||				   two.Position == 33   ) {					return CChest( 2 );			}		}		return "";	}	public String Chance( int pn ) {		int r = ( int )( Math.random() * chance.length );		if( pn == 1 ) {			switch( r ) {				case 0:					one.Money-=15;					Properties[20][1] += 15;					break;				case 1:					one.Money-=200;					Properties[20][1] += 200;					break;				case 2:					if( one.Position >= 24 )						one.Money+=200;					one.Position = 24;					if( Properties[24][0] == 2 ) {						one.Money -= Properties[24][Properties[24][1]+2];						two.Money += Properties[24][Properties[24][1]+2];					}					break;				case 3:					one.Position -= 3;					if( one.Position == 4 ) {						one.Money -= 200;						Properties[20][1] += 200;					}					else if( one.Position == 19 && Properties[19][0] == 2 ) {						one.Money -= Properties[19][Properties[19][1]+2];						two.Money += Properties[19][Properties[19][1]+2];					}					break;				case 4:					one.Money+=150;					break;				case 5:					one.Position = 39;					if( one.Position == 39 && Properties[39][0] == 2 ) {						one.Money -= Properties[39][Properties[19][1]+2];						two.Money += Properties[39][Properties[19][1]+2];					}					break;				case 6:					if( one.Position >= 11 )						one.Money+=200;					one.Position = 11;					break;				case 7:					one.Money-=50;					Properties[20][1] += 50;					break;				case 8:					if( one.Position >= 5 )						one.Money += 200;					one.Position = 5;					if( Properties[5][0] == 2 ) {						one.Money -= 2*Properties[5][2];						two.Money += 2*Properties[5][2];					}					break;				case 9:					one.Money+=50;					break;				case 10:					one.Money+=200;					one.Position = 0;					break;				case 11:					one.inJail = true;					one.Position = 10;					break;			}		}		else {			switch( r ) {				case 0:					two.Money-=15;					Properties[20][1] += 15;					break;				case 1:					two.Money-=200;					Properties[20][1] += 200;					break;				case 2:					if( two.Position >= 24 )						two.Money+=200;					two.Position = 24;					if( Properties[24][0] == 1 ) {						one.Money += Properties[24][Properties[24][1]+2];						two.Money -= Properties[24][Properties[24][1]+2];					}					break;				case 3:					two.Position -= 3;					if( two.Position == 4 ) {						two.Money -= 200;						Properties[20][1] += 200;					}					else if( two.Position == 19 && Properties[19][0] == 1 ) {						one.Money += Properties[19][Properties[19][1]+2];						two.Money -= Properties[19][Properties[19][1]+2];					}					break;				case 4:					two.Money+=150;					break;				case 5:					two.Position = 39;					if( two.Position == 39 && Properties[39][0] == 1 ) {						one.Money += Properties[39][Properties[19][1]+2];						two.Money -= Properties[39][Properties[19][1]+2];					}					break;				case 6:					if( two.Position >= 11 )						two.Money+=200;					two.Position = 11;					break;				case 7:					two.Money-=50;					Properties[20][1] += 50;					break;				case 8:					if( two.Position >= 5 )						two.Money += 200;					two.Position = 5;					if( Properties[5][0] == 1 ) {						one.Money += 2*Properties[5][2];						two.Money -= 2*Properties[5][2];					}					break;				case 9:					two.Money+=50;					break;				case 10:					two.Money+=200;					two.Position = 0;					break;				case 11:					two.inJail = true;					two.Position = 10;					break;			}		}			//Draw the frame for chance			final Frame f = new Frame(" Chance ");			f.setSize( 400, 100 );			f.setBackground( Color.lightGray);			f.setLayout( new BorderLayout() );			Label l = new Label( chance[r] );			f.add( l, BorderLayout.CENTER );			f.setVisible( true );			try { Thread.sleep( 3000 ); }			catch( Exception ex ) {}			f.setVisible( false );			f.addWindowListener( new WindowAdapter() {				public void windowClosing( WindowEvent e ) {					f.setVisible( false );				}			});		return chance[r];	}	public String CChest( int pn ) {		int r = ( int )( Math.random() * cchest.length );		if( pn == 1 ) {			switch( r ) {				case 0:					one.Position = 10;					one.inJail = true;					break;				case 1:					one.Money+=10;					break;				case 2:					one.Money+=200;					break;				case 3:					one.Money-=50;					Properties[20][1] += 50;					break;				case 4:					one.Money+=100;					break;				case 5:					one.Money+=50;					break;				case 6:					one.Position = 0;					one.Money+=200;				case 7:					one.Money+=100;					break;				case 8:					one.Money-=150;					Properties[20][1] += 150;					break;				case 9:					one.Money-=150;					Properties[20][1] += 150;					break;				case 10:					one.Money+= 100;					break;				case 11:					one.Money+=45;					break;				case 12:					one.Money-=100;					Properties[20][1] += 100;					break;				case 13:					one.Money+=20;					break;			}		}		else {			switch( r ) {				case 0:									two.Position = 10;					two.inJail = true;					break;				case 1:					two.Money+=10;					break;				case 2:					two.Money+=200;					break;				case 3:					two.Money-=50;					Properties[20][1] += 50;					break;				case 4:					two.Money+=100;					break;				case 5:					two.Money+=50;					break;				case 6:					two.Position = 0;					two.Money+=200;				case 7:					two.Money+=100;					break;				case 8:					two.Money-=150;					Properties[20][1] += 150;					break;				case 9:					two.Money-=150;					Properties[20][1] += 150;					break;				case 10:					two.Money+= 100;					break;				case 11:					two.Money+=45;					break;				case 12:					two.Money-=100;					Properties[20][1] += 100;					break;				case 13:					two.Money+=20;					break;			}		}			//Draw the frame for cchest								final Frame f2 = new Frame(" Community Chest ");			f2.setSize( 400, 100 );			f2.setBackground( Color.lightGray );			f2.setLayout( new BorderLayout() );			Label l2 = new Label( cchest[r] );			f2.add( l2, BorderLayout.CENTER );			f2.setVisible( true );			try { Thread.sleep( 3000 ); }			catch( Exception ex ) {}			f2.setVisible( false );			f2.addWindowListener( new WindowAdapter() {				public void windowClosing( WindowEvent e ) {					f2.setVisible( false );				}			});		return cchest[r];	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -