Advertisement
Guest User

Fight Cave Spawn Predictor v1.3.3

a guest
Nov 30th, 2016
2,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 4.86 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. //Done by IGN:FwostyMage
  5.  
  6. int printspawn (int wave) {
  7.   if (wave >= 31) { printf("360 "); return wave-31; }
  8.   if (wave >= 15) { printf("180 "); return wave-15; }
  9.   if (wave >= 7) { printf("90 "); return wave-7; }
  10.   if (wave >= 3) { printf("45 "); return wave-3; }
  11.   printf("22 ");
  12.   return wave-1;
  13. }
  14.  
  15. void getspawn (int loc) {
  16.   int spawnarr[15] = {3, 5, 2, 1, 5, 3, 4, 1, 2, 3, 5, 4, 1, 2, 4};
  17.   int sval = spawnarr[loc];
  18.   if (sval == 1) printf("NW, ");
  19.   if (sval == 2) printf("C, ");
  20.   if (sval == 3) printf("SE, ");
  21.   if (sval == 4) printf("S, ");
  22.   if (sval == 5) printf("SW, ");
  23.   return;
  24. }
  25.  
  26. void jadspawn (int start) {
  27.   int i=1;
  28.   printf("JAD ");
  29.   getspawn(start);
  30.   printf("Healers: ");
  31.   while (i<5) {
  32.     getspawn((start+i)%15);
  33.     i++;
  34.   }
  35.   printf("\n");
  36.   return;
  37. }
  38.  
  39. void printwave (int start, int wave) {
  40.   int i = 0;
  41.   int curwave = wave;
  42.   printf("Wave %d: ", wave);
  43.   if (curwave == 63) {
  44.     jadspawn((start)%15);
  45.     return;
  46.   }
  47.   while (curwave > 0) {
  48.     curwave = printspawn(curwave);
  49.     getspawn((start+i)%15);
  50.     i++;
  51.   }
  52.   printf("\n");
  53.   return;
  54. }
  55.  
  56. int spawn2int(char spn[3]) {
  57.   if (strcmp(spn,"NW")==0) return 1;
  58.   if (strcmp(spn,"N")==0) return 1;
  59.   if (strcmp(spn,"C")==0) return 2;
  60.   if (strcmp(spn,"SE")==0) return 3;
  61.   if (strcmp(spn,"E")==0) return 3;
  62.   if (strcmp(spn,"S")==0) return 4;
  63.   if (strcmp(spn,"SW")==0) return 5;
  64.   if (strcmp(spn,"W")==0) return 5;
  65.   printf("Return a valid format please! \n");
  66.   return -1;
  67. }
  68.  
  69. /*
  70. int spawnarr2start (int spawnarr[4]) {
  71.   int spawns[15] = {3, 5, 2, 1, 5, 3, 4, 1, 2, 3, 5, 4, 1, 2, 4};
  72.   int i = 0, j, k;
  73.   while (i < 15) {
  74.     j = 0, k = 0;
  75.     while ((j < 4) && (k == 0)) {
  76.       if (spawns[(i+j)%15] != spawnarr[j]) k=1;
  77.       j++;
  78.     }
  79.     if (k == 0) return i;
  80.     i++;
  81.   }
  82.   printf("Spawns aren't accurate! \n");
  83.   return -1;
  84. }
  85. */
  86.  
  87. int getstart () {
  88.   char s1[3];
  89.   int c1=-1;
  90.   int* c2 = malloc(sizeof(int));
  91.   *c2=-1;
  92.   printf("Enter center as C, south as S, \n");
  93.   printf("northwest as NW or N, southwest as SW or W, \n");
  94.   printf("and southeast as SE or E. First 22 spawn?");
  95.   scanf("%s",s1);
  96.   c1=spawn2int(s1);
  97.   switch (c1) {
  98.   case 1 : //nw
  99.     printf("Where did the next 22s spawn? \n");
  100.     printf("If SW and SE, type 1 \n");
  101.     printf("If C and SE, type 2 \n");
  102.     printf("If C and S, type 3");
  103.     scanf("%d",c2);
  104.     switch(*c2) {
  105.     case 1:
  106.       return 3;
  107.       break;
  108.     case 2:
  109.       return 7;
  110.       break;
  111.     case 3:
  112.       return 12;
  113.       break;
  114.     default :
  115.       return -1;
  116.     }
  117.   case 2 : //center
  118.     printf("Where did the next 22s spawn? \n");
  119.     printf("If NW and SW, type 1 \n");
  120.     printf("If SE and SW, type 2 \n");
  121.     printf("If S and SE, type 3");
  122.     scanf("%d",c2);
  123.     switch(*c2) {
  124.     case 1:
  125.       return 2;
  126.       break;
  127.     case 2:
  128.       return 8;
  129.       break;
  130.     case 3:
  131.       return 13;
  132.       break;
  133.     default :
  134.       return -1;
  135.     }
  136.   case 3 : //se
  137.     printf("Where did the next 22s spawn? \n");
  138.     printf("If SW and C, type 1 \n");
  139.     printf("If S and NW, type 2 \n");
  140.     printf("If SW and S, type 3");
  141.     scanf("%d",c2);
  142.     switch(*c2) {
  143.     case 1:
  144.       return 0;
  145.       break;
  146.     case 2:
  147.       return 5;
  148.       break;
  149.     case 3:
  150.       return 9;
  151.       break;
  152.     default :
  153.       return -1;
  154.     }
  155.   case 4 : //south
  156.     printf("Where did the next 22s spawn? \n");
  157.     printf("If SE and SW, type 1 \n");
  158.     printf("If NW and C, type 2");
  159.     scanf("%d",c2);
  160.     switch(*c2) {
  161.     case 1:
  162.       return 14;
  163.       break;
  164.     case 2:
  165.       *c2=-1;
  166.       printf("The first 45 should spawn center. \n");
  167.       printf("Type 1 if the second 45 spawned SE and 2 if it spawned S.");
  168.       scanf("%d",c2);
  169.       switch(*c2) {
  170.       case 1 :
  171.         return 6;
  172.       case 2 :
  173.         return 11;
  174.       default :
  175.         return -1;
  176.       }
  177.       break;
  178.     default :
  179.       return -1;
  180.     }
  181.   case 5 : //sw
  182.     printf("Where did the next 22s spawn? \n");
  183.     printf("If C and NW, type 1 \n");
  184.     printf("If SE and S, type 2 \n");
  185.     printf("If S and NW, type 3");
  186.     scanf("%d",c2);
  187.     switch(*c2) {
  188.     case 1:
  189.       return 1;
  190.       break;
  191.     case 2:
  192.       return 4;
  193.       break;
  194.     case 3:
  195.       return 10;
  196.       break;
  197.     default :
  198.       return -1;
  199.     }
  200.   default :
  201.     return -1;
  202.   }
  203. }
  204.  
  205. int main () {
  206.   int wave = 4, start = -1;
  207.   char s1[3];
  208.   int i=0,j;
  209.   start=getstart();
  210.   printf("\n");
  211.   if (start == -1) { return -1; }
  212.   if ((start!=6)&&(start!=11)) { printwave(start+2,3); }
  213.   start=start+3;
  214.   getchar();
  215.   while (i < 6) {
  216.     j=0;
  217.     while (j < 10) {
  218.       printwave(start,wave);
  219.       wave++;
  220.       start++;
  221.       j++;
  222.     }
  223.     if (i==5) return 0;
  224.     printf("Press ENTER to print more waves.\n");
  225.     getchar();
  226.     i++;
  227.   }
  228.   return 0;
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement