123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- /*
- *
- * This file is part of Luces de 1984 SDL version (L1-sdl).
- * Copyright (C) <2017> <alkeon> [alkeon@autistici.org]
-
- * L1-sdl is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * L1-sdl is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with l1-sdl. If not, see <http://www.gnu.org/licenses/>.
- *
- */
- #include <iostream>
- #include "personajes.h"
- #include <string>
- #include <random>
- using namespace std;
- //Constructor y destructor
- 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){
- //dqmutil::setColor(1);
- this->balas-=1;
- agredido.vida-=this->balas_dano;
- }
- void Personaje::fallo(Personaje& v){
- //dqmutil::setColor(1);
- this->balas-=1;
- }
- void Personaje::disparas(Personaje& agredido, Personaje& v){
- //dqmutil::setColor(1);
- 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){
- //dqmutil::setColor(1);
- 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;
- }
- }
|