to something where i could use one script, but add some more small codes to
make enemy span into many things (ex. Rat, Bird.. whatever)
thanks for your help
Expand|Select|Wrap|Line Numbers
- int TheEnemiesHealth=5;
- int TheEnemiesMaxHealth=5;
- char HurtEnemy;
- bool HurtTheEnemy ()
- {
- //GetDamageNow();
- Damage=PlayerPower+1+WeaponPower+PoisonPower;
- TheEnemiesHealth=TheEnemiesHealth-Damage;
- }
- bool ResetEnemyHealth ()
- {
- TheEnemiesHealth=TheEnemiesMaxHealth;
- }
- bool FightEnemy ()
- {
- cout<<"You see an enemy and approach it.\n";
- ArmorList();
- while (TheEnemiesHealth >= 1)
- {
- cout<<"\nWhat would you like to do?\n";
- cout<<"1.Use Weapon\n";
- cout<<"2.Use Hands\n";
- cout <<">";
- cin >> HurtEnemy;
- cin.ignore(20,'\n');
- if (HurtEnemy == '1')
- {
- GetWeapons();
- //////////////////////////////////////////////////
- HurtTheEnemy();
- //cout<<"You use your weapon.";
- cout<<"\n\nThe enemy has ";
- cout<<TheEnemiesHealth;
- cout<<" / ";
- cout<<TheEnemiesMaxHealth;
- cout<<" Health";
- }
- if (HurtEnemy == '2')
- {
- HurtTheEnemy();
- cout<<"\nYou use your hands\n";
- HandIsOut();
- cout<<"\n\nThe enemy has ";
- cout<<TheEnemiesHealth;
- cout<<" / ";
- cout<<TheEnemiesMaxHealth;
- cout<<" Health";
- }
- if(TheEnemiesHealth>0)
- {
- EnemyAttackYou();
- }
- }
- if (TheEnemiesHealth < 1)
- {
- cout<<"\nYou killed the enemy\n";
- cout<<"You gained 1 experience point.\nYou now have ";
- Add1Exp();
- GetExp();
- cout<<" experience points.\n";
- cin.get();
- cout<<"You return to Imperial City\n\n";
- ResetEnemyHealth();
- cin.get();
- }
- }
Expand|Select|Wrap|Line Numbers
- bool EnemyAttackYou()
- {
- int MaxEnemyHurtYou= 4;
- srand ( time(NULL) );
- int EnemyHurtYou = rand() % MaxEnemyHurtYou;
- cout<<"\nThe enemy attacks you, subtracting ";
- cout<<EnemyHurtYou;
- cout<<" Health\n";
- PersonsHealth=PersonsHealth-EnemyHurtYou;
- CheckLiving();
- CheckLifeLeft();
- }