Why does this Constructor/Class not call right.

Hello World! I have a question for all if you insightful fellows.

I'm working on a small text based rpg, to help me cement a lot of C++ skills. I created a Battle class to deal with all the battles the pc will face in a uniform way(in previous attempts I did combat as a bunch of separate while loops and it got redundant.)
Half way through writing the loop, I decided to plug a bunch of values into the Battle Class to see if my logic and D6 function worked. To my horror nothing happened, I tinkered around and think the constructor in the Battle class isn't setting the values for the rest of object.

Does anyone have a clue how I could fix it?

P.S. I omitted the classes that would normally generate pc's and npc's.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "stdafx.h"
#include <Windows.h>
#include <stdlib.h>
#include <iostream>
#include <time.h>
#include <string>
using namespace std;
class RandomNumbers{
private:
	int rSeed = (time(NULL)) * rand() % 4;
public:
	int getRandomStat(){
		int x;
		rSeed = rSeed + (((time(NULL)) / 2)*3);
		srand(rSeed);
		x = rand() % 10 + 8;
		return x;
	}
	int rollD6(){
		int x;
		rSeed++;
		x = rand() % 6 + 1;
		return x;
	}
};
class Battle: public RandomNumbers{
	
	bool battle = true, win = false, lose = false;
	string pName, pWeapon, pWepStatus;
	int pstr, pdex, pint, pchr, pHealth;
	//to import player data
	string eName, eWeapon;
	int estr, edex, eint, echr, eHealth;
	//to import enemy data
public:
	Battle(string pname, string pweapon, string pwepStatus, int pStr, int pDex, int pInt, int pChr, int phealth,
		string ename, string eweapon, int eStr, int eDex, int eInt, int eChr, int ehealth){
		//1st line is importing player stats, 2nd line is importning enemy stats
		pname = pName; pweapon = pWeapon; pwepStatus = pWepStatus; pStr = pstr; pDex = pdex; pInt = pint; pChr = pchr; phealth = pHealth;
		ename = eName; eweapon = eWeapon; eStr = estr; eDex = edex; eInt = eint; eChr = echr; ehealth = eHealth;
		//1st line is player stats being set in the battle class. the 2nd line is the enemy. The stats are pulled from their classes
	}
	void battleLogic(){
		bool firstRound = true;
		while (battle == true && pHealth >= 1 && eHealth >= 1){
			if (firstRound == true){
					cout << "The " << eName << " puts up it's guard!";
					if (pHealth >= eHealth){ cout << "You think you can take the " << eName << ". \n"; }
					else{cout << "The " << eName << " looks tough." << endl;} //flavor text
					cout << "You ready your " << pWepStatus << " " << pWeapon << "." << endl;
				if (pdex >= edex){
					cout << "You're faster than the " << eName << "!" << endl;
					cout << "The " << eName << "had " << eHealth << ": HP" << endl;
					eHealth = eHealth - ((pstr / 6) + rollD6());
					cout << "The " << eName << "has " << eHealth << ": HP" << endl;
				}
				if (pdex < edex){
					cout << "The " << eName << "is faster than you!" << endl;
					cout << pName << "had " << pHealth << ": HP" << endl;
					pHealth = pHealth - ((estr / 6) + rollD6());
					cout << pName << "has " << eHealth << ": HP" << endl;
				}
				firstRound = false;
			}//end of first round check
		battle = false; }//end of while loop
	}
};
RandomNumbers ranNum;
int main()
{
	Battle battle("test", "sword", "", 18, 18, 18, 18, 26, "Kobold", "sword", 10, 10, 10 , 10, 10);
	battle.battleLogic();
	system("PAUSE");
	return 0;
}

It's worth noting that if you replace
while (battle == true && pHealth >= 1 && eHealth >= 1)
with
while (battle == true)
it runs the first branch of battleLogic. The problem is none of the string or int values are passed from the constructor to the class. Why is this happening?
In the constructor, it should be pName = pname instead of the other way around. To check for mistakes when the variables are too alike, just type this->pName because this->pname would give you a build error.
Dark Goomba, you are a beautiful god child and I shower your family with hundreds of angel kisses. Thanks!
Topic archived. No new replies allowed.