ready to merge some races
This commit is contained in:
@ -20,17 +20,7 @@ class character; // forward declaration
|
|||||||
extern RNG rng;
|
extern RNG rng;
|
||||||
|
|
||||||
// Note: player should not be in the character list
|
// Note: player should not be in the character list
|
||||||
class character_list final: public layer {
|
typedef std::vector<character> character_list;
|
||||||
private:
|
|
||||||
std::vector<std::unique_ptr<character>> characters;
|
|
||||||
public:
|
|
||||||
character_list();
|
|
||||||
void print() const;
|
|
||||||
void print(display &display) const;
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<character>>::const_iterator begin() const;
|
|
||||||
std::vector<std::unique_ptr<character>>::const_iterator end() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class character {
|
class character {
|
||||||
public:
|
public:
|
||||||
@ -45,7 +35,7 @@ public:
|
|||||||
virtual result move(const direction dir,
|
virtual result move(const direction dir,
|
||||||
const position_list &available_positions);
|
const position_list &available_positions);
|
||||||
virtual result attack(const direction dir,
|
virtual result attack(const direction dir,
|
||||||
const character_list &chlist) = 0;
|
character_list &chlist) = 0;
|
||||||
virtual result move_or_attack(const direction dir,
|
virtual result move_or_attack(const direction dir,
|
||||||
const position_list &available_positions,
|
const position_list &available_positions,
|
||||||
const character_list &chlist);
|
const character_list &chlist);
|
||||||
|
10
src/inventory.h
Normal file
10
src/inventory.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef __INVENTORY_H__
|
||||||
|
#define __INVENTORY_H__
|
||||||
|
|
||||||
|
class inventory final {
|
||||||
|
private:
|
||||||
|
object_list objects;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -18,6 +18,11 @@ public:
|
|||||||
void print(display &display) {}
|
void print(display &display) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class object_list final: public layer {
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: throw potion into another header
|
// TODO: throw potion into another header
|
||||||
|
|
||||||
class potion final: public object {
|
class potion final: public object {
|
||||||
|
@ -10,12 +10,12 @@ shade::shade(const position_list &available_positions):
|
|||||||
hostile = true;
|
hostile = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
result shade::attack(const direction dir, const character_list &chlist) {
|
result shade::attack(const direction dir, character_list &chlist) {
|
||||||
position tmp{pos + MOVE[dir]};
|
position tmp{pos + MOVE[dir]};
|
||||||
|
|
||||||
for (auto &ch : chlist)
|
for (auto &ch : chlist)
|
||||||
if (tmp == ch->get_position()) {
|
if (tmp == ch.get_position()) {
|
||||||
return ch->get_hit(race, ATK, base_hitrate);
|
return ch.get_hit(race, ATK, base_hitrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result::fine;
|
return result::fine;
|
||||||
|
@ -14,7 +14,7 @@ class shade final: public character {
|
|||||||
public:
|
public:
|
||||||
shade(const position_list &available_positions); // spawn at a random place
|
shade(const position_list &available_positions); // spawn at a random place
|
||||||
virtual result attack(const direction dir,
|
virtual result attack(const direction dir,
|
||||||
const character_list &chlist) override;
|
character_list &chlist) override;
|
||||||
virtual result get_hit(const enum race &race, const int atk,
|
virtual result get_hit(const enum race &race, const int atk,
|
||||||
const float hitrate) override;
|
const float hitrate) override;
|
||||||
};
|
};
|
||||||
|
1
src/room.cc
Normal file
1
src/room.cc
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "room.h"
|
6
src/room.h
Normal file
6
src/room.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __ROOM_H__
|
||||||
|
#define __ROOM_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user