Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1.  
  2. function game_state_get_cards(gs, current_pile, lane)
  3. {
  4. var state = gs.s;
  5.  
  6. if(current_pile == piles["ATTACKER_DECK"])
  7. return card_list_make_face_up(make_card_list_from_generic(state.a));
  8. if(current_pile == piles["ATTACKER_DISCARD"])
  9. return card_list_make_face_up(make_card_list_from_generic(state.xa));
  10.  
  11. ///so eg gets state.hd0 if we are d0
  12. ///or if its the enemy, gets all their cards
  13. if(current_pile == piles["ATTACKER_HAND"])
  14. {
  15. var all_cards = card_list_make();
  16.  
  17. for(var i=0; i < 16; i++)
  18. {
  19. var str = "ha" + i;
  20.  
  21. if(state[str] == null)
  22. continue;
  23.  
  24. var tcl = make_card_list_from_generic(state[str]);
  25.  
  26. if(str == gs.player_hand)
  27. return card_list_make_face_up(tcl)
  28.  
  29. all_cards = card_list_merge(tcl, all_cards);
  30. }
  31.  
  32. if(gs.pid == player_t["ATTACKER"])
  33. {
  34. return card_list_make_face_up(make_card_list_from_generic(state[gs.player_hand]));
  35. }
  36.  
  37. return card_list_make_face_up(all_cards);
  38. }
  39.  
  40. if(current_pile == piles["DEFENDER_HAND"])
  41. {
  42. var all_cards = card_list_make();
  43.  
  44. for(var i=0; i < 16; i++)
  45. {
  46. var str = "hd" + i;
  47.  
  48. if(state[str] == null)
  49. continue;
  50.  
  51. var tcl = make_card_list_from_generic(state[str]);
  52.  
  53. if(str == gs.player_hand)
  54. return card_list_make_face_up(tcl)
  55.  
  56. all_cards = card_list_merge(tcl, all_cards);
  57. }
  58.  
  59. if(gs.pid == player_t["DEFENDER"])
  60. {
  61. return card_list_make_face_up(make_card_list_from_generic(state[gs.player_hand]));
  62. }
  63.  
  64. return card_list_make_face_up(all_cards);
  65. }
  66.  
  67. if(current_pile == piles["LANE_DISCARD"])
  68. return card_list_make_face_up(make_card_list_from_generic(state["x" + lane]));
  69. if(current_pile == piles["LANE_DECK"])
  70. return card_list_make_face_up(make_card_list_from_generic(state["l" + lane]));
  71.  
  72. if(current_pile == piles["DEFENDER_STACK"] && gs.pid == 1)
  73. return make_card_list_from_generic(state["d" + lane]);
  74.  
  75. if(current_pile == piles["DEFENDER_STACK"] && gs.pid == 0)
  76. return card_list_make_face_up(make_card_list_from_generic(state["d" + lane]));
  77.  
  78. if(current_pile == piles["ATTACKER_STACK"])
  79. return card_list_make_face_up(make_card_list_from_generic(state["a" + lane]));
  80.  
  81. return card_list_make();
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement