Skip to content
Permalink
main
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
#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