123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #include <iostream>
- #include "personajes.h"
- #include <string>
- #include <random>
- using namespace std;
- Personaje::Personaje(int primer_argumento,int segundo_argumento,int tercer_argumento,int cuarto_argumento,int quinto_argumento){
- balas=primer_argumento;
- balas_dano=segundo_argumento;
- botiquin=tercer_argumento;
- ganzua=cuarto_argumento;
- isBot=quinto_argumento;
- psicosis=1;
- soledad=1;
- esperpento=1;
- hola_dave=1;
- bug=1;
- pistola=0;
- }
- Personaje::~Personaje(){}
- void Personaje::acierto(Personaje& agredido, Personaje& v){
-
- this->balas-=1;
- agredido.vida-=this->balas_dano;
- }
- void Personaje::fallo(Personaje& v){
-
- this->balas-=1;
- }
- void Personaje::disparas(Personaje& agredido, Personaje& v){
-
- int aleatorio;
- std::uniform_int_distribution<int> d(0, 1);
- std::random_device rd1;
- aleatorio=d(rd1);
- if(aleatorio==1){
- this->acierto(agredido,v);
- } else {
- this->fallo(v);
- }
- }
- void Personaje::pegar(Personaje& agredido){
- agredido.vida -= this->ataque;
- }
- void Personaje::curar(Personaje& v){
-
- if(botiquin>0){
- this->botiquin-=1;
- this->vida+=100;
- }
- }
- void Personaje::disparo_acertado(Personaje& agredido){
- agredido.vida-=this->balas_dano;
- if(this->isBot==0){
- this->balas-=1;
- }
- }
|