Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4007CEM_Monster_Souls/player_methods.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
63 lines (45 sloc)
1.34 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _PL_METH_ | |
#define _PL_METH_ | |
#include <iostream> | |
#include "monsters.h" | |
#include "player.h" | |
#include "player_run.h" | |
#include "player_def.h" | |
#include "weapon_select.h" | |
monsters sample; | |
int player_action(){ | |
//int sample_player_hp; | |
//int sample_monster_hp; | |
char attack_inp; | |
std::cout << "press A to attack, D to defend, R to run away "; | |
std::cin.ignore(); | |
std::cin >> attack_inp; | |
std::cout << attack_inp << std::endl; | |
if(attack_inp == 'r' || attack_inp == 'R') | |
{ | |
player_run(); | |
} | |
else if(attack_inp == 'A'|| attack_inp == 'a') | |
{ | |
while(sample.monster_currentHealth > 0){ | |
int a = rand() % 60 + damage_; | |
sample.monster_currentHealth = sample.monster_currentHealth- a; | |
if(sample.monster_currentHealth <= 0){ | |
std::cout <<"u won"; | |
break; | |
} | |
else | |
{ | |
std::cout<<"monsters current health is " << sample.monster_currentHealth << " after a damage of " << a << std::endl; | |
player_action(); | |
} | |
} | |
} | |
if(attack_inp == 'd' || attack_inp == 'D') | |
{ | |
player_defend(); | |
player_action(); | |
} | |
return 0; | |
} | |
#endif |