forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
skill.cpp
49 lines (40 loc) · 1.9 KB
/
skill.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include "skill.h"
#include "item_factory.h"
string Skill::getName() const {
return name;
}
string Skill::getHelpText() const {
return helpText;
}
class IdentifySkill : public Skill {
public:
IdentifySkill(string name, string helpText, ItemFactory f) : Skill(name, helpText), factory(f) {}
virtual void onTeach(Creature* c) override {
string message;
for (PItem& it : factory.getAll()) {
Item::identify(it->getName());
message.append(it->getName() + ": " + it->getDescription() + "\n");
}
// c->privateMessage(MessageBuffer::important(message));
}
private:
ItemFactory factory;
};
Skill* const Skill::ambush = new Skill("skill of ambush" ,"Press \'h\' to hide and attack unsuspecting enemies.");
Skill* const Skill::twoHandedWeapon = new Skill("skill of fighting with two-handed weapons",
"You can now fight with warhammers and battle axes.");
Skill* const Skill::knifeThrowing = new Skill("skill of knife throwing",
"You can now throw knives with deadly precision.");
Skill* const Skill::stealing = new Skill("skill of stealing", "Not available");
Skill* const Skill::mushrooms = new IdentifySkill("knowledge of mushrooms",
"You now know the types of mushrooms and their use.", ItemFactory::mushrooms());
Skill* const Skill::potions = new IdentifySkill("knowledge of potions",
"You now know the types of potions and their use.", ItemFactory::potions());
Skill* const Skill::amulets = new IdentifySkill("knowledge of amulets",
"You now know the types of amulets and their use.", ItemFactory::amulets());
Skill* const Skill::swimming = new Skill("skill of swimming", "");
Skill* const Skill::archery = new Skill("skill of archery",
"You can now equip a bow and use \'alt + arrow\' to fire");
Skill* const Skill::construction = new Skill("skill of construction", "");
Skill::Skill(string _name, string _helpText) : name(_name), helpText(_helpText) {}