mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 23:45:14 +02:00
- make most of the attack boost xml settings optional instead of required as requested
This commit is contained in:
@@ -288,13 +288,19 @@ void SkillType::loadAttackBoost(const XmlNode *attackBoostsNode, const XmlNode *
|
|||||||
attackBoost.name = "attack-boost-autoname-" + intToStr(getNextAttackBoostId());
|
attackBoost.name = "attack-boost-autoname-" + intToStr(getNextAttackBoostId());
|
||||||
}
|
}
|
||||||
string targetType = attackBoostNode->getChild("target")->getAttribute("value")->getValue();
|
string targetType = attackBoostNode->getChild("target")->getAttribute("value")->getValue();
|
||||||
attackBoost.allowMultipleBoosts = attackBoostNode->getChild("allow-multiple-boosts")->getAttribute("value")->getBoolValue();
|
|
||||||
attackBoost.radius = attackBoostNode->getChild("radius")->getAttribute("value")->getIntValue();
|
|
||||||
attackBoost.includeSelf = false;
|
|
||||||
|
|
||||||
|
attackBoost.allowMultipleBoosts = false;
|
||||||
|
if(attackBoostNode->hasChild("allow-multiple-boosts") == true) {
|
||||||
|
attackBoost.allowMultipleBoosts = attackBoostNode->getChild("allow-multiple-boosts")->getAttribute("value")->getBoolValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
attackBoost.radius = attackBoostNode->getChild("radius")->getAttribute("value")->getIntValue();
|
||||||
|
|
||||||
|
attackBoost.includeSelf = false;
|
||||||
if(attackBoostNode->getChild("target")->hasAttribute("include-self") == true) {
|
if(attackBoostNode->getChild("target")->hasAttribute("include-self") == true) {
|
||||||
attackBoost.includeSelf = attackBoostNode->getChild("target")->getAttribute("include-self")->getBoolValue();
|
attackBoost.includeSelf = attackBoostNode->getChild("target")->getAttribute("include-self")->getBoolValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(targetType == "ally") {
|
if(targetType == "ally") {
|
||||||
attackBoost.targetType = abtAlly;
|
attackBoost.targetType = abtAlly;
|
||||||
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
|
||||||
|
@@ -45,82 +45,126 @@ void UpgradeTypeBase::load(const XmlNode *upgradeNode, string upgradename) {
|
|||||||
this->upgradename = upgradename;
|
this->upgradename = upgradename;
|
||||||
//values
|
//values
|
||||||
maxHpIsMultiplier = false;
|
maxHpIsMultiplier = false;
|
||||||
maxHp= upgradeNode->getChild("max-hp")->getAttribute("value")->getIntValue();
|
if(upgradeNode->hasChild("max-hp") == true) {
|
||||||
|
maxHp = upgradeNode->getChild("max-hp")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("max-hp")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("max-hp")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
maxHpIsMultiplier = upgradeNode->getChild("max-hp")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
maxHpIsMultiplier = upgradeNode->getChild("max-hp")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found maxHpIsMultiplier = %d\n",maxHpIsMultiplier);
|
//printf("Found maxHpIsMultiplier = %d\n",maxHpIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
maxHp = 0;
|
||||||
|
}
|
||||||
maxHpRegeneration = 0;
|
maxHpRegeneration = 0;
|
||||||
//maxHpRegenerationIsMultiplier = false;
|
//maxHpRegenerationIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("max-hp") == true) {
|
||||||
if(upgradeNode->getChild("max-hp")->getAttribute(VALUE_REGEN_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("max-hp")->getAttribute(VALUE_REGEN_KEY_NAME,false) != NULL) {
|
||||||
maxHpRegeneration = upgradeNode->getChild("max-hp")->getAttribute(VALUE_REGEN_KEY_NAME)->getIntValue();
|
maxHpRegeneration = upgradeNode->getChild("max-hp")->getAttribute(VALUE_REGEN_KEY_NAME)->getIntValue();
|
||||||
|
|
||||||
//printf("Found maxHpIsMultiplier = %d\n",maxHpIsMultiplier);
|
//printf("Found maxHpIsMultiplier = %d\n",maxHpIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
maxEpIsMultiplier = false;
|
maxEpIsMultiplier = false;
|
||||||
maxEp= upgradeNode->getChild("max-ep")->getAttribute("value")->getIntValue();
|
if(upgradeNode->hasChild("max-ep") == true) {
|
||||||
|
maxEp = upgradeNode->getChild("max-ep")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("max-ep")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("max-ep")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
maxEpIsMultiplier = upgradeNode->getChild("max-ep")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
maxEpIsMultiplier = upgradeNode->getChild("max-ep")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found maxEpIsMultiplier = %d\n",maxEpIsMultiplier);
|
//printf("Found maxEpIsMultiplier = %d\n",maxEpIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
maxEp = 0;
|
||||||
|
}
|
||||||
maxEpRegeneration = 0;
|
maxEpRegeneration = 0;
|
||||||
//maxEpRegenerationIsMultiplier = false;
|
//maxEpRegenerationIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("max-ep") == true) {
|
||||||
if(upgradeNode->getChild("max-ep")->getAttribute(VALUE_REGEN_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("max-ep")->getAttribute(VALUE_REGEN_KEY_NAME,false) != NULL) {
|
||||||
maxEpRegeneration = upgradeNode->getChild("max-ep")->getAttribute(VALUE_REGEN_KEY_NAME)->getIntValue();
|
maxEpRegeneration = upgradeNode->getChild("max-ep")->getAttribute(VALUE_REGEN_KEY_NAME)->getIntValue();
|
||||||
|
|
||||||
//printf("Found maxHpIsMultiplier = %d\n",maxHpIsMultiplier);
|
//printf("Found maxHpIsMultiplier = %d\n",maxHpIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sightIsMultiplier = false;
|
sightIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("sight") == true) {
|
||||||
sight= upgradeNode->getChild("sight")->getAttribute("value")->getIntValue();
|
sight= upgradeNode->getChild("sight")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("sight")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("sight")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
sightIsMultiplier = upgradeNode->getChild("sight")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
sightIsMultiplier = upgradeNode->getChild("sight")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found sightIsMultiplier = %d\n",sightIsMultiplier);
|
//printf("Found sightIsMultiplier = %d\n",sightIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
attackStrengthIsMultiplier = false;
|
attackStrengthIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("attack-strenght") == true) {
|
||||||
attackStrength= upgradeNode->getChild("attack-strenght")->getAttribute("value")->getIntValue();
|
attackStrength= upgradeNode->getChild("attack-strenght")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("attack-strenght")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("attack-strenght")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
attackStrengthIsMultiplier = upgradeNode->getChild("attack-strenght")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
attackStrengthIsMultiplier = upgradeNode->getChild("attack-strenght")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found attackStrengthIsMultiplier = %d\n",attackStrengthIsMultiplier);
|
//printf("Found attackStrengthIsMultiplier = %d\n",attackStrengthIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attackStrength = 0;
|
||||||
|
}
|
||||||
|
|
||||||
attackRangeIsMultiplier = false;
|
attackRangeIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("attack-range") == true) {
|
||||||
attackRange= upgradeNode->getChild("attack-range")->getAttribute("value")->getIntValue();
|
attackRange= upgradeNode->getChild("attack-range")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("attack-range")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("attack-range")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
attackRangeIsMultiplier = upgradeNode->getChild("attack-range")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
attackRangeIsMultiplier = upgradeNode->getChild("attack-range")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found attackRangeIsMultiplier = %d\n",attackRangeIsMultiplier);
|
//printf("Found attackRangeIsMultiplier = %d\n",attackRangeIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attackRange = 0;
|
||||||
|
}
|
||||||
|
|
||||||
armorIsMultiplier = false;
|
armorIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("armor") == true) {
|
||||||
armor= upgradeNode->getChild("armor")->getAttribute("value")->getIntValue();
|
armor= upgradeNode->getChild("armor")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("armor")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("armor")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
armorIsMultiplier = upgradeNode->getChild("armor")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
armorIsMultiplier = upgradeNode->getChild("armor")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found armorIsMultiplier = %d\n",armorIsMultiplier);
|
//printf("Found armorIsMultiplier = %d\n",armorIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
armor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
moveSpeedIsMultiplier = false;
|
moveSpeedIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("move-speed") == true) {
|
||||||
moveSpeed= upgradeNode->getChild("move-speed")->getAttribute("value")->getIntValue();
|
moveSpeed= upgradeNode->getChild("move-speed")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("move-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("move-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
moveSpeedIsMultiplier = upgradeNode->getChild("move-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
moveSpeedIsMultiplier = upgradeNode->getChild("move-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found moveSpeedIsMultiplier = %d\n",moveSpeedIsMultiplier);
|
//printf("Found moveSpeedIsMultiplier = %d\n",moveSpeedIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
moveSpeed= 0;
|
||||||
|
}
|
||||||
|
|
||||||
prodSpeedIsMultiplier = false;
|
prodSpeedIsMultiplier = false;
|
||||||
|
if(upgradeNode->hasChild("production-speed") == true) {
|
||||||
prodSpeed= upgradeNode->getChild("production-speed")->getAttribute("value")->getIntValue();
|
prodSpeed= upgradeNode->getChild("production-speed")->getAttribute("value")->getIntValue();
|
||||||
if(upgradeNode->getChild("production-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
if(upgradeNode->getChild("production-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME,false) != NULL) {
|
||||||
prodSpeedIsMultiplier = upgradeNode->getChild("production-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
prodSpeedIsMultiplier = upgradeNode->getChild("production-speed")->getAttribute(VALUE_PERCENT_MULTIPLIER_KEY_NAME)->getBoolValue();
|
||||||
|
|
||||||
//printf("Found prodSpeedIsMultiplier = %d\n",prodSpeedIsMultiplier);
|
//printf("Found prodSpeedIsMultiplier = %d\n",prodSpeedIsMultiplier);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
prodSpeed = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int UpgradeTypeBase::getAttackStrength(const AttackSkillType *st) const {
|
int UpgradeTypeBase::getAttackStrength(const AttackSkillType *st) const {
|
||||||
|
Reference in New Issue
Block a user