-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolFactory.cpp
More file actions
36 lines (34 loc) · 887 Bytes
/
Copy pathToolFactory.cpp
File metadata and controls
36 lines (34 loc) · 887 Bytes
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
//
// Created by lapo on 13/06/22.
//
#include "ToolFactory.h"
Tool *ToolFactory::createTool(Hero *heroptr,std::string type) {
Tool* tool=0;
int N = rand() % 4;
if(type.compare("Loot")) {
if(N!=3) {
tool = new Tool(N);
tool->ChooseRarityFirst();
return tool;
}
if (N == 3) {
int M=heroptr->getSpecialTool()->getSpecial();
tool = new SpecialTool(M);
tool->ChooseRarityFirst();
return tool;
}
}
if(type.compare("Shop")) {
if(N!=3) {
tool = new Tool(N);
tool->ChooseRaritySecond();
return tool;
}
if (N == 3) {
int M=heroptr->getSpecialTool()->getSpecial();
tool = new SpecialTool(M);
tool->ChooseRaritySecond();
return tool;
}
}
}