home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / BakersGame.dxr / 00066.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  6.8 KB  |  252 lines

  1. global pootimer, tableau
  2.  
  3. on shuffle
  4.   templist1 = []
  5.   templist2 = []
  6.   repeat with rank in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
  7.     repeat with suit in ["hearts", "clubs", "spades", "diamonds"]
  8.       templist1.add([#rank: rank, #suit: suit])
  9.     end repeat
  10.   end repeat
  11.   repeat while templist1.count > 0
  12.     tempholder = templist1[random(templist1.count)]
  13.     templist2.add(tempholder)
  14.     templist1.deleteOne(tempholder)
  15.   end repeat
  16.   return templist2
  17. end
  18.  
  19. on gethotcard somecard
  20.   global cell, foundation, tableau
  21.   if (somecard >= 114) and (somecard <= 117) then
  22.     resultz = cell[symbol(string(somecard))]
  23.   end if
  24.   if (somecard >= 118) and (somecard <= 121) then
  25.     resultz = foundation[symbol(string(somecard))]
  26.   end if
  27.   if (somecard >= 10) and (somecard <= 113) then
  28.     resultz = tableau[symbol(string(sprite(somecard).startFrame))]
  29.   end if
  30.   return resultz
  31. end
  32.  
  33. on gethotcardtwo somecard
  34.   global cell, foundation, tableau
  35.   if (somecard >= 114) and (somecard <= 117) then
  36.     resultz = cell[symbol(string(somecard))].cards[cell[symbol(string(somecard))].cards.count]
  37.   end if
  38.   if (somecard >= 118) and (somecard <= 121) then
  39.     resultz = foundation[symbol(string(somecard))].cards[foundation[symbol(string(somecard))].cards.count]
  40.   end if
  41.   if (somecard >= 10) and (somecard <= 113) then
  42.     resultz = tableau[symbol(string(sprite(somecard).startFrame))].cards[symbol(string(somecard))]
  43.   end if
  44.   return resultz
  45. end
  46.  
  47. on subpoints somecard
  48.   global cell, foundation, tableau, points
  49.   if (somecard < 118) or (somecard > 121) then
  50.     points = points - 20
  51.   end if
  52. end
  53.  
  54. on checkwin
  55.   global foundation
  56.   repeat with i = 1 to 4
  57.     if foundation[i].cards.count = 0 then
  58.       exit repeat
  59.     end if
  60.     if foundation[i].cards[foundation[i].cards.count].rank <> "king" then
  61.       exit repeat
  62.     end if
  63.     if i = 4 then
  64.       win = "yes"
  65.       pootimer = timeout("fuckt").new(130, #gotoit)
  66.     end if
  67.   end repeat
  68.   checklose()
  69. end
  70.  
  71. on addpoints somecard
  72.   global points
  73.   if (somecard >= 118) and (somecard <= 121) then
  74.     points = points + 20
  75.   end if
  76. end
  77.  
  78. on hiya somecard
  79.   global cell, foundation, tableau
  80.   if (somecard >= 114) and (somecard <= 117) then
  81.     resultz = 0
  82.   end if
  83.   if (somecard >= 118) and (somecard <= 121) then
  84.     resultz = 0
  85.   end if
  86.   if (somecard >= 10) and (somecard <= 113) then
  87.     resultz = 1
  88.   end if
  89.   return resultz
  90. end
  91.  
  92. on checklose
  93.   repeat with it = 1 to tableau.count
  94.     if tableau[it].cards.count = 0 then
  95.       next repeat
  96.     end if
  97.     shit = tableau[it].cards[tableau[it].cards.count].spnum
  98.     repeat with cakes = 114 to 117
  99.       if sprite(cakes).member.name = "grayback" then
  100.         abort()
  101.       end if
  102.     end repeat
  103.     repeat with cakes = 118 to 121
  104.       if sprite(cakes).member.name = "grayback" then
  105.         if getValue(sprite(shit).member.name) = 1 then
  106.           abort()
  107.         end if
  108.         next repeat
  109.       end if
  110.       if (getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) + 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(cakes).member.name)) then
  111.         abort()
  112.       end if
  113.     end repeat
  114.     repeat with akes = 1 to tableau.count
  115.       if tableau[akes].cards.count = 0 then
  116.         if getValue(sprite(shit).member.name) = 13 then
  117.           abort()
  118.         end if
  119.         next repeat
  120.       end if
  121.       cakes = tableau[akes].cards[tableau[akes].cards.count].spnum
  122.       if (getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) - 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(cakes).member.name)) then
  123.         abort()
  124.       end if
  125.     end repeat
  126.     if sprite(tableau[it].cards[tableau[it].cards.count].spnum).backCardEQ() then
  127.       abort()
  128.     end if
  129.   end repeat
  130.   repeat with shit = 114 to 117
  131.     if sprite(shit).member.name = "grayback" then
  132.       next repeat
  133.     end if
  134.     repeat with cakes = 118 to 121
  135.       if sprite(cakes).member.name = "grayback" then
  136.         if getValue(sprite(shit).member.name) = 1 then
  137.           abort()
  138.         end if
  139.         next repeat
  140.       end if
  141.       if (getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) + 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(cakes).member.name)) then
  142.         abort()
  143.       end if
  144.     end repeat
  145.     repeat with akes = 1 to tableau.count
  146.       if tableau[akes].cards.count = 0 then
  147.         if getValue(sprite(shit).member.name) = 13 then
  148.           abort()
  149.         end if
  150.         next repeat
  151.       end if
  152.       cakes = tableau[akes].cards[tableau[akes].cards.count].spnum
  153.       if (getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) - 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(cakes).member.name)) then
  154.         abort()
  155.       end if
  156.     end repeat
  157.   end repeat
  158.   win = "no"
  159.   pootimer = timeout("poo").new(130, #gotoit)
  160. end
  161.  
  162. on gotoit
  163.   pootimer.forget()
  164.   go("gameover")
  165. end
  166.  
  167. on getValue arg
  168.   if (arg contains "hearts") or (arg contains "spades") then
  169.     return getOff(chars(arg, 1, arg.length - 7))
  170.   else
  171.     if arg contains "diamonds" then
  172.       return getOff(chars(arg, 1, arg.length - 9))
  173.     else
  174.       if arg contains "clubs" then
  175.         return getOff(chars(arg, 1, arg.length - 6))
  176.       end if
  177.     end if
  178.   end if
  179. end
  180.  
  181. on getOff numba
  182.   if numba = "ace" then
  183.     return 1
  184.   else
  185.     if numba = "two" then
  186.       return 2
  187.     else
  188.       if numba = "three" then
  189.         return 3
  190.       else
  191.         if numba = "four" then
  192.           return 4
  193.         else
  194.           if numba = "five" then
  195.             return 5
  196.           else
  197.             if numba = "six" then
  198.               return 6
  199.             else
  200.               if numba = "seven" then
  201.                 return 7
  202.               else
  203.                 if numba = "eight" then
  204.                   return 8
  205.                 else
  206.                   if numba = "nine" then
  207.                     return 9
  208.                   else
  209.                     if numba = "ten" then
  210.                       return 10
  211.                     else
  212.                       if numba = "jack" then
  213.                         return 11
  214.                       else
  215.                         if numba = "queen" then
  216.                           return 12
  217.                         else
  218.                           if numba = "king" then
  219.                             return 13
  220.                           end if
  221.                         end if
  222.                       end if
  223.                     end if
  224.                   end if
  225.                 end if
  226.               end if
  227.             end if
  228.           end if
  229.         end if
  230.       end if
  231.     end if
  232.   end if
  233. end
  234.  
  235. on getSuit arg
  236.   if arg contains "hearts" then
  237.     return #hearts
  238.   else
  239.     if arg contains "diamonds" then
  240.       return #diamonds
  241.     else
  242.       if arg contains "clubs" then
  243.         return #clubs
  244.       else
  245.         if arg contains "spades" then
  246.           return #spades
  247.         end if
  248.       end if
  249.     end if
  250.   end if
  251. end
  252.