Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
selvamop committed Mar 21, 2019
1 parent 5da1fc3 commit 8f3df44f1798d4208862dcb7f7139eaaa98a97c7
Show file tree
Hide file tree
Showing 24 changed files with 11,045 additions and 0 deletions.
@@ -0,0 +1,35 @@
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "PlayerClass.h"
using namespace std;

class Enemy: public player {
public:
int health;
int strength;
int buff;

Enemy(int starthealth = 50, int startstrength = 50, int startbuff = 0) {
health = starthealth;
strength = startstrength;
buff = startbuff; //should start at 0 for no buffs active, CREATE NEW FILE :: if statements for buffs based on value of BUFF and will run at the end of all encounters to update the game
}

};

int main() {
srand( time( NULL ) );
int extra_health = rand()%10;
cout << extra_health << endl;
int extra_strength = rand()%10;
cout << extra_strength << endl;
Enemy test;
test.health = test.health + extra_health;
cout << test.health << endl;
test.strength = test.strength + extra_strength;
cout << test.strength << endl;
return 0;
}

//This can be remade for different enemies by changing the base stats for each enemy
@@ -0,0 +1,39 @@
#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;
};
@@ -0,0 +1,20 @@
#include <iostream>
#include "PlayerClass.h"

//medium health
//medium strength

class Hunter: public player {
public:
int health;
int strength;
int buff;

Mage(int starthealth = 100, int startstrength = 100, int startMP = 100) {
health = starthealth;
strength = startstrength;
MP = startMP;
}
};


@@ -0,0 +1,22 @@
#include <iostream>
#include "PlayerClass.h"
using namespace std;

//high health
//low strength

class Mage: public player {
public:
int health;
int strength;
int buff;

Mage(int starthealth = 100, int startstrength = 50, int startMP = 150) {
health = starthealth;
strength = startstrength;
MP = startMP; //should start at 0 for no buffs active, CREATE NEW FILE :: if statements for buffs based on value of BUFF and will run at the end of all encounters to update the game
}

};


@@ -0,0 +1,17 @@
#include <iostream>
using namespace std;

class player { // base class
public:
int health;
int attack;
int MP; // buff is an integer to be used like , 1=+strength, 2 = +health, etc. so less error than usin whole strings cuz less can go wrong

player(int starthealth = 100, int startattack = 100, int startMP = 0) {
health = starthealth;
attack = startattack;
MP = startMP; //should start at 0 for no buffs active, CREATE NEW FILE :: if statements for buffs based on value of BUFF and will run at the end of all encounters to update the game
}


};
@@ -0,0 +1,132 @@
#include <iostream>
#include <string>
#include "Enemy_Turn.h"
using namespace std;
//get stats from database
//include Turn_Calculator.h

int three() {
sqlite3* DB;
char* messaggeError;
sqlite3_open("gameDatabase", &DB);
string turnsql("SELECT TURN FROM PLAYER WHERE ID='p001'");
int turn =sqlite3_exec(DB, turnsql.c_str(), NULL, 0, &messaggeError);
cout << turn << endl;
if ((turn % 2) != 0) {
four();
};
string healthsql("SELECT HEALTH FROM PLAYER WHERE ID='p001'");
int health = sqlite3_exec(DB, healthsql.c_str(), NULL, 0, &messaggeError);
cout << health << endl;
string attacksql("SELECT ATTACK FROM PLAYER WHERE ID='p001'");
int attack = sqlite3_exec(DB, attacksql.c_str(), NULL, 0, &messaggeError);
cout << attack << endl;
string MPsql("SELECT MP FROM PLAYER WHERE ID='p001'");
int MP = sqlite3_exec(DB, MPsql.c_str(), NULL, 0, &messaggeError);
string enemyhealthsql("SELECT HEALTH FROM ENEMY");
int enemy_health = sqlite3_exec(DB, enemyhealthsql.c_str(), NULL, 0, &messaggeError);
string enemyattacksql("SELECT ATTACK FROM ENEMY");
int enemy_attack = sqlite3_exec(DB, healthsql.c_str(), NULL, 0, &messaggeError);
cout << MP << endl;
string choice;
string spell_choice;
string heal_choice;
string damage_choice;
string weaken_choice;
cout << "What would you like to do?" << endl;
cin >> choice;
transform(choice.begin(), choice.end(), choice.begin(), ::tolower);
if (choice == "attack") {
enemy_health = enemy_health - attack;
string updateenemyhealthsql("UPDATE ENEMY SET HEALTH = enemy_health");
sqlite3_exec(DB, updateenemyhealthsql.c_str(), NULL, 0, &messaggeError);
cout << "Enemy health is now " << enemy_health << endl;
}
else if (choice == "spells") {
cout << "What spell would you like to use!" << endl;
cout << "Heal" << endl;
cout << "Attack Up" << endl;
cout << "Enemy_Damage_Spell" << endl;
cout << "Enemy_Weaken_Spell" << endl;
cin >> spell_choice;
transform(spell_choice.begin(), spell_choice.end(), spell_choice.begin(), ::tolower);
if (spell_choice == "heal") {
cout << "Current MP left = " << MP << endl;
cout << "How much Health do you want to restore?" << endl;
int heal_choice;
cin >> heal_choice;
if ((MP - heal_choice) <= 0) {
cout << "You do not have enough MP" << endl;
three();
}
else {
health = health + heal_choice;
string updatehealthsql("UPDATE PLAYER SET HEALTH = health WHERE ID='p001'");
sqlite3_exec(DB, updatehealthsql.c_str(), NULL, 0, &messaggeError);
MP = MP - heal_choice;
string updateMPsql("UPDATE PLAYER SET MP = MP WHERE ID='p001'");
sqlite3_exec(DB, updateMPsql.c_str(), NULL, 0, &messaggeError);
cout << "Current MP left = " << MP << endl;
}
}
else if (spell_choice == "attack Up") {
cout << "Current MP left = " << MP << endl;
if ((MP - 10) <= 0) {
cout << "You do not have enough MP" << endl;
three();
}
else {
attack = (attack + 10);
MP = (MP -10);
cout << "Current MP left = " << MP << endl;
}

}
else if (spell_choice == "enemy_damage_spell") {
cout << "Current MP left = " << MP << endl;
cout << "How much Damage do you want to inflict?" << endl;
int damage_choice;
cin >> damage_choice;
if ((MP - damage_choice) <= 0) {
cout << "You do not have enough MP" << endl;
three();
}
else {
enemy_health = (enemy_health - damage_choice);
MP = (MP - damage_choice);
cout << "Current MP left = " << MP << endl;
}
}
else if (spell_choice == "enemy_weaken_spell") {
cout << "Current MP left = " << MP << endl;
cout << "How much do you want to decrease the enemy attack by?" << endl;
int weaken_choice;
cin >> weaken_choice;
if ((MP - weaken_choice) <= 0) {
cout << "You do not have enough MP" << endl;
three();
}
else {
enemy_attack = (enemy_attack - weaken_choice);
cout << "Current MP left = " << MP << endl;
}
}
}
//turn = turn+1
if (turn == 1) {
if (enemy_health <= 0) {
five(); //From battle end
}
//function five (BattleEndCheck)
//go to enemyturn function
return 0;

};
return 0;

};

//change the function
//
//turn + 1
//make an if statement here that refers to enemyturn if turn = 1
@@ -0,0 +1,36 @@
### Getting started
There are various things you can do to quickly and efficiently configure your Codio Box to your exact requirements.

### GUI Applications and the Virtual Desktop
The Virtual Desktop allows you auto develop GUI based applications using any programming language. You can install a Virtual Desktop in your Box. You can then start the desktop and view it within the Codio IDE or in a new browser tab.

[Virtual Desktop documentation](https://codio.com/docs/ide/boxes/installsw/gui/)


### Command line access and the Terminal window
All Codio Boxes provide sudo level privileges to the underlying Ubuntu server. This means you can install and configure any component you like. You access the terminal from the **Tools->Terminal** menu item.

### Debugger
The Codio IDE comes with a powerful visual debugger. Currently we support Python, Java, C, C++ and NodeJS. Other languages can be added on request.

[Debugger documentation](https://codio.com/docs/ide/features/debugging/)


### Content authoring and assessments
Codio comes with a very powerful content authoring tool, Codio Guides. Guides is also where you create all forms of auto-graded assessments.

- [Guides documentation](https://codio.com/docs/content/authoring/overview/)
- [Assessments documentation](https://codio.com/docs/content/authoring/assessments/)

### Templating Box configurations and projects
Codio offers two very powerful templating options so you can create new projects from those templates with just a couple of clicks. **Stacks** allow you to create snapshots of the Box’s underlying software configuration. You can then create new projects from a Stack avoiding having to configure anew each time you start a new project. **Starter Packs** allow you to template an entire project, including workspace code.

- [Stacks documentation](https://codio.com/docs/project/stacks/)
- [Starter Packs documentation](https://codio.com/docs/project/packs/)

### Install software
You can always install software onto your Box using the command line. However, Codio offers a shortcut for commonly installed components that can be accessed from the **Tools->Install Software** menu.

We can easily add new items to the Install Software screen, so feel free to submit requests.

[Install Software documentation](https://codio.com/docs/ide/boxes/installsw/box-parts/)

0 comments on commit 8f3df44

Please sign in to comment.