-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.hpp
105 lines (82 loc) · 2.63 KB
/
player.hpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#pragma once
#include "DxLib.h"
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include "ExternalHeaderFiles/json.hpp"
#include "sprite.hpp"
#include "input.hpp"
#include "map.hpp"
#include "arrow.hpp"
class arrow;
class monster;
class map;
using json = nlohmann::json;
class player {
public:
enum skill {
HEAL, HP_MAX_UP, ATTACK_SPEED_UP, ATTACK_UP, DEFENSE_UP, GOD_TIME_EXTENSION, WALK_SPEED_UP,
DIAGONAL_ARROW, FRONT_ARROW, SIDE_ARROW, BACK_ARROW, MULTI_SHOT, PENETRATION, BOUND, POISON, HEADSHOT
};
private:
json Config;
std::map<std::string, int> Graph;
std::map<std::string, pos> GraphSize;
std::map<std::string, int> Font;
input *Input;
map *Map;
std::vector<arrow> *Arrow;
bool *Death, *Next;
std::vector<monster *> *Monster;
struct {
bool UseFlag = false;
pos Pos{};
pos Stick{};
int Size = 64;
} Joystick;
int HP, MaxHP;
int GodTime = 0, GodTimeMax;
int AttackCooldown, AttackCooldownMax;
int Attack;
int Defense = 0;
double Speed;
std::vector<bool> BlockCol = {
false, // air
true, // wall
true, // stone
true, // pond
};
std::map<skill, int> SkillLeft;
std::map<skill, int> SkillMax = {
{ HEAL, -1 }, { HP_MAX_UP, -1 }, { ATTACK_SPEED_UP, 2 }, { ATTACK_UP, -1 }, { DEFENSE_UP, -1 }, { GOD_TIME_EXTENSION, 3 }, { WALK_SPEED_UP, 1 },
{ DIAGONAL_ARROW, 3 }, { FRONT_ARROW, 3 }, { SIDE_ARROW, 2 }, { BACK_ARROW, 2 }, { MULTI_SHOT, 2 }, { PENETRATION, 2 }, { BOUND, 2 }, { POISON, 1 }, { HEADSHOT, 2 }
};
int MultiShotCount = 0;
void Move();
void KeyInput(pos *InputDirection);
std::map<skill, int> GetSkill();
std::string SkillMessage = "";
int SkillMessageCount = 0;
std::string ErrorMessage = "";
int ErrorMessageCount = 0;
public:
pos StartPos{ 48.0 * 12 + 8.0, 48.0 * 6 + 8.0 };
sprite Sprite;
void JoystickInput(pos *InputDirection);
void Update();
void Draw();
void JoystickDraw();
int GetHP();
int GetMaxHP();
void Heal(int AddHP);
void Damage(int Damage);
std::map<skill, int> GetSkillLeft();
bool GiveSkill(skill Skill);
enum shape {
SQUARE, CIRCLE
};
bool CheckHit(sprite Sprite, enum shape Shape = SQUARE);
player();
player(input *Input, map *Map, std::vector<arrow> *Arrow, bool *Death, bool *Next, std::vector<monster *> *Monster, std::map<std::string, int> Graph, std::map<std::string, int> Font, json Config);
};