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

  1. global points, pootimer, win, tableau, crappo, stock
  2.  
  3. on checkwin arg
  4.   if arg <> 0 then
  5.     if tableau[sprite(arg).row].getcardcount() = 13 then
  6.       if (tableau[sprite(arg).row].cards[1].rank = "king") and (tableau[sprite(arg).row].cards[13].rank = "ace") then
  7.         points = points + 100
  8.         repeat with i = 1 to tableau[sprite(arg).row].getcardcount()
  9.           sprite(tableau[sprite(arg).row].cards[i].spnum).member = member("empty", "playing cards")
  10.           updateStage()
  11.         end repeat
  12.         tableau[sprite(arg).row].cards.deleteAll()
  13.         if points = 700 then
  14.           win = "yes"
  15.           pootimer = timeout("poo").new(150, #gotoit)
  16.         end if
  17.       end if
  18.     end if
  19.   else
  20.   end if
  21.   if stock.cards.count = 0 then
  22.     checklose()
  23.   end if
  24. end
  25.  
  26. on checklose
  27.   repeat with shit = 1 to tableau.count()
  28.     if tableau[shit].cards.count = 0 then
  29.       abort()
  30.     end if
  31.     repeat with damm = 1 to tableau.count()
  32.       if shit = damm then
  33.         next repeat
  34.       end if
  35.       if tableau[damm].cards.count = 0 then
  36.         abort()
  37.       end if
  38.       if tableau[shit].cards.count = 0 then
  39.         next repeat
  40.       end if
  41.       if (getValue(sprite(tableau[shit].getlastcard().spnum).member.name) = (getValue(sprite(tableau[damm].getlastcard().spnum).member.name) - 1)) and not getduplicate(tableau[shit].getlastcard().spnum - 1, tableau[damm].getlastcard().spnum) then
  42.         abort()
  43.       end if
  44.     end repeat
  45.   end repeat
  46.   win = "no"
  47.   pootimer = timeout("poo").new(130, #gotoit)
  48. end
  49.  
  50. on gotoit
  51.   pootimer.forget()
  52.   go("gameover")
  53. end
  54.  
  55. on getValue arg
  56.   if (arg contains "hearts") or (arg contains "spades") then
  57.     return getOff(chars(arg, 1, arg.length - 7))
  58.   else
  59.     if arg contains "diamonds" then
  60.       return getOff(chars(arg, 1, arg.length - 9))
  61.     else
  62.       if arg contains "clubs" then
  63.         return getOff(chars(arg, 1, arg.length - 6))
  64.       end if
  65.     end if
  66.   end if
  67. end
  68.  
  69. on getOff numba
  70.   if numba = "ace" then
  71.     return 1
  72.   else
  73.     if numba = "two" then
  74.       return 2
  75.     else
  76.       if numba = "three" then
  77.         return 3
  78.       else
  79.         if numba = "four" then
  80.           return 4
  81.         else
  82.           if numba = "five" then
  83.             return 5
  84.           else
  85.             if numba = "six" then
  86.               return 6
  87.             else
  88.               if numba = "seven" then
  89.                 return 7
  90.               else
  91.                 if numba = "eight" then
  92.                   return 8
  93.                 else
  94.                   if numba = "nine" then
  95.                     return 9
  96.                   else
  97.                     if numba = "ten" then
  98.                       return 10
  99.                     else
  100.                       if numba = "jack" then
  101.                         return 11
  102.                       else
  103.                         if numba = "queen" then
  104.                           return 12
  105.                         else
  106.                           if numba = "king" then
  107.                             return 13
  108.                           end if
  109.                         end if
  110.                       end if
  111.                     end if
  112.                   end if
  113.                 end if
  114.               end if
  115.             end if
  116.           end if
  117.         end if
  118.       end if
  119.     end if
  120.   end if
  121. end
  122.  
  123. on getSuit arg
  124.   if arg contains "hearts" then
  125.     return #hearts
  126.   else
  127.     if arg contains "diamonds" then
  128.       return #diamonds
  129.     else
  130.       if arg contains "clubs" then
  131.         return #clubs
  132.       else
  133.         if arg contains "spades" then
  134.           return #spades
  135.         end if
  136.       end if
  137.     end if
  138.   end if
  139. end
  140.  
  141. on getduplicate arch, argu
  142.   if (sprite(arch).member.name <> "empty") and (sprite(arch).member.name <> "backofcard") then
  143.     if getValue(sprite(arch).member.name) = getValue(sprite(argu).member.name) then
  144.       return 1
  145.     end if
  146.   end if
  147.   return 0
  148. end
  149.