-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacter.h
104 lines (74 loc) · 2.67 KB
/
Character.h
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
//
// Character.h
// tester
//
// Created by Zach Waterson on 3/22/14.
// Copyright (c) 2014 Zach Waterson. All rights reserved.
//
/*
This is the base character class of which other characters will inherit.
*/
#ifndef __tester__Character__
#define __tester__Character__
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <sstream>
#include "Settings.h"
using namespace std;
typedef struct {
int turnsUntilGone; //when zero, status is removed
bool causesIncap; //when 1, status incapacitates character
int healthPerTurn; //amount of damage to be dealt per turn CAN BE NEGATIVE TO HEAL
} Status;
class Character {
protected:
//these are stored to be returned to after battle (except health)
//these can be improved by leveling up
int maxHealth;
int standardPower;
int maxPP; //mana for moves
int standardPPRegen;
//int standardArmor;
int currentHealth; //current health in/out battle
//these are augmented in battle and reset afterwords to the above values
int currentPower;
int currentPP;
int currentPPRegen;
int currentShield; //reset to 0
//int currentArmor;
//these are not increased by level points
//int accuracy;
int isIncap;
string name;
string file;
vector<string> moves;
vector<Status> statuses;
string spriteName;
string displayLog;
public:
Character(string fileName);
void actMoveOnTarget(string moveName, vector<Character *> targets);
int numTargetsForMove(string moveName); //returns 0 if all
//setters and getters, these adjust for <0 or >max inputs
int getCurrentHealth();
void setCurrentHealth(int health);
int getCurrentPower();
void setCurrentPower(int power);
int getCurrentPP();
void setCurrentPP(int PP);
int getCurrentPPRegen();
void setCurrentPPRegen(int PPRegen);
int getCurrentShield();
void setCurrentShield(int shield);
string getName();
void applyStatus(string line, int casterPower); //applies status to self
void updateStatuses(); //updates each status (to be done at beginning of turn)
void changeHealth(int newHealth); //changes health, taking shields into account. pass in desired newHealth before shields
bool canCastMove(string moveName); //checks if enough PP for move
private:
string displayStringForMove(string command, Character *target, int targetDamage, int actorDamage); //creates text to be displayed
int getValueForCommand(string command, int baseVal, int power); //baseval typically a char's stat, this parses and multiplies by the actor's power
};
#endif /* defined(__tester__Character__) */