- attempt to fix attack boosts to properly apply and de-apply when upgrades are present
This commit is contained in:
parent
4dea67cff9
commit
461b16be8e
|
@ -9799,6 +9799,9 @@ Texture2D * Renderer::findTexture(string logoFilename) {
|
|||
void Renderer::cycleShowDebugUILevel() {
|
||||
//printf("#1 showDebugUILevel = %d, debugui_fps = %d, debugui_unit_titles = %d\n",showDebugUILevel,debugui_fps,debugui_unit_titles);
|
||||
|
||||
//if(showDebugUI == false) {
|
||||
// showDebugUI = true;
|
||||
//}
|
||||
if((showDebugUILevel & debugui_fps) != debugui_fps ||
|
||||
(showDebugUILevel & debugui_unit_titles) != debugui_unit_titles) {
|
||||
showDebugUILevel |= debugui_fps;
|
||||
|
|
|
@ -1147,6 +1147,7 @@ void MainWindow::eventKeyDown(SDL_KeyboardEvent key) {
|
|||
Renderer &renderer= Renderer::getInstance();
|
||||
if(keystate.mod & (KMOD_LALT | KMOD_RALT)) {
|
||||
renderer.cycleShowDebugUILevel();
|
||||
printf("**Cycled Debug UI level to: %d\n",renderer.getShowDebugUILevel());
|
||||
}
|
||||
else {
|
||||
bool showDebugUI = renderer.getShowDebugUI();
|
||||
|
|
|
@ -42,6 +42,38 @@ namespace Glest{ namespace Game{
|
|||
const string VALUE_PERCENT_MULTIPLIER_KEY_NAME = "value-percent-multiplier";
|
||||
const string VALUE_REGEN_KEY_NAME = "regeneration";
|
||||
|
||||
void UpgradeTypeBase::copyData(UpgradeTypeBase *destination) {
|
||||
destination->upgradename = upgradename;
|
||||
destination->maxHp = maxHp;
|
||||
destination->maxHpIsMultiplier = maxHpIsMultiplier;
|
||||
destination->maxHpRegeneration = maxHpRegeneration;
|
||||
destination->sight = sight;
|
||||
destination->sightIsMultiplier = sightIsMultiplier;
|
||||
destination->maxEp = maxEp;
|
||||
destination->maxEpIsMultiplier = maxEpIsMultiplier;
|
||||
destination->maxEpRegeneration = maxEpRegeneration;
|
||||
destination->armor = armor;
|
||||
destination->armorIsMultiplier = armorIsMultiplier;
|
||||
destination->attackStrength = attackStrength;
|
||||
destination->attackStrengthIsMultiplier = attackStrengthIsMultiplier;
|
||||
destination->attackStrengthMultiplierValueList = attackStrengthMultiplierValueList;
|
||||
destination->attackRange = attackRange;
|
||||
destination->attackRangeIsMultiplier = attackRangeIsMultiplier;
|
||||
destination->attackRangeMultiplierValueList = attackRangeMultiplierValueList;
|
||||
destination->moveSpeed = moveSpeed;
|
||||
destination->moveSpeedIsMultiplier = moveSpeedIsMultiplier;
|
||||
destination->moveSpeedIsMultiplierValueList = moveSpeedIsMultiplierValueList;
|
||||
destination->prodSpeed = prodSpeed;
|
||||
destination->prodSpeedIsMultiplier = prodSpeedIsMultiplier;
|
||||
destination->prodSpeedProduceIsMultiplierValueList = prodSpeedProduceIsMultiplierValueList;
|
||||
destination->prodSpeedUpgradeIsMultiplierValueList = prodSpeedUpgradeIsMultiplierValueList;
|
||||
destination->prodSpeedMorphIsMultiplierValueList = prodSpeedMorphIsMultiplierValueList;
|
||||
destination->attackSpeed = attackSpeed;
|
||||
destination->attackSpeedIsMultiplier = attackSpeedIsMultiplier;
|
||||
destination->attackSpeedIsMultiplierValueList = attackSpeedIsMultiplierValueList;
|
||||
|
||||
}
|
||||
|
||||
void UpgradeTypeBase::load(const XmlNode *upgradeNode, string upgradename) {
|
||||
this->upgradename = upgradename;
|
||||
//values
|
||||
|
@ -276,116 +308,70 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
|
|||
//int i;
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
if(maxHp != 0) {
|
||||
if(maxHpIsMultiplier) {
|
||||
str += indent+lang.getString("Hp",(translatedValue == true ? "" : "english")) + " *" + intToStr(maxHp);
|
||||
}
|
||||
else {
|
||||
str += indent+lang.getString("Hp",(translatedValue == true ? "" : "english")) + " +" + intToStr(maxHp);
|
||||
}
|
||||
|
||||
if(maxHpRegeneration != 0) {
|
||||
str += " [" + intToStr(maxHpRegeneration) + "]";
|
||||
if(getMaxHp() != 0) {
|
||||
str += indent+lang.getString("Hp",(translatedValue == true ? "" : "english")) + " *" + intToStr(getMaxHp());
|
||||
if(getMaxHpRegeneration() != 0) {
|
||||
str += " [" + intToStr(getMaxHpRegeneration()) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
if(sight != 0) {
|
||||
if(getSight() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
if(sightIsMultiplier) {
|
||||
str+= indent+lang.getString("Sight",(translatedValue == true ? "" : "english")) + " *" + intToStr(sight);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("Sight",(translatedValue == true ? "" : "english")) + " +" + intToStr(sight);
|
||||
}
|
||||
str+= indent+lang.getString("Sight",(translatedValue == true ? "" : "english")) + " +" + intToStr(getSight());
|
||||
}
|
||||
if(maxEp != 0) {
|
||||
if(getMaxEp() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(maxEpIsMultiplier) {
|
||||
str+= indent+lang.getString("Ep",(translatedValue == true ? "" : "english")) + " *" + intToStr(maxEp);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("Ep",(translatedValue == true ? "" : "english")) + " +" + intToStr(maxEp);
|
||||
}
|
||||
if(maxEpRegeneration != 0) {
|
||||
str += " [" + intToStr(maxEpRegeneration) + "]";
|
||||
str+= indent+lang.getString("Ep",(translatedValue == true ? "" : "english")) + " +" + intToStr(getMaxEp());
|
||||
if(getMaxEpRegeneration() != 0) {
|
||||
str += " [" + intToStr(getMaxEpRegeneration()) + "]";
|
||||
}
|
||||
}
|
||||
if(attackStrength != 0) {
|
||||
if(getAttackStrength() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(attackStrengthIsMultiplier) {
|
||||
str+= indent+lang.getString("AttackStrenght",(translatedValue == true ? "" : "english")) + " *" + intToStr(attackStrength);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("AttackStrenght",(translatedValue == true ? "" : "english")) + " +" + intToStr(attackStrength);
|
||||
}
|
||||
str+= indent+lang.getString("AttackStrenght",(translatedValue == true ? "" : "english")) + " +" + intToStr(getAttackStrength());
|
||||
}
|
||||
if(attackRange != 0) {
|
||||
if(getAttackRange() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(attackRangeIsMultiplier) {
|
||||
str+= indent+lang.getString("AttackDistance",(translatedValue == true ? "" : "english")) + " *" + intToStr(attackRange);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("AttackDistance",(translatedValue == true ? "" : "english")) + " +" + intToStr(attackRange);
|
||||
}
|
||||
str+= indent+lang.getString("AttackDistance",(translatedValue == true ? "" : "english")) + " +" + intToStr(getAttackRange());
|
||||
}
|
||||
if(armor != 0) {
|
||||
if(getArmor() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(armorIsMultiplier) {
|
||||
str+= indent+lang.getString("Armor",(translatedValue == true ? "" : "english")) + " *" + intToStr(armor);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("Armor",(translatedValue == true ? "" : "english")) + " +" + intToStr(armor);
|
||||
}
|
||||
str+= indent+lang.getString("Armor",(translatedValue == true ? "" : "english")) + " +" + intToStr(getArmor());
|
||||
}
|
||||
if(moveSpeed != 0) {
|
||||
if(getMoveSpeed() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(moveSpeedIsMultiplier) {
|
||||
str+= indent+lang.getString("WalkSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(moveSpeed);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("WalkSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(moveSpeed);
|
||||
}
|
||||
str+= indent+lang.getString("WalkSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(getMoveSpeed());
|
||||
}
|
||||
if(prodSpeed != 0) {
|
||||
if(getProdSpeed() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(prodSpeedIsMultiplier) {
|
||||
str+= indent+lang.getString("ProductionSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(prodSpeed);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("ProductionSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(prodSpeed);
|
||||
}
|
||||
str+= indent+lang.getString("ProductionSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(getProdSpeed());
|
||||
}
|
||||
if(attackSpeed != 0) {
|
||||
if(getAttackSpeed() != 0) {
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
}
|
||||
|
||||
if(attackSpeedIsMultiplier) {
|
||||
str+= indent+lang.getString("AttackSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(moveSpeed);
|
||||
}
|
||||
else {
|
||||
str+= indent+lang.getString("AttackSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(moveSpeed);
|
||||
}
|
||||
str+= indent+lang.getString("AttackSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(getAttackSpeed());
|
||||
}
|
||||
if(str != "") {
|
||||
str += "\n";
|
||||
|
@ -892,6 +878,9 @@ void TotalUpgrade::reset() {
|
|||
|
||||
attackSpeed=0;
|
||||
attackSpeedIsMultiplier=false;
|
||||
|
||||
boostUpgradeBase = NULL;
|
||||
boostUpgradeUnit = NULL;
|
||||
}
|
||||
|
||||
void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) {
|
||||
|
@ -1029,10 +1018,33 @@ void TotalUpgrade::sum(const UpgradeTypeBase *ut, const Unit *unit) {
|
|||
}
|
||||
|
||||
void TotalUpgrade::apply(const UpgradeTypeBase *ut, const Unit *unit) {
|
||||
sum(ut, unit);
|
||||
//sum(ut, unit);
|
||||
|
||||
//printf("====> About to apply boost: %s\nTo unit: %d\n\n",ut->toString().c_str(),unit->getId());
|
||||
TotalUpgrade *boostUpgrade = new TotalUpgrade();
|
||||
this->copyData(boostUpgrade);
|
||||
boostUpgrade->boostUpgradeBase = ut;
|
||||
boostUpgrade->boostUpgradeUnit = unit;
|
||||
|
||||
boostUpgrade->sum(ut,unit);
|
||||
boostUpgrades.push_back(boostUpgrade);
|
||||
}
|
||||
|
||||
void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) {
|
||||
//printf("<****** About to de-apply boost: %s\nTo unit: %d\n\n",ut->toString().c_str(),unit->getId());
|
||||
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
if(boost->boostUpgradeBase == ut && boost->boostUpgradeUnit == unit) {
|
||||
boostUpgrades.erase(boostUpgrades.begin() + index);
|
||||
delete boost;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TotalUpgrade::remove(const UpgradeTypeBase *ut,const Unit *unit) {
|
||||
maxHpIsMultiplier = ut->getMaxHpIsMultiplier();
|
||||
sightIsMultiplier = ut->getSightIsMultiplier();
|
||||
maxEpIsMultiplier = ut->getMaxEpIsMultiplier();
|
||||
|
@ -1184,6 +1196,107 @@ void TotalUpgrade::deapply(const UpgradeTypeBase *ut,const Unit *unit) {
|
|||
}
|
||||
}
|
||||
|
||||
int TotalUpgrade::getMaxHp() const {
|
||||
int result = maxHp;
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getMaxHp() - maxHp);
|
||||
result += boost->getMaxHp();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getMaxHpRegeneration() const {
|
||||
int result = maxHpRegeneration;
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getMaxHpRegeneration() - maxHpRegeneration);
|
||||
result += boost->getMaxHpRegeneration();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getSight() const {
|
||||
int result = sight;
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getSight() - sight);
|
||||
result += boost->getSight();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getMaxEp() const {
|
||||
int result = maxEp;
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getMaxEp() - maxEp);
|
||||
result += boost->getMaxEp();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getMaxEpRegeneration() const {
|
||||
int result = maxEpRegeneration;
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getMaxEpRegeneration() - maxEpRegeneration);
|
||||
result += boost->getMaxEpRegeneration();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getArmor() const {
|
||||
int result = armor;
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getArmor() - armor);
|
||||
result += boost->getArmor();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getAttackStrength(const AttackSkillType *st) const {
|
||||
int result = UpgradeTypeBase::getAttackStrength(st);
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getAttackStrength(st) - UpgradeTypeBase::getAttackStrength(st));
|
||||
result += boost->getAttackStrength(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getAttackRange(const AttackSkillType *st) const {
|
||||
int result = UpgradeTypeBase::getAttackRange(st);
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getAttackRange(st) - UpgradeTypeBase::getAttackRange(st));
|
||||
result += boost->getAttackRange(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getMoveSpeed(const MoveSkillType *st) const {
|
||||
int result = UpgradeTypeBase::getMoveSpeed(st);
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getMoveSpeed(st) - UpgradeTypeBase::getMoveSpeed(st));
|
||||
result += boost->getMoveSpeed(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getProdSpeed(const SkillType *st) const {
|
||||
int result = UpgradeTypeBase::getProdSpeed(st);
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getProdSpeed(st) - UpgradeTypeBase::getProdSpeed(st));
|
||||
result += boost->getProdSpeed(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int TotalUpgrade::getAttackSpeed(const AttackSkillType *st) const {
|
||||
int result = UpgradeTypeBase::getAttackSpeed(st);
|
||||
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
|
||||
TotalUpgrade *boost = boostUpgrades[index];
|
||||
//result += (boost->getAttackSpeed(st) - UpgradeTypeBase::getAttackSpeed(st));
|
||||
result += boost->getAttackSpeed(st);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void TotalUpgrade::incLevel(const UnitType *ut) {
|
||||
maxHp += ut->getMaxHp()*50/100;
|
||||
maxEp += ut->getMaxEp()*50/100;
|
||||
|
|
|
@ -97,6 +97,14 @@ protected:
|
|||
bool attackSpeedIsMultiplier;
|
||||
std::map<string,int> attackSpeedIsMultiplierValueList;
|
||||
|
||||
protected:
|
||||
|
||||
virtual int getAttackStrength() const { return attackStrength; }
|
||||
virtual int getAttackRange() const { return attackRange; }
|
||||
virtual int getMoveSpeed() const { return moveSpeed; }
|
||||
virtual int getProdSpeed() const { return prodSpeed; }
|
||||
virtual int getAttackSpeed() const { return attackSpeed; }
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates an UpgradeTypeBase with values such that there are no stat changes.
|
||||
|
@ -125,32 +133,30 @@ public:
|
|||
}
|
||||
virtual ~UpgradeTypeBase() {}
|
||||
|
||||
int getMaxHp() const {return maxHp;}
|
||||
bool getMaxHpIsMultiplier() const {return maxHpIsMultiplier;}
|
||||
int getMaxHpRegeneration() const {return maxHpRegeneration;}
|
||||
//bool getMaxHpRegenerationIsMultiplier() const {return maxHpRegenerationIsMultiplier;}
|
||||
virtual void copyData(UpgradeTypeBase *destination);
|
||||
|
||||
int getSight() const {return sight;}
|
||||
bool getSightIsMultiplier() const {return sightIsMultiplier;}
|
||||
virtual string getUpgradeName() const { return upgradename; }
|
||||
virtual int getMaxHp() const {return maxHp;}
|
||||
virtual int getMaxHpRegeneration() const {return maxHpRegeneration;}
|
||||
virtual int getSight() const {return sight;}
|
||||
virtual int getMaxEp() const {return maxEp;}
|
||||
virtual int getMaxEpRegeneration() const {return maxEpRegeneration;}
|
||||
virtual int getArmor() const {return armor;}
|
||||
virtual int getAttackStrength(const AttackSkillType *st) const;
|
||||
virtual int getAttackRange(const AttackSkillType *st) const;
|
||||
virtual int getMoveSpeed(const MoveSkillType *st) const;
|
||||
virtual int getProdSpeed(const SkillType *st) const;
|
||||
virtual int getAttackSpeed(const AttackSkillType *st) const;
|
||||
|
||||
int getMaxEp() const {return maxEp;}
|
||||
bool getMaxEpIsMultiplier() const {return maxEpIsMultiplier;}
|
||||
int getMaxEpRegeneration() const {return maxEpRegeneration;}
|
||||
//bool getMaxEpRegenerationIsMultiplier() const {return maxEpRegenerationIsMultiplier;}
|
||||
|
||||
int getArmor() const {return armor;}
|
||||
bool getArmorIsMultiplier() const {return armorIsMultiplier;}
|
||||
|
||||
int getAttackStrength(const AttackSkillType *st) const;
|
||||
bool getAttackStrengthIsMultiplier() const {return attackStrengthIsMultiplier;}
|
||||
int getAttackRange(const AttackSkillType *st) const;
|
||||
bool getAttackRangeIsMultiplier() const {return attackRangeIsMultiplier;}
|
||||
int getMoveSpeed(const MoveSkillType *st) const;
|
||||
bool getMoveSpeedIsMultiplier() const {return moveSpeedIsMultiplier;}
|
||||
int getProdSpeed(const SkillType *st) const;
|
||||
bool getProdSpeedIsMultiplier() const {return prodSpeedIsMultiplier;}
|
||||
int getAttackSpeed(const AttackSkillType *st) const;
|
||||
bool getAttackSpeedIsMultiplier() const {return attackSpeedIsMultiplier;}
|
||||
virtual bool getAttackStrengthIsMultiplier() const {return attackStrengthIsMultiplier;}
|
||||
virtual bool getMaxHpIsMultiplier() const {return maxHpIsMultiplier;}
|
||||
virtual bool getSightIsMultiplier() const {return sightIsMultiplier;}
|
||||
virtual bool getMaxEpIsMultiplier() const {return maxEpIsMultiplier;}
|
||||
virtual bool getArmorIsMultiplier() const {return armorIsMultiplier;}
|
||||
virtual bool getAttackRangeIsMultiplier() const {return attackRangeIsMultiplier;}
|
||||
virtual bool getMoveSpeedIsMultiplier() const {return moveSpeedIsMultiplier;}
|
||||
virtual bool getProdSpeedIsMultiplier() const {return prodSpeedIsMultiplier;}
|
||||
virtual bool getAttackSpeedIsMultiplier() const {return attackSpeedIsMultiplier;}
|
||||
|
||||
/**
|
||||
* Loads the upgrade values (stat boosts and whether or not the boosts use a multiplier) from an
|
||||
|
@ -159,7 +165,7 @@ public:
|
|||
* @param upgradename Unique identifier for the upgrade.
|
||||
*/
|
||||
|
||||
void load(const XmlNode *upgradeNode, string upgradename);
|
||||
virtual void load(const XmlNode *upgradeNode, string upgradename);
|
||||
|
||||
/**
|
||||
* Creates a string representation of the upgrade. All stat boosts are detailed on their own line
|
||||
|
@ -167,39 +173,39 @@ public:
|
|||
* @param translatedValue If true, the description is translated. Otherwise the description uses
|
||||
* names as they appear in the XMLs.
|
||||
*/
|
||||
virtual string getDesc(bool translatedValue) const;
|
||||
virtual string getDesc(bool translatedValue) const;
|
||||
|
||||
/**
|
||||
* Returns a string representation of this object. Lists all the value that the object stores.
|
||||
* For debugging purposes, only.
|
||||
*/
|
||||
std::string toString() const {
|
||||
virtual std::string toString() const {
|
||||
std::string result = "";
|
||||
|
||||
result += "upgradename =" + upgradename;
|
||||
result += "maxHp = " + intToStr(maxHp);
|
||||
result += "maxHpIsMultiplier = " + intToStr(maxHpIsMultiplier);
|
||||
result += "maxHpRegeneration = " + intToStr(maxHpRegeneration);
|
||||
result += "upgradename =" + getUpgradeName();
|
||||
result += "maxHp = " + intToStr(getMaxHp());
|
||||
result += "maxHpIsMultiplier = " + intToStr(getMaxHpIsMultiplier());
|
||||
result += "maxHpRegeneration = " + intToStr(getMaxHpRegeneration());
|
||||
//result += "maxHpRegenerationIsMultiplier = " + intToStr(maxHpRegenerationIsMultiplier);
|
||||
|
||||
result += " sight = " + intToStr(sight);
|
||||
result += "sightIsMultiplier = " + intToStr(sightIsMultiplier);
|
||||
result += " sight = " + intToStr(getSight());
|
||||
result += "sightIsMultiplier = " + intToStr(getSightIsMultiplier());
|
||||
|
||||
result += " maxEp = " + intToStr(maxEp);
|
||||
result += " maxEpIsMultiplier = " + intToStr(maxEpIsMultiplier);
|
||||
result += " maxEpRegeneration = " + intToStr(maxEpRegeneration);
|
||||
result += " maxEp = " + intToStr(getMaxEp());
|
||||
result += " maxEpIsMultiplier = " + intToStr(getMaxEpIsMultiplier());
|
||||
result += " maxEpRegeneration = " + intToStr(getMaxEpRegeneration());
|
||||
//result += "maxEpRegenerationIsMultiplier = " + intToStr(maxEpRegenerationIsMultiplier);
|
||||
|
||||
result += " armor = " + intToStr(armor);
|
||||
result += " armorIsMultiplier = " + intToStr(armorIsMultiplier);
|
||||
result += " attackStrength = " + intToStr(attackStrength);
|
||||
result += " attackStrengthIsMultiplier = " + intToStr(attackStrengthIsMultiplier);
|
||||
result += " attackRange = " + intToStr(attackRange);
|
||||
result += " attackRangeIsMultiplier = " + intToStr(attackRangeIsMultiplier);
|
||||
result += " moveSpeed = " + intToStr(moveSpeed);
|
||||
result += " moveSpeedIsMultiplier = " + intToStr(moveSpeedIsMultiplier);
|
||||
result += " prodSpeed = " + intToStr(prodSpeed);
|
||||
result += " prodSpeedIsMultiplier = " + intToStr(prodSpeedIsMultiplier);
|
||||
result += " armor = " + intToStr(getArmor());
|
||||
result += " armorIsMultiplier = " + intToStr(getArmorIsMultiplier());
|
||||
result += " attackStrength = " + intToStr(getAttackStrength());
|
||||
result += " attackStrengthIsMultiplier = " + intToStr(getAttackStrengthIsMultiplier());
|
||||
result += " attackRange = " + intToStr(getAttackRange());
|
||||
result += " attackRangeIsMultiplier = " + intToStr(getAttackRangeIsMultiplier());
|
||||
result += " moveSpeed = " + intToStr(getMoveSpeed());
|
||||
result += " moveSpeedIsMultiplier = " + intToStr(getMoveSpeedIsMultiplier());
|
||||
result += " prodSpeed = " + intToStr(getProdSpeed());
|
||||
result += " prodSpeedIsMultiplier = " + intToStr(getProdSpeedIsMultiplier());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -212,41 +218,41 @@ public:
|
|||
/**
|
||||
* Generates a checksum value for the upgrade.
|
||||
*/
|
||||
Checksum getCRC() {
|
||||
virtual Checksum getCRC() {
|
||||
Checksum crcForUpgradeType;
|
||||
|
||||
crcForUpgradeType.addString(upgradename);
|
||||
crcForUpgradeType.addInt(maxHp);
|
||||
crcForUpgradeType.addInt(maxHpIsMultiplier);
|
||||
crcForUpgradeType.addInt(maxHpRegeneration);
|
||||
crcForUpgradeType.addString(getUpgradeName());
|
||||
crcForUpgradeType.addInt(getMaxHp());
|
||||
crcForUpgradeType.addInt(getMaxHpIsMultiplier());
|
||||
crcForUpgradeType.addInt(getMaxHpRegeneration());
|
||||
|
||||
crcForUpgradeType.addInt(sight);
|
||||
crcForUpgradeType.addInt(sightIsMultiplier);
|
||||
crcForUpgradeType.addInt(getSight());
|
||||
crcForUpgradeType.addInt(getSightIsMultiplier());
|
||||
|
||||
crcForUpgradeType.addInt(maxEp);
|
||||
crcForUpgradeType.addInt(maxEpIsMultiplier);
|
||||
crcForUpgradeType.addInt(maxEpRegeneration);
|
||||
crcForUpgradeType.addInt(getMaxEp());
|
||||
crcForUpgradeType.addInt(getMaxEpIsMultiplier());
|
||||
crcForUpgradeType.addInt(getMaxEpRegeneration());
|
||||
|
||||
crcForUpgradeType.addInt(armor);
|
||||
crcForUpgradeType.addInt(armorIsMultiplier);
|
||||
crcForUpgradeType.addInt(getArmor());
|
||||
crcForUpgradeType.addInt(getArmorIsMultiplier());
|
||||
|
||||
crcForUpgradeType.addInt(attackStrength);
|
||||
crcForUpgradeType.addInt(attackStrengthIsMultiplier);
|
||||
crcForUpgradeType.addInt(getAttackStrength());
|
||||
crcForUpgradeType.addInt(getAttackStrengthIsMultiplier());
|
||||
//std::map<string,int> attackStrengthMultiplierValueList;
|
||||
crcForUpgradeType.addInt64((int64)attackStrengthMultiplierValueList.size());
|
||||
|
||||
crcForUpgradeType.addInt(attackRange);
|
||||
crcForUpgradeType.addInt(attackRangeIsMultiplier);
|
||||
crcForUpgradeType.addInt(getAttackRange());
|
||||
crcForUpgradeType.addInt(getAttackRangeIsMultiplier());
|
||||
//std::map<string,int> attackRangeMultiplierValueList;
|
||||
crcForUpgradeType.addInt64((int64)attackRangeMultiplierValueList.size());
|
||||
|
||||
crcForUpgradeType.addInt(moveSpeed);
|
||||
crcForUpgradeType.addInt(moveSpeedIsMultiplier);
|
||||
crcForUpgradeType.addInt(getMoveSpeed());
|
||||
crcForUpgradeType.addInt(getMoveSpeedIsMultiplier());
|
||||
//std::map<string,int> moveSpeedIsMultiplierValueList;
|
||||
crcForUpgradeType.addInt64((int64)moveSpeedIsMultiplierValueList.size());
|
||||
|
||||
crcForUpgradeType.addInt(prodSpeed);
|
||||
crcForUpgradeType.addInt(prodSpeedIsMultiplier);
|
||||
crcForUpgradeType.addInt(getProdSpeed());
|
||||
crcForUpgradeType.addInt(getProdSpeedIsMultiplier());
|
||||
//std::map<string,int> prodSpeedProduceIsMultiplierValueList;
|
||||
crcForUpgradeType.addInt64((int64)prodSpeedProduceIsMultiplierValueList.size());
|
||||
//std::map<string,int> prodSpeedUpgradeIsMultiplierValueList;
|
||||
|
@ -254,8 +260,8 @@ public:
|
|||
//std::map<string,int> prodSpeedMorphIsMultiplierValueList;
|
||||
crcForUpgradeType.addInt64((int64)prodSpeedMorphIsMultiplierValueList.size());
|
||||
|
||||
crcForUpgradeType.addInt(attackSpeed);
|
||||
crcForUpgradeType.addInt(attackSpeedIsMultiplier);
|
||||
crcForUpgradeType.addInt(getAttackSpeed());
|
||||
crcForUpgradeType.addInt(getAttackSpeedIsMultiplier());
|
||||
|
||||
return crcForUpgradeType;
|
||||
}
|
||||
|
@ -328,6 +334,16 @@ public:
|
|||
* upgrades to a unit with the effects stacking.
|
||||
*/
|
||||
class TotalUpgrade: public UpgradeTypeBase {
|
||||
|
||||
private:
|
||||
|
||||
// List of boosts
|
||||
//const UpgradeTypeBase *ut, const Unit *unit
|
||||
const UpgradeTypeBase *boostUpgradeBase;
|
||||
const Unit *boostUpgradeUnit;
|
||||
std::vector<TotalUpgrade *> boostUpgrades;
|
||||
|
||||
void remove(const UpgradeTypeBase *ut,const Unit *unit);
|
||||
public:
|
||||
TotalUpgrade();
|
||||
virtual ~TotalUpgrade() {}
|
||||
|
@ -373,6 +389,18 @@ public:
|
|||
*/
|
||||
void deapply(const UpgradeTypeBase *ut, const Unit *unit);
|
||||
|
||||
virtual int getMaxHp() const;
|
||||
virtual int getMaxHpRegeneration() const;
|
||||
virtual int getSight() const;
|
||||
virtual int getMaxEp() const;
|
||||
virtual int getMaxEpRegeneration() const;
|
||||
virtual int getArmor() const;
|
||||
virtual int getAttackStrength(const AttackSkillType *st) const;
|
||||
virtual int getAttackRange(const AttackSkillType *st) const;
|
||||
virtual int getMoveSpeed(const MoveSkillType *st) const;
|
||||
virtual int getProdSpeed(const SkillType *st) const;
|
||||
virtual int getAttackSpeed(const AttackSkillType *st) const;
|
||||
|
||||
/**
|
||||
* Creates the XML for the save game file. Essentially just stores everything about its state.
|
||||
* @rootNode The node of the unit that this TotalUpgrade object belongs to.
|
||||
|
|
Loading…
Reference in New Issue