I'mma bumping this.
Oh, and here's work on a chargen for GURPS:
#include <iostream>
#include <cmath>
using namespace std;
int Chargen (int &nSt, int &nDx, int &nIq, int &nHt);
int CharDisplay (int nSt, int nDx, int nIq, int nHt, int &nBasicLift,
float &fBasicSpeed, int &nHp, int &nWill, int &nPer, int &nFp);
int CharCalc(int nSt, int nDx, int nIq, int nHt, int &nCharPoints, int nOrigPoints);
int TestFight(int nSt, int nDx, int nIq, int nHt, int nBasicLift,
float fBasicSpeed, int nHp, int nWill, int nPer, int nFp);
unsigned int PRNG() //Outputs a number. Use modulus function!
{
static unsigned int nSeed = 5323;
nSeed = ((8253729 * nSeed + 2396403)*(8253729 * nSeed + 2396403 *(8253729 * nSeed + 2396403))/3+1337);
return nSeed;
}
int main(int argc, char *argv[])
{
int nCharPoints = 0;
int nOrigPoints = 0;
//The primary stats.
int nSt = 0;
int nDx = 0;
int nIq = 0;
int nHt = 0;
//The secondary stats.
int nBasicLift = 0;
float fBasicSpeed = 0;
int nHp = 0;
int nWill = 0;
int nPer = 0;
int nFp = 0;
cout << "GURPS 4ed Character Stuff. Testing C++ Code" << endl;
cout << "By LN" << endl;
cout << endl;
cout << "Enter desired amount of character points (Default = 100): ";
cin >> nCharPoints;
nOrigPoints = nCharPoints;
if (nCharPoints == 0)
{
nCharPoints = 100;
nOrigPoints = 100;
}
cout << endl;
do
{
Chargen(nSt, nDx, nIq, nHt);
} while (CharCalc(nSt,nDx, nIq, nHt, nCharPoints, nOrigPoints) == 1);
CharDisplay (nSt, nDx, nIq, nHt, nBasicLift, fBasicSpeed, nHp, nWill, nPer, nFp);
char cAns
/*do
{
cout << "Do you want to test your character in a fistfight?" << endl;
cout << "Y/N" << endl;
cin >> cAns;
if (cAns == 'y')
TestFight(nSt, nDx, nIq, nHt, nBasicLift, fBasicSpeed, nHp, nWill, nPer, nFp);
else
cout << "Too bad." << endl;
}while (nHp > 0)*/
system("PAUSE");
return EXIT_SUCCESS;
}
int Chargen(int &nSt, int &nDx, int &nIq, int &nHt)
{
cout << "Input numbers for char stats." << endl;
cout << endl;
cout << "Strength: ";
cin >> nSt;
cout << endl;
cout << "Dexterity: ";
cin >> nDx;
cout << endl;
cout << "Intelligence: ";
cin >> nIq;
cout << endl;
cout << "Health: ";
cin >> nHt;
cout << endl;
cout << endl;
return 0;
}
int CharDisplay (int nSt, int nDx, int nIq, int nHt, int &nBasicLift,
float &fBasicSpeed, int &nHp, int &nWill, int &nPer, int &nFp)
{
cout << "Your primary stats are: " << endl;
cout << endl;
cout << "Strength: " << nSt << endl;
cout << "Dexterity: " << nDx << endl;
cout << "Intelligence: " << nIq << endl;
cout << "Health: " << nHt << endl;
cout << endl;
cout << "Your secondary stats are: " << endl;
cout << endl;
nBasicLift = (nSt*nSt)/5;
cout << "Basic Lift: " << nBasicLift << endl;
fBasicSpeed = (nHt+nDx)/4;
cout << "Basic Speed: " << fBasicSpeed << endl;
nHp = nHt;
cout << "Hitpoits: " << nHp << endl;
nWill = nIq;
cout << "Will: " << nWill << endl;
nPer = nIq;
cout << "Perception: " << nPer << endl;
nFp = nHt;
cout << "Fatigue Points: " << nFp << endl;
return 0;
}
int CharCalc(int nSt, int nDx, int nIq, int nHt, int &nCharPoints, int nOrigPoints)
{
if (nSt != 10)
nSt = (nSt-10)*10;
if (nDx != 10)
nDx = (nDx-10)*20;
if (nIq != 10)
nIq = (nIq-10)*20;
if (nHt != 10)
nHt = (nHt-10)*10;
nCharPoints = nCharPoints - nSt;
nCharPoints = nCharPoints - nDx;
nCharPoints = nCharPoints - nIq;
nCharPoints = nCharPoints - nHt;
if (nCharPoints < 0)
{
cout << "Number of character points is negative. Please recalculate." << endl << endl;
nCharPoints = nOrigPoints;
return 1;
}
else
return 0;
}
int TestFight(int nSt, int nDx, int nIq, int nHt, int nBasicLift,
float fBasicSpeed, int nHp, int nWill, int nPer, int nFp)
{
int nMonSt = (PRNG() % 15);
int nMonDx = (PRNG() % 15);
int nMonIq = (PRNG() % 15);
int nMonHt = (PRNG() % 15);
int nMonHp = nMonHt;
}
int SwingThrust (int nSt, int nModeDmg) // 1 = Thrust, 0 = Swing!
{
if (nModeDmg == 0)
switch (nSt)
{
case 1: return ((PRNG() % 6)-5);
case 2: return ((PRNG() % 6)-5);
case 3: return ((PRNG() % 6)-4);
case 4: return ((PRNG() % 6)-4);
case 5: return ((PRNG() % 6)-3);
case 6: return ((PRNG() % 6)-3);
case 7: return ((PRNG() % 6)-2);
case 8: return ((PRNG() % 6)-2);
case 9: return ((PRNG() % 6)-1);
case 10: return (PRNG() % 6);
case 11: return ((PRNG() % 6)+1);
case 12: return ((PRNG() % 6)+2);
case 13: return ((PRNG() % 6)+(PRNG() % 6)-1);
case 14: return ((PRNG() % 6)+(PRNG() % 6));
case 15: return ((PRNG() % 6)+(PRNG() % 6)+1);
case 16: return ((PRNG() % 6)+(PRNG() % 6)+2);
case 17: return ((PRNG() % 6)+(PRNG() % 6)+(PRNG() % 6)-1);
case 18: return ((PRNG() % 6)+(PRNG() % 6)+(PRNG() % 6));
case 19: return ((PRNG() % 6)+(PRNG() % 6)+(PRNG() % 6)+1);
case 20: return ((PRNG() % 6)+(PRNG() % 6)+(PRNG() % 6)+2);
default: { if (nSt > 20) return ((PRNG() % 6)+(PRNG() % 6)+(PRNG() % 6)+2);
else cout << "ERROR: Strength (nSt) is zero or negative!";}
};
if (nModeDmg == 1)
switch (nSt)
{
case 1: return ((PRNG() % 6)-6);
case 2: return ((PRNG() % 6)-6);
case 3: return ((PRNG() % 6)-5);
case 4: return ((PRNG() % 6)-5);
case 5: return ((PRNG() % 6)-4);
case 6: return ((PRNG() % 6)-4);
case 7: return ((PRNG() % 6)-3);
case 8: return ((PRNG() % 6)-3);
case 9: return ((PRNG() % 6)-2);
case 10: return ((PRNG() % 6)-2);
case 11: return ((PRNG() % 6)-1);
case 12: return ((PRNG() % 6)-1);
case 13: return (PRNG() % 6);
case 14: return (PRNG() % 6);
case 15: return ((PRNG() % 6)+1);
case 16: return ((PRNG() % 6)+1);
case 17: return ((PRNG() % 6)+2);
case 18: return ((PRNG() % 6)+2);
case 19: return ((PRNG() % 6)+(PRNG() % 6)-1);
case 20: return ((PRNG() % 6)+(PRNG() % 6)-1);
default: { if (nSt > 20) return ((PRNG() % 6)+(PRNG() % 6)-1);
else cout << "ERROR: Strength (nSt) is zero or negative!";}
};
}
Still console based I'm afraid. Might make it into a full fledged game. Use if you want.
Oh, and any idea how to make a text parser for games a la Zork?