Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub l ic c l a s s GameServer {
- pub l ic s t a t i c Game i n i t ( Game game , T r ai ne r . . . t r a i n e r s ) {
- i f ( pl a y e r s == nu l l || pl a ye r s . len g th < 2 ) { r e tu rn nu l l ; }
- game . wi thT r aine r s ( pl a ye r s ) ;
- game . c r e a t eDi c e ( ) ;
- Random random=new Random( 4 2 ) ;
- f o r ( i n t i = 1 ; i < pl a ye r s . len g th ; i ++) {
- pl a ye r s [ i − 1 ] . withNext ( pl a ye r s [ i ] ) . withGame (game ) ;
- }
- pl a ye r s [ pl a ye r s . len g th − 1 ] . withNext ( pl a ye r s [ 0 ] ) . withGame (game ) ;
- pl a ye r s [ pl a ye r s . len g th − 1 ] . crea teZombies ( ) . withHp ( 1 0 ) . withAp ( 4 2 ) .
- withName ("LittleBrain") ;
- f o r ( T r ai ne r t r a i n e r : pl a ye r s ) {
- f o r ( i n t t = 0; t < 1 5; t ++) {
- t r a i n e r . c r e a t eT r a p s ( ) . wi thSuccessR a te ( ( i n t ) ( t+random . nextLong ( )
- % 50+42 ) ) ;
- }
- }
- game . s e t C u r r e n t T r ai n e r ( pl a ye r s [ 0 ] ) ;
- f o r ( i n t i = 1; i <=100; i ++) {
- Ground f i e l d ;
- i f ( i % 6 == 5 ) {
- f i e l d = game . createGroundsRock ( ) ;
- } e l s e {
- f i e l d = game . crea teGroundsGrass ( ) ;
- }
- f i e l d . withX ( i ) . withY ( i /10+1) ;
- i f ( i % 9 == 3 ) {
- f i e l d . crea teZombies ( ) . withHp ( 1 0 ) . withAp (random . n e x t I n t ( ) ) ;
- }
- }
- r e tu rn game ;
- }
- pub l ic s t a t i c Game createGame ( ) {
- T r ai ne r t 1 = new T r ai ne r ( ) . wi thColor ("green") . withName ("Alice") ;
- T r ai ne r t 2 = new T r ai ne r ( ) . wi thColor ("orange") . withName ("Bob") ;
- Game game= i n i t (new Game ( ) , t1 , t 2 ) ;
- r e tu rn game ;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement