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

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