• Welcome to The Desert Colossus.
 

News:

Welcome to the Desert!  Register, post, and have fun.  Why not introduce yourself in the
Welcome Thread?

Main Menu

Escape This Topic With Slenderman

Started by Darth Wyndisis, September 21, 2008, 05:57:51 PM

Previous topic - Next topic

What do you think it will take to kill this topic?

Nukes
7 (13.5%)
Chuck Norris
12 (23.1%)
Orange Glow
4 (7.7%)
AIDS
7 (13.5%)
The Master Sword
7 (13.5%)
Dr. House
7 (13.5%)
Someone with a power level >9000
13 (25%)
A really, really boring person.
3 (5.8%)
Tara Gilesbie
1 (1.9%)
WTF???
3 (5.8%)
This thread will never die.
8 (15.4%)
darth windisiisis is a col guy and eh doesnt afraid of anything
10 (19.2%)
Tacheon
7 (13.5%)
An unnecessary poll
5 (9.6%)
Yo Gabba Gabba!
6 (11.5%)
Sham-Wow!
11 (21.2%)

Total Members Voted: 52

DW

yo dawg, that shizzle is wack.
­

Darth Wyndisis

YO DAWG I HERD U LIKE SHIZZLE SO WE PUT A SHIZZLE IN YO SHIZZLE SO YOU CAN FIZZLE WHILE U FIZZLE


MagmarFire

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <ctime>
using namespace std;

//Function prototypes
int hitchanceHUM();
int hitchanceCPU();
int CPUmove();
int attack_damageHUM();
int magic_damageHUM();
int attack_damageCPU();
int magic_damageCPU();
void CPUresponse(int);

int HPcheck();
void HUD();

int HP = 30, enHP = 25, ATT = 7, DEF = 4, MAG = 9, enATT = 8, enDEF = 3, enMAG = 6;
unsigned int hitrate, DAMAGE;

int main()
{
cout << "It's time for battle! Choose your move:\n" << endl;

while (HP > 0 && enHP > 0)
{
cout << "\n1.) Attack \n2.) Magic\n" << endl;
int choice;
cin >> choice;

switch(choice)
{
case 1:
hitrate = hitchanceHUM();
if (hitrate > 40)
{
cout << "The attack hits!" << endl << endl;
DAMAGE = attack_damageHUM();
cout << "Damage done to enemy: " << DAMAGE << endl;
enHP -= DAMAGE;

choice = CPUmove();
CPUresponse(choice);
HUD();
HPcheck();
break;
}
else
{
cout << "The attack misses!" << endl << endl;
choice = CPUmove();
CPUresponse(choice);
HUD();
HPcheck();
break;
}
case 2:
hitrate = hitchanceHUM();
if (hitrate > 20)
{
cout << "The attack hits!" << endl << endl;
DAMAGE = magic_damageHUM();
cout << "Damage done to enemy: " << DAMAGE << endl;
enHP -= DAMAGE;

choice = CPUmove();
CPUresponse(choice);
HUD();
HPcheck();
break;
}
else
{
cout << "The attack misses!" << endl << endl;

choice = CPUmove();
HUD();
HPcheck();
break;
}
}
}
}

//Determines whether or not the player succeeds in landing an attack.
int hitchanceHUM()
{
double hit, SEED = time(0);
srand(SEED);
hit = rand() % 100 + HP - enHP;
return hit;
}

// Determines whether or not the computer succeeds in landing an attack.
int hitchanceCPU()
{
double hit, SEED = time(0);
srand(SEED);
hit = rand() % 100 + enHP - HP;
return hit;
}

// Calculates the amount of damage done for a player's standard attack.
int attack_damageHUM()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (rand() % 3 + .5 * HP + ATT) - (enHP + 1) / 5 * enDEF;
return DAMAGE;
}

// Calculates the amount of damage done for the computer's standard attack.
int attack_damageCPU()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (rand() % 3 + .5 * enHP + enATT) - (HP + 1) / DEF;

return DAMAGE;
}
// Determines the computer's move type: attack or magic.
int CPUmove()
{
int choice, SEED = time(0);
srand(SEED);

choice = rand() % 2;

return choice;
}
// Checks if either the player or the enemy has zero HP left.
int HPcheck()
{
if (HP <= 0)
{
cout << "You have been defeated... Game over, Colonel." << endl;
return 0;
}
else if (enHP <= 0)
{
cout << "You have defeated the enemy!" << endl;
return 0;
}
}
// Displays both human and computer HP at the end of a phase.
void HUD()
{
cout << "Current HP: " << HP << endl;
cout << "Enemy HP: " << enHP << endl;
}
// A summation of what the computer does whenever the player makes a move.

void CPUresponse(int choice)
{
switch (choice)
{
case 0:
cout << "The computer chose to attack." << endl << endl;
cin.get();

hitrate = hitchanceCPU();
if (hitrate > 35)
{
cout << "The attack hits!" << endl;
DAMAGE = attack_damageCPU();
cout << "Damage done to you: " << DAMAGE << endl;
HP -= DAMAGE;
}
else
{
cout << "The attack misses!" << endl;
cout << endl;
}
break;
case 1:
cout << "The computer chose to use magic." << endl << endl;

hitrate = hitchanceCPU();
if (hitrate > 15)
{
cout << "The attack hits!" << endl;
DAMAGE = magic_damageCPU();
cout << "Damage inflicted on you: " << DAMAGE << endl;
HP -= DAMAGE;
}
else
{
cout << "The attack misses!" << endl;
}
break;
}
}
// Functions calculate damage dealt from magic.
int magic_damageHUM()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (MAG + (rand() % 3) / 3) - (1 + enDEF * (rand() % 3));

if (DAMAGE < 0)
{
DAMAGE = 0;
return DAMAGE;
}
return DAMAGE;
}

int magic_damageCPU()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (enMAG + (rand() % 3 / 3)) - (1 + DEF * (rand() % 3));

if (DAMAGE < 0)
{
DAMAGE = 0;
return DAMAGE;
}
return DAMAGE;
}


More C++ to explode your brain! :D



Advanceshipping and Rion had better be Chuck Norris approved.

cacturnerules


Keaton

Quote from: MagmarFire on December 30, 2008, 04:14:58 PM
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <ctime>
using namespace std;

//Function prototypes
int hitchanceHUM();
int hitchanceCPU();
int CPUmove();
int attack_damageHUM();
int magic_damageHUM();
int attack_damageCPU();
int magic_damageCPU();
void CPUresponse(int);

int HPcheck();
void HUD();

int HP = 30, enHP = 25, ATT = 7, DEF = 4, MAG = 9, enATT = 8, enDEF = 3, enMAG = 6;
unsigned int hitrate, DAMAGE;

int main()
{
cout << "It's time for battle! Choose your move:\n" << endl;

while (HP > 0 && enHP > 0)
{
cout << "\n1.) Attack \n2.) Magic\n" << endl;
int choice;
cin >> choice;

switch(choice)
{
case 1:
hitrate = hitchanceHUM();
if (hitrate > 40)
{
cout << "The attack hits!" << endl << endl;
DAMAGE = attack_damageHUM();
cout << "Damage done to enemy: " << DAMAGE << endl;
enHP -= DAMAGE;

choice = CPUmove();
CPUresponse(choice);
HUD();
HPcheck();
break;
}
else
{
cout << "The attack misses!" << endl << endl;
choice = CPUmove();
CPUresponse(choice);
HUD();
HPcheck();
break;
}
case 2:
hitrate = hitchanceHUM();
if (hitrate > 20)
{
cout << "The attack hits!" << endl << endl;
DAMAGE = magic_damageHUM();
cout << "Damage done to enemy: " << DAMAGE << endl;
enHP -= DAMAGE;

choice = CPUmove();
CPUresponse(choice);
HUD();
HPcheck();
break;
}
else
{
cout << "The attack misses!" << endl << endl;

choice = CPUmove();
HUD();
HPcheck();
break;
}
}
}
}

//Determines whether or not the player succeeds in landing an attack.
int hitchanceHUM()
{
double hit, SEED = time(0);
srand(SEED);
hit = rand() % 100 + HP - enHP;
return hit;
}

// Determines whether or not the computer succeeds in landing an attack.
int hitchanceCPU()
{
double hit, SEED = time(0);
srand(SEED);
hit = rand() % 100 + enHP - HP;
return hit;
}

// Calculates the amount of damage done for a player's standard attack.
int attack_damageHUM()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (rand() % 3 + .5 * HP + ATT) - (enHP + 1) / 5 * enDEF;
return DAMAGE;
}

// Calculates the amount of damage done for the computer's standard attack.
int attack_damageCPU()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (rand() % 3 + .5 * enHP + enATT) - (HP + 1) / DEF;

return DAMAGE;
}
// Determines the computer's move type: attack or magic.
int CPUmove()
{
int choice, SEED = time(0);
srand(SEED);

choice = rand() % 2;

return choice;
}
// Checks if either the player or the enemy has zero HP left.
int HPcheck()
{
if (HP <= 0)
{
cout << "You have been defeated... Game over, Colonel." << endl;
return 0;
}
else if (enHP <= 0)
{
cout << "You have defeated the enemy!" << endl;
return 0;
}
}
// Displays both human and computer HP at the end of a phase.
void HUD()
{
cout << "Current HP: " << HP << endl;
cout << "Enemy HP: " << enHP << endl;
}
// A summation of what the computer does whenever the player makes a move.

void CPUresponse(int choice)
{
switch (choice)
{
case 0:
cout << "The computer chose to attack." << endl << endl;
cin.get();

hitrate = hitchanceCPU();
if (hitrate > 35)
{
cout << "The attack hits!" << endl;
DAMAGE = attack_damageCPU();
cout << "Damage done to you: " << DAMAGE << endl;
HP -= DAMAGE;
}
else
{
cout << "The attack misses!" << endl;
cout << endl;
}
break;
case 1:
cout << "The computer chose to use magic." << endl << endl;

hitrate = hitchanceCPU();
if (hitrate > 15)
{
cout << "The attack hits!" << endl;
DAMAGE = magic_damageCPU();
cout << "Damage inflicted on you: " << DAMAGE << endl;
HP -= DAMAGE;
}
else
{
cout << "The attack misses!" << endl;
}
break;
}
}
// Functions calculate damage dealt from magic.
int magic_damageHUM()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (MAG + (rand() % 3) / 3) - (1 + enDEF * (rand() % 3));

if (DAMAGE < 0)
{
DAMAGE = 0;
return DAMAGE;
}
return DAMAGE;
}

int magic_damageCPU()
{
int DAMAGE, SEED = time(0);
srand(SEED);

DAMAGE = (enMAG + (rand() % 3 / 3)) - (1 + DEF * (rand() % 3));

if (DAMAGE < 0)
{
DAMAGE = 0;
return DAMAGE;
}
return DAMAGE;
}


More C++ to explode your brain! :D

Impressive, did you write that?  I can't see any errors there.

MagmarFire

Yep, I wrote it! Took me a while, too. XD

So you know C++, too, Tacheon? Awesome! ^_^



Advanceshipping and Rion had better be Chuck Norris approved.

cacturnerules

Quote from: FishyRules on September 03, 2008, 10:55:50 PM
notice how all of us are watching the boards

waiting for someone to post

so you can post

but they don't

so you can't

it's a never-ending cycle of nothing...

*sigh* It brings pain to my heart to see 7 people on for an hour and there were only 5 posts...

Hi no Seijin

I am being distracted by Wikipedia.  And Family Guy.
Best.  Cane.  EVER!
Secretary of Lolcats; I won the MagmarFire Award for 2/21/08!
Filler.Filler.Filler.Fillah!  Filler.Filler.Filler.Fillah!

Twilight Wolf

Well, FR, times like that are when I post in a bunch of Chatboard topics.
What, you expect me to say something witty?

cacturnerules


Hi no Seijin

As Secretary of Lolcats, I have to confiscate that picture.
Best.  Cane.  EVER!
Secretary of Lolcats; I won the MagmarFire Award for 2/21/08!
Filler.Filler.Filler.Fillah!  Filler.Filler.Filler.Fillah!

Twilight Wolf

Also, "poker cat," I'm not bluffing. I'm telling the whole truth here.
What, you expect me to say something witty?

The Glamour Nazi

JUS LETZ IT DIE!!!!!!1111one

Hi no Seijin

Best.  Cane.  EVER!
Secretary of Lolcats; I won the MagmarFire Award for 2/21/08!
Filler.Filler.Filler.Fillah!  Filler.Filler.Filler.Fillah!