Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. pub l ic c l a s s GameServer {
  2. 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 ) {
  3. 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 ; }
  4. game . wi thT r aine r s ( pl a ye r s ) ;
  5. game . c r e a t eDi c e ( ) ;
  6. Random random=new Random( 4 2 ) ;
  7. f o r ( i n t i = 1 ; i < pl a ye r s . len g th ; i ++) {
  8. pl a ye r s [ i − 1 ] . withNext ( pl a ye r s [ i ] ) . withGame (game ) ;
  9. }
  10. pl a ye r s [ pl a ye r s . len g th − 1 ] . withNext ( pl a ye r s [ 0 ] ) . withGame (game ) ;
  11. pl a ye r s [ pl a ye r s . len g th − 1 ] . crea teZombies ( ) . withHp ( 1 0 ) . withAp ( 4 2 ) .
  12. withName ("LittleBrain") ;
  13. f o r ( T r ai ne r t r a i n e r : pl a ye r s ) {
  14. f o r ( i n t t = 0; t < 1 5; t ++) {
  15. 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 ( )
  16. % 50+42 ) ) ;
  17. }
  18. }
  19. game . s e t C u r r e n t T r ai n e r ( pl a ye r s [ 0 ] ) ;
  20. f o r ( i n t i = 1; i <=100; i ++) {
  21. Ground f i e l d ;
  22. i f ( i % 6 == 5 ) {
  23. f i e l d = game . createGroundsRock ( ) ;
  24. } e l s e {
  25. f i e l d = game . crea teGroundsGrass ( ) ;
  26. }
  27. f i e l d . withX ( i ) . withY ( i /10+1) ;
  28. i f ( i % 9 == 3 ) {
  29. f i e l d . crea teZombies ( ) . withHp ( 1 0 ) . withAp (random . n e x t I n t ( ) ) ;
  30. }
  31. }
  32. r e tu rn game ;
  33. }
  34. pub l ic s t a t i c Game createGame ( ) {
  35. T r ai ne r t 1 = new T r ai ne r ( ) . wi thColor ("green") . withName ("Alice") ;
  36. T r ai ne r t 2 = new T r ai ne r ( ) . wi thColor ("orange") . withName ("Bob") ;
  37. Game game= i n i t (new Game ( ) , t1 , t 2 ) ;
  38. r e tu rn game ;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement