CPP03 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
ClapTrap.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ClapTrap.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/05/08 12:47:08 by kamitsui #+# #+# */
9/* Updated: 2025/05/15 13:04:51 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
26#ifndef CLAPTRAP_HPP
27#define CLAPTRAP_HPP
28
29#include <iostream>
30#include <string>
31
40class ClapTrap {
41 public:
42 static const unsigned int defaultHitPoints = 10;
43 static const unsigned int defaultEnergyPoints = 10;
44 static const unsigned int defaultAttackDamage = 0;
45
46 protected:
47 std::string name;
48 unsigned int hitPoints;
49 unsigned int energyPoints;
50 unsigned int attackDamage;
51
52 public:
54 ClapTrap(const std::string &name);
55 ClapTrap(const ClapTrap &other);
56 ClapTrap(const std::string &name, unsigned int hp, unsigned int ep, unsigned int ad);
57 ClapTrap &operator=(const ClapTrap &other);
58 virtual ~ClapTrap();
59
60 virtual void attack(const std::string &target);
61 void takeDamage(unsigned int amount);
62 void beRepaired(unsigned int amount);
63
64 // const std::string &getName() const;
65 virtual const std::string &getName() const;
66 unsigned int getHitPoints() const;
67 unsigned int getEnergyPoints() const;
68 unsigned int getAttackDamage() const;
69};
70
71#endif
Represents a basic robot character.
Definition ClapTrap.hpp:34
static const unsigned int defaultHitPoints
Definition ClapTrap.hpp:42
virtual ~ClapTrap()
static const unsigned int defaultAttackDamage
Definition ClapTrap.hpp:44
void beRepaired(unsigned int amount)
unsigned int getHitPoints() const
unsigned int getAttackDamage() const
virtual void attack(const std::string &target)
ClapTrap(const ClapTrap &other)
void takeDamage(unsigned int amount)
ClapTrap & operator=(const ClapTrap &other)
static const unsigned int defaultEnergyPoints
Definition ClapTrap.hpp:43
virtual const std::string & getName() const
unsigned int getEnergyPoints() const
ClapTrap(const std::string &name)