-
Notifications
You must be signed in to change notification settings - Fork 5
Containers documentation
** among other things
** only containers-related content listed here
enum class Attribute : quint8 {
Defence,
Perception,
Health,
Regeneration,
MovePoints
};enum class Kingdom : quint8 {
Humans,
Dwarfs,
Elves,
Halflings
};
/* with proper std::array with labels */ //QMap/QHash also possible#Item
const UID ID_;
const CharacterStats statsModifiers_;
const QString name_;
const ItemType type_;
const QMap <PlayerClass, bool> restrictions_; //QMap or QHash
const quint8 value_;static const quint8 WEARABLES_PER_MARKET = 6;
//Number of consumables items per market is randomenum class ItemType : quint8 {
// Wearable items:
TwoHanded,
OneHeanded,
Shield,
Armor,
Helmet,
Artifact,
//One-time use items:
Potion,
Scroll
//and more
};
/* with proper std::array with labels */ //QMap/QHash also possiblegettersQString generateDescription(const Player &player) const; //player is here to check if item is permitted & equippedbool isPermitted(const Player &player) const;
####Item Groups
Items Groups may be stores in GameMaster as
QHash <GroupID, <QList <Item::UID> >(GroupID is not yet specified).
It may turn out, (due to MVC) that it's better to store it differently.
##ItemWearable
This is subclass of Item
###Content
const bool isComplex_;
const ItemQuality quality_; //maybe will be moved to Item
//const QList <Action> actions_; //to use in futuregetters
Items should be allocated dynamically within the heap.
They should be stored in GameMaster inQHash <UID, QPair <const ItemWearable *, bool isInUse> >.
When buying WearableItem, Player stores pointer to it and marks original using
isInUse.
There should be only one instance of specific WearableItem in use at the same time.
This is subclass of Item
const bool usageType_; //inside/outside battle
const qint8 duration_; //how many turns this item is active after use (-1 instant, >0 duration)getters
Items should be allocated dynamically within the heap.
They should be stored in GameMaster inQHash <UID, ItemConsumable * >.
When buying ConsumableItem, Player stores only pointer to original object.
#Quest
###Content
const UID ID_;
const QuestType type_;
const QuestLevel level_;
const Kingdom fraction_;
const QString title_;
const QString description_;
const bool isReturnRequired_;
const FieldId targetField_;
const Prize *prize_;
const QList <const Enemy *> enemies_;static const quint8 QUESTS_PER_TAVERN = 3;
static const quint8 ACCEPTED_QUEST_LIMIT = 5;
static const quint8 COST_OF_ABANDONING_QUEST = 2;
static const qiunt8 BASE_FIND_CHANCE = 50; // in percents
static const quint8 PERCEPTION_BONUS = 5; // in percents, bonus to BASE_FIND_CHANCEenum class QuestType : quint8 {
defeat = 1,
fetch = 2,
find = 3
};//to use in Player class
struct State {
const Quest *quest_;
FieldId employerField_;
bool isPartiallyCompleted_;
QList <Enemy *> enemies_;
};gettersvoid doQuest(Player &player);QuestState initQuest() const;QString generateDescription() const;
Quests should be allocated dynamically within the heap.
They should be stored in GameMaster inQHash <UID, QPair <const Quest *, bool isInUse> >.
When accepting quest, Player itializes QuestState and stores it in his container.
Original quest is from now marked withisInUseand no longer can be drawn or accepted.
There should be only one instance of specific quest in use at the same time.
#Prize
const UID ID_;
const QMap <PlayerRace, qint8> reputation_; //QMap or QHash
const quint16 gold_;
const quint16 experience_;
//those below should vanish with checkable fields in editor (it have potential to be done neatly)
//maybe number of items to draw should be add?
const QStringList groupNames_; //maybe another enum?
const QList <const Item *> items_; //no longer pointer to QList, "const Item *" type instead of intconst Prize mergePrize(const Prize *const prize) const;void grantPrize(Player & player) const;QString generateDescritption() const;
Prizes should be allocated dynamically within the heap.
They should be stored in GameMaster in QHash <UID, Prize>.
#FightParticipant
This is superclass for Enemy & Player
const QString name_;
const QString imageFile_; //wont be used for a while (due to lack of images)
//const FightStratedy fightStrategy_; //not yet implemented (will be introduced with PVP)
qint16 healthCurrent_; //without this it would be nice class with const only, but as for me it is too little for using flyweightenum class AttackType : quint8 {
meele,
ranged,
magical
};struct BattleStats {
qint8 healthMax_;
qint8 defence_;
qint8 perception_;
QMap <AttackType, QPair <qint8, qint8> > attacks_; //or QHash | AttackType -> min value, range
};-
gettersvirtual getters for BattleStats, normal getters for the rest //I am not sure if virtual is good word here setter for healthCurrent_
##Enemy
This is subclass of FightParticipant
const BattleStats baseStats_;
const AttackType defaultAttack_;
const Prize *prize_;static const size_t NUMBER_OF_ENEMIES_GROUPS = 5;implement getters for BattleStats & for Prize
Copy is passed for fight due to
healthCurrentvariable, which is needed for easy fight generalization.
Enemies should be allocated dynamically within the heap.
They should be stored in GameMaster inQHash <UID, const Enemy *>.
####Item Groups
Items Groups may be stores in GameMaster as
QHash <qint8, <QList <Enemy::UID> >(Level -> enemies list).
It may turn out, (due to MVC) that it's better to store it differently.
##Player
This is subclass of FightParticipant
(This class may split to PlayerAI & PlayerHuman in future)
bool isActive_;
const PlayerRace playerRace_;
const PlayerClass playerClass_;
const QColor color_;
const bool isAI_;
CharacterStats baseStats_;
QList <QPair <CharacterStats, int, bool> effects_; //effect, timeLeft{-1 for constant >=0 left turns}, type{inside/outside battle}
quint8 level_;
QMap <PlayerRace, qint16> reputation_; //QMap or QHash
size_t consumablesSlotsNumber_;
quint8 gold_;
quint16 experience_;
FieldId position_;
Equipment equipment_;
QMap <Quest::UID, QuestState> quests_; //QMap or QHash
bool hasFoughtRecently_; //may be removedstatic const qint8 BASE_PLAYER_ATTACK_RANGE = 10;
static const quint16 STARTING_EXPERIENCE = 0;
static const quint8 STARTING_LEVEL = 1;
static const quint8 MAX_LEVEL = 10;
static const quint16 LEVELS_BOUNDARIES[MAX_LEVEL] = {0, 500, 1100, 1800, 2600, 3500, 4500, 5600, 6800, 8100}; //it may change
static const quint8 POZIOM_GRANICZNY = 5;
static const quint8 ATTRIBUTE_POINTS_PER_LEVEL = 3;
static const quint8 HEALTH_INCREASE_PER_LEVEL = 3;
static const quint16 STARTING_REPUTATION = 0;
static const quint8 MAX_REPUTATION = 5;
static const quint8 STARTING_GOLD = 3;
static const quint8 HEALTH_RESTORED_PER_GOLD_COIN = 4;
static const size_t ARTIFACT_LIMIT = 5;enum class PlayerRace : quint8 {
human,
dwarf,
elf,
halfling
};
/* with proper std::array with labels */ //QMap/QHash also possibleenum class PlayerClass : quint8 {
fighter,
dwarf,
elf,
halfling
};
/* with proper std::array with labels */ //QMap/QHash also possiblestruct CharacterStats {
BattleStats battleStats_;
qint8 regeneration_;
qint8 movePoints_;
};this don't have to be final form of this API, it will probably somehow improve/adapt
getterssome settersvoid addQuest(const Quest *quest);void removeQuest(const Quest::UID) const;//maybe few more quest-related methods (we'll see later)bool addItem(const Item *item);bool removeItem(const ItemState &item);bool equipItem(const ItemState &item);bool unequipItem(const ItemState &item);void useItem(ItemState &item);slot void updateStateBattleTurn();slot void updateStateGameTurn();signal statsChanged();
#Equipment
struct itemsEquipped {
ItemWearable *head_;
ItemWearable *torso_;
ItemWearable *leftHand_;
ItemWearable *rightHand_;
QList <ItemWearable *> artifacts_; //it has fixed size, so maybe sth else than QList ?
};
QList <ItemWearable *> backpackForWearables_;
QList <ItemConsumable *> backpackForConsumables_;
QList <ItemConsumable *> consumableSlots_; // it has fixed size, so maybe sth else than QList ?this don't have to be final form of this API, it will probably somehow improve/adapt
gettersbool addItem(const Item *item);bool removeItem(const Item *item);bool equipItem(const ItemWerable *item);bool unequipItem(const ItemWearable *item);void useItem(const ItemConsumable *item);CharacterStats currentBonusFromEquipped() const;