Permalink
Cannot retrieve contributors at this time
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?
Old-skool-game/oldschoolgame-full/Enemy_Turn.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (38 sloc)
1.39 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include "battleEnd.h" | |
using namespace std; | |
int four() { | |
sqlite3* DB; | |
char* messaggeError; | |
int exit = sqlite3_open("gameDatabase", &DB); | |
string turnsql("SELECT TURN FROM PLAYER WHERE ID='p001'"); | |
exit = sqlite3_exec(DB, turnsql.c_str(), NULL, 0, &messaggeError); | |
int turn = exit; | |
if ((turn % 2) == 0) { | |
cout << "yw" << endl; | |
//three() | |
}; | |
string enemyhealthsql("SELECT HEALTH FROM ENEMY"); | |
exit = sqlite3_exec(DB, enemyhealthsql.c_str(), NULL, 0, &messaggeError); | |
int enemy_health = exit; //temp, should be gettin from database | |
string enemyattacksql("SELECT ATTACK FROM ENEMY"); | |
exit = sqlite3_exec(DB, enemyattacksql.c_str(), NULL, 0, &messaggeError); | |
int enemy_attack = exit; //also temp ^^^ | |
string healthsql("SELECT HEALTH FROM PLAYER WHERE ID='p001'"); | |
exit = sqlite3_exec(DB, healthsql.c_str(), NULL, 0, &messaggeError); | |
int health = exit; | |
health = health - enemy_attack; //health should be taken from database | |
string updatehealthsql("UPDATE PLAYER SET HEALTH = health"); | |
exit = sqlite3_exec(DB, updatehealthsql.c_str(), NULL, 0, &messaggeError); | |
turn = turn - 1; | |
if (turn == 0) { | |
if (health >= 0) { | |
five(); //Battle end.h | |
} | |
//function five (BattleEndCheck) | |
//go to player turn function | |
return 0; | |
}; | |
return 0; | |
}; |