Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <iostream>
#include <cstdlib>
#include "Monster.h"
#include "Sql_Qu.h"
using namespace std;
string Data[19];
int x = 0;
int Monster_Gen(int argc, char* argv[], Monster& Mon1, Monster& Mon2, Monster& Mon3)
{
try{
char* sql;
srand(time(NULL));
int Num = 0;
int LastNum = 0;
/////////////////////////Monster Generation///////////////////////////
sql = ((char *)"SELECT Name From MonsterData");
Sql_Qu(argc,argv,sql);
Num = (rand() % 5);
LastNum = Num;
Mon1.MonsterName = Data[Num];
while (LastNum == Num)
{
Num = (rand() % 5);
}
LastNum = Num;
Mon2.MonsterName = Data[Num];
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon3.MonsterName = Data[Num];
LastNum = Num;
sql = ((char *)"SELECT Title From MonsterData");
x = 0;
Sql_Qu(argc,argv,sql);
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon1.MonsterTitle = Data[Num];
LastNum = Num;
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon2.MonsterTitle = Data[Num];
LastNum = Num;
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon3.MonsterTitle = Data[Num];
LastNum = Num;
sql = ((char *)"SELECT Type From MonsterData");
x = 0;
Sql_Qu(argc,argv,sql);
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon1.MonsterType = Data[Num];
LastNum = Num;
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon2.MonsterType = Data[Num];
LastNum = Num;
while (LastNum == Num)
{
Num = (rand() % 5);
}
Mon3.MonsterType = Data[Num];
LastNum = Num;
Mon1.MonsterHP = 10;
Mon1.MonsterAtk = 3;
Mon1.MonsterAc = 12;
Mon2.MonsterHP = 20;
Mon2.MonsterAtk = 4;
Mon2.MonsterAc = 15;
Mon3.MonsterHP = 30;
Mon3.MonsterAtk = 5;
Mon3.MonsterAc = 18;
}
catch (const exception& error)
{
cout << " something went wrong '" << error.what() << endl;
}
}
//Made by Ben inc Database