/**********************************************************************************
* Copyright 2020-2022 Michael McBride
*
* This file is part of PF2 Character Manager
*
* PF2 Character Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
**********************************************************************************/
#ifndef COMPANION_H
#define COMPANION_H
#include <QObject>
#include "character.h"
class Companion : public QObject
{
Q_OBJECT
private:
character *ch; // Pointer to our master
public:
//////////////////////
// Animal Companions
//////////////////////
void setMaster(character *ch); // Set who our master is
Q_PROPERTY(QString tabName READ tabName NOTIFY miscInfoChanged)
QString tabName();
Q_PROPERTY(QStringList anCompList READ anCompList NOTIFY sourceListChanged)
Q_PROPERTY(int acCompID READ acCompID NOTIFY miscInfoChanged)
Q_PROPERTY(bool acComp READ acComp NOTIFY miscInfoChanged)
bool acComp(); // Returns true if character has an animal companion, otherwise false.
int acCompID(); // Returns the animal companion type ID
Q_INVOKABLE QString getAnCompInfo(int id,int index); // Returns information on animal companion, index: 0=name
Q_INVOKABLE QString acSenseIDToTxt(int id); // Returns name of animal companion sense name
Q_INVOKABLE QString anCompInfoTxt(int id); // Returns HTML information about indicated animal companion
Q_INVOKABLE void updateAnComp(); // Recalculates animal companion
Q_INVOKABLE void setAnCompanion(int id); // Saves the new value to the character file and recalculate
QStringList anCompList(); // Returns a list of available animal companion types
QString anCompSpecializationName(int id); // Returns the name of an animal companion specialization when given ID
Q_PROPERTY(QString acName READ acName NOTIFY acInfoChanged)
Q_PROPERTY(QString acInfoTxt READ acInfoTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString acDesc READ acDesc NOTIFY acInfoChanged)
Q_PROPERTY(QString acPercTxt READ acPercTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompSkillsInfo READ aCompSkillsInfo NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompAbilScoreTxt READ aCompAbilScoreTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompACSavesTxt READ aCompACSavesTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompHPTxt READ aCompHPTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompSpeedTxt READ aCompSpeedTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompAttackTxt READ aCompAttackTxt NOTIFY acInfoChanged)
Q_PROPERTY(QString aCompAbilTxt READ aCompAbilTxt NOTIFY acInfoChanged)
QString acName(); // Returns animal companions name
Q_INVOKABLE void setACName(QString name); // Saves name of animal companion to character file
QString acInfoTxt(); // Returns text line describing Animal Companion for statblock
Q_INVOKABLE QString acDesc(); // Returns a description of the animal (Brown bear, snow leoaprd, etc)
Q_INVOKABLE void setACDesc(QString desc); // Saves description of animal companion to character file
QString acPercTxt(); // Returns the current perception bonus of the animal companion
QString aCompSkillsInfo(); // Returns a comma separated list of skills for stat block
QString aCompAbilScoreTxt(); // Returns Ability Score Text string for stat block
QString aCompACSavesTxt(); // Returns AC and saves for stat block
QString aCompHPTxt(); // Returns HP line for stat block
QString aCompSpeedTxt(); // Returns text info about speed
QString aCompAttackTxt(); // Returns text string of attacks for Animal Companion
QString aCompAbilTxt(); // Returns a comma separated list of abilities for the stat block
QList<character::skillInfo> chAnimalCompSkillList;
// Below should all be private but we will leave them public for now. PdfMaker references them directly
int type=1;
QString acAge="J"; // J=Juvenile, M=Mature
bool nimble=false;
bool savage=true;
QStringList specializedList;
QString name="Mittens";
int strMod=-99;
int dexMod=-99;
int conMod=-99;
int intMod=-99;
int wisMod=-99;
int chaMod=-99;
int size=2;
int level=0;
QString melee1Name;
QStringList melee1TraitList;
int melee1Dice=0;
int melee1NumDice=1;
QString melee1DamageType;
QString melee1Action;
int melee1DamagePlus=0;
int melee1Attack=0;
QString melee2Name;
QStringList melee2TraitList;
int melee2Dice;
int melee2NumDice=1;
QString melee2DamageType;
QString melee2Action;
int melee2DamagePlus=0;
int melee2Attack=0;
int typeHP=0;
int maxHP=0;
QStringList trainedSkills;
QStringList sensesList;
int speed=0;
int burrowSpeed=0;
int climbSpeed=0;
int flySpeed=0;
int swimSpeed=0;
QString supportBenefit;
QString advManeuverName;
QString advManeuverAction;
QString advManeuverReq;
QStringList advManeuverTraitList;
QString advManeuverTxt;
QString specialTxt;
QString source;
QString pages;
QString AON;
int fortSave=-99;
QString fortSaveProf="T";
int refSave=-99;
QString refSaveProf="T";
int willSave=-99;
QString willSaveProf="T";
int percep=-99;
QString percepProf="T";
QString unarmedAttackProf="T";
QString unarmoredDefenseProf="T";
QString bardingProf="T";
int armorClass=-19;
QList<character::abilInfo> acAbilList;
//////////////////////
// Familiars
//////////////////////
struct familiarInfo {
int size=1;
QString desc;
QString name;
QStringList traitList;
int fortSave=-99;
int refSave=-99;
int willSave=-99;
int attackMod=-99;
int percMod=-99;
int acrobatics=-99;
int stealth=-99;
int maxHP=-99;
QStringList senseList;
int landSpeed=-99;
int burrowSpeed=-99;
int climbSpeed=-99;
int flySpeed=-99;
int swimSpeed=-99;
QStringList abilityList;
QString htmlInfo;
};
Q_PROPERTY(bool familiar READ familiar NOTIFY miscInfoChanged)
Q_PROPERTY(bool improvedFamAtuneVisible READ improvedFamAtuneVisible NOTIFY miscInfoChanged)
Q_PROPERTY(int famAbilNum READ famAbilNum NOTIFY famChanged)
Q_PROPERTY(QString famHTML READ famHTML NOTIFY famChanged)
bool familiar(); // Returns true if character has a familiar.
bool improvedFamAtuneVisible(); // Returns true if character has taken Improved Familiar Atunement Arcane Thesis
int famAbilNum(); // Returns the number of familiar abilities the player has
Q_INVOKABLE void calcFam(); // Recalculate Familiar
// Q_INVOKABLE QString famHTML(); // Returns HTML info for interface
QString famHTML(); // Returns HTML info for interface (signal connected)
Q_INVOKABLE QString famName(); // Returns a name for the familiar
Q_INVOKABLE void setFameName(QString name); // Saves familiar name to character file
Q_INVOKABLE QString famDesc(); // Returns the brief description of the familiar
Q_INVOKABLE void setFamDesc(QString desc); // Saves familar description to character file
Q_INVOKABLE int famSpeedIndex(); // Returns the base speed of the familiar (defaults to land)
Q_INVOKABLE void setFamSpeedIndex(int index); // Saves the players choice on the primary speed of the familiar
Q_INVOKABLE QStringList famAbilList(int index); // Returns a list of familiar abilities
Q_INVOKABLE void setFamAbil(QString abilName, int index); // Saves player choice of familiar ability
QString famAbilInfo(int id, int index); // Returns info regarding familiar ability
int famAbil1();
int famAbil2();
int famAbil3();
int famAbil4();
int famAbil5();
int famAbilImpFamAtune1(); // Returns the familiar ability taken at level 1 for those with the Improved Familiar Atunement Arcane Thesis (Level 1)
int famAbilImpFamAtune2(); // Returns the familiar ability taken at level 6 for those with the Improved Familiar Atunement Arcane Thesis (Level 1)
int famAbilImpFamAtune3(); // Returns the familiar ability taken at level 12 for those with the Improved Familiar Atunement Arcane Thesis (Level 1)
int famAbilImpFamAtune4(); // Returns the familiar ability taken at level 18 for those with the Improved Familiar Atunement Arcane Thesis (Level 1)
familiarInfo famInfo; // Holds familiar information
explicit Companion(QObject *parent = nullptr);
signals:
void sourceListChanged();
void miscInfoChanged();
void acInfoChanged();
void famChanged();
};
#endif // COMPANION_H