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

  1. global reserve, foundation, waste, pootimer, points, win, stock, basecard
  2.  
  3. on getlist arg
  4.   if (arg >= 20) and (arg <= 24) then
  5.     return reserve[sprite(arg).row].getlastcard()
  6.   else
  7.     if arg = 42 then
  8.       return waste.getlastcard()
  9.     else
  10.       if (arg >= 25) and (arg <= 28) then
  11.         return foundation[sprite(arg).row].getlastcard()
  12.       end if
  13.     end if
  14.   end if
  15. end
  16.  
  17. on checkwin
  18.   if points = (51 * 10) then
  19.     pootimer = timeout("uuu").new(150, #gotoit)
  20.     win = "yes"
  21.   else
  22.     checklose()
  23.   end if
  24. end
  25.  
  26. on checklose
  27.   if stock.cards.count = 0 then
  28.     repeat with shit = 42 to 42
  29.       if sprite(shit).member.name = "empty" then
  30.         next repeat
  31.       end if
  32.       repeat with cakes = 25 to 28
  33.         if sprite(cakes).member.name = "empty" then
  34.           if getValue(sprite(shit).member.name) = getOff(basecard) then
  35.             abort()
  36.           end if
  37.           next repeat
  38.         end if
  39.         if (getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) + 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(cakes).member.name)) then
  40.           abort()
  41.         end if
  42.       end repeat
  43.       repeat with cakes = 20 to 24
  44.         if sprite(cakes).member.name = "empty" then
  45.           next repeat
  46.         end if
  47.         if ((getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) - 1)) or ((sprite(shit).member.name contains "king") and (sprite(cakes).member.name contains "ace"))) and not getduplicate() then
  48.           abort()
  49.         end if
  50.       end repeat
  51.     end repeat
  52.     repeat with shit = 20 to 24
  53.       if sprite(shit).member.name = "empty" then
  54.         next repeat
  55.       end if
  56.       repeat with cakes = 25 to 28
  57.         if sprite(cakes).member.name = "empty" then
  58.           if getValue(sprite(shit).member.name) = getOff(basecard) then
  59.             abort()
  60.           end if
  61.           next repeat
  62.         end if
  63.         if (getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) + 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(cakes).member.name)) then
  64.           abort()
  65.         end if
  66.       end repeat
  67.       repeat with cakes = 20 to 24
  68.         if shit = cakes then
  69.           next repeat
  70.         end if
  71.         if sprite(cakes).member.name = "empty" then
  72.           next repeat
  73.         end if
  74.         if ((getValue(sprite(shit).member.name) = (getValue(sprite(cakes).member.name) - 1)) or ((sprite(shit).member.name contains "king") and (sprite(cakes).member.name contains "ace"))) and not getduplicate() then
  75.           abort()
  76.         end if
  77.       end repeat
  78.     end repeat
  79.     win = "no"
  80.     pootimer = timeout("fucked").new(130, #gotoit)
  81.   end if
  82. end
  83.  
  84. on getValue arg
  85.   if (arg contains "hearts") or (arg contains "spades") then
  86.     return getOff(chars(arg, 1, arg.length - 7))
  87.   else
  88.     if arg contains "diamonds" then
  89.       return getOff(chars(arg, 1, arg.length - 9))
  90.     else
  91.       if arg contains "clubs" then
  92.         return getOff(chars(arg, 1, arg.length - 6))
  93.       end if
  94.     end if
  95.   end if
  96. end
  97.  
  98. on getOff numba
  99.   if numba = "ace" then
  100.     return 1
  101.   else
  102.     if numba = "two" then
  103.       return 2
  104.     else
  105.       if numba = "three" then
  106.         return 3
  107.       else
  108.         if numba = "four" then
  109.           return 4
  110.         else
  111.           if numba = "five" then
  112.             return 5
  113.           else
  114.             if numba = "six" then
  115.               return 6
  116.             else
  117.               if numba = "seven" then
  118.                 return 7
  119.               else
  120.                 if numba = "eight" then
  121.                   return 8
  122.                 else
  123.                   if numba = "nine" then
  124.                     return 9
  125.                   else
  126.                     if numba = "ten" then
  127.                       return 10
  128.                     else
  129.                       if numba = "jack" then
  130.                         return 11
  131.                       else
  132.                         if numba = "queen" then
  133.                           return 12
  134.                         else
  135.                           if numba = "king" then
  136.                             return 13
  137.                           end if
  138.                         end if
  139.                       end if
  140.                     end if
  141.                   end if
  142.                 end if
  143.               end if
  144.             end if
  145.           end if
  146.         end if
  147.       end if
  148.     end if
  149.   end if
  150. end
  151.  
  152. on getSuit arg
  153.   if arg contains "hearts" then
  154.     return #hearts
  155.   else
  156.     if arg contains "diamonds" then
  157.       return #diamonds
  158.     else
  159.       if arg contains "clubs" then
  160.         return #clubs
  161.       else
  162.         if arg contains "spades" then
  163.           return #spades
  164.         end if
  165.       end if
  166.     end if
  167.   end if
  168. end
  169.  
  170. on getSuitCo arg
  171.   if arg contains "hearts" then
  172.     return #red
  173.   else
  174.     if arg contains "diamonds" then
  175.       return #red
  176.     else
  177.       if arg contains "clubs" then
  178.         return #black
  179.       else
  180.         if arg contains "spades" then
  181.           return #black
  182.         end if
  183.       end if
  184.     end if
  185.   end if
  186. end
  187.  
  188. on getduplicate
  189.   ass = 0
  190.   repeat with hell = 1 to reserve.count
  191.     if reserve[hell].cards.count = 0 then
  192.       next repeat
  193.     end if
  194.     repeat with bell = 1 to reserve.count
  195.       if reserve[bell].cards.count = 0 then
  196.         next repeat
  197.       end if
  198.       if reserve[bell].cards.count >= 2 then
  199.         if reserve[hell].getlastcard().rank = reserve[bell].cards[reserve[bell].cards.count - 1].rank then
  200.           ass = 1
  201.           exit repeat
  202.         end if
  203.       end if
  204.     end repeat
  205.     if ass = 1 then
  206.       exit repeat
  207.     end if
  208.   end repeat
  209.   if ass = 1 then
  210.     return 1
  211.   else
  212.     return 0
  213.   end if
  214. end
  215.  
  216. on gotoit
  217.   pootimer.forget()
  218.   go("gameover")
  219. end
  220.