Advertisement
Braber01

Life Counter Script

Oct 25th, 2012
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.89 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #A magic The Gathering Life Counter
  4.  
  5. function getPlayers() {
  6.     read -p "How many players are there?" PLAYERS
  7.     case $PLAYERS in
  8.         2)
  9.             select2PlayerFormat;
  10.         ;;
  11.         3)
  12.             select3PlayerFormat;
  13.         ;;
  14.         4)
  15.             select4PlayerFormat;
  16.         ;;
  17.         5)
  18.             select5PlayerFormat;
  19.         ;;
  20.         6)
  21.             select6PlayerFormat;
  22.         ;;
  23.         *)
  24.             NotYetImplementedException;
  25.         ;;
  26.     esac
  27. }
  28.  
  29. select2PlayerFormat() {
  30.     local p1;
  31.     local p2;
  32.     local format;
  33.    
  34.     read -p "Enter Player 1's Name" $p1
  35.     read -p "Enter player 2's Name" $p2
  36.     select $format in 'EDH' 'STD';do
  37.         case $format in
  38.             1)
  39.                 play2PlayerEDH $p1 $p2;
  40.             ;;
  41.             2)
  42.                 play2PlayerSTD $p1 $p2
  43.             ;;
  44.             *)
  45.                 NotAValidFormat $PLAYERS;
  46.             ;;
  47.         esac
  48.     done
  49. }
  50. select3PlayerFormat() {
  51.     local p1;
  52.     local p2;
  53.     local p3;
  54.     local format;
  55.  
  56.     read -p "Enter player 1's Name" $p1;
  57.     read -p "Enter player 2's Name" $p2;
  58.     read -p "Enter player 3's Name" $p3;
  59.    
  60.     select $format in 'EDH' 'STD'; do
  61.         case $format in
  62.             1)
  63.                 play3PlayerEDH $p1 $p2 $p3;
  64.             ;;
  65.             2)
  66.                 play3PlayerSTD $p1 $p2 $p3;
  67.             ;;
  68.             *)
  69.                 NotAValidFormat $PLAYERS;
  70.             ;;
  71.         esac
  72.     done
  73. }
  74.  
  75.  
  76. select4PlayerFormat() {
  77.     local p1;
  78.     local p2;
  79.     local p3;
  80.     local p4;
  81.     local format;
  82.  
  83.     read -p "Enter player 1's name" $p1;
  84.     read -p "Enter player 2's name" $p2;
  85.     read -p "Enter player 3's name" $p3;
  86.     read -p "Enter player 4's name" $p4;
  87.     select $format in 'EDH' 'STD' '2HG' '2v2' ;do
  88.         case $format in
  89.             1)
  90.                 play4playerEDH $p1 $p2 $p3 $p4;
  91.             ;;
  92.             2)
  93.                 play4PlayerSTD $p1 $p2 $p3 $p4;
  94.             ;;
  95.             3)
  96.                 play2HG $p1 $p2 $p3 $p4;
  97.             ;;
  98.             4)
  99.                 play2v2 $p1 $p2 $p3 $p4;
  100.             ;;
  101.             *)
  102.                 NotAValidFormat $PLAYERS;
  103.             ;;
  104.         esac
  105.     done
  106. }
  107. select5PlayerFormat() {
  108.     local p1;
  109.     local p2;
  110.     local p3;
  111.     local p4;
  112.     local p5;
  113.     local format;
  114.  
  115.     read -p "Enter Player 1's Name" $p1;
  116.     read -p "Enter Player 2's Name" $p2;
  117.     read -p "Enter Player 3's Name" $p3;
  118.     read -p "Enter player 4's Name" $p4;
  119.     read -p "Enter player 5's Name" $p5
  120.  
  121.     select $format in 'EDH' 'STD';do
  122.         case $format in
  123.             1)
  124.                 play5PlayerEDH $p1 $p2 $p3 $p4 $p5;
  125.             ;;
  126.             2)
  127.                 play5PlayerSTD $p1 $p2 $p3 $p4 $p5;
  128.             ;;
  129.             *)
  130.                 NotAValidFormat $PLAYERS;
  131.             ;;
  132.         esac
  133.     done
  134. }
  135.  
  136. select6PlayerFormat() {
  137.     local p1;
  138.     local p2;
  139.     local p3;
  140.     local p4;
  141.     local p5;
  142.     local p6;
  143.     local format;
  144.    
  145.     read -p "Enter Player 1's Name" $p1;
  146.     read -p "Enter player 2's name" $p2;
  147.     read -p "Enter player 3's name" $p3;
  148.     read -p "Enter player 4's name" $p4;
  149.     read -p "Enter player 5's name" $p5;
  150.     read -p "Enter player 6's name" $p6;
  151.  
  152.     select $format in 'EDH' 'STD' '3HG' '3v3' 'Emperor';do
  153.         case $format in
  154.             1)
  155.                 play6PlayerEDH $p1 $p2 $p3 $p4 $p5 $p6;
  156.             ;;
  157.             2)
  158.                 play6PlayerSTD $p1 $p2 $p3 $p4 $p5 $p6;
  159.             ;;
  160.             3)
  161.                 play3HG $p1 $p2 $p3 $p4 $p5 $p6;
  162.             ;;
  163.             4)
  164.                 play3v3 $p1 $p2 $p3 $p4 $p5 $p6;
  165.             ;;
  166.             *)
  167.                 NotAValidFormat $PLAYERS;
  168.             ;;
  169.         esac
  170.     done
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement