1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Further support for specialities - fixed creature bonuses. Minor fixes.

This commit is contained in:
DjWarmonger 2010-07-15 19:38:15 +00:00
parent 75f9f0c52f
commit 23d2dec3e5
4 changed files with 22 additions and 12 deletions

View File

@ -129,7 +129,7 @@
128 4 3 1 120
128 4 3 2 120
129 4 2 1 113
129 4 1 1 113
129 4 1 2 113
129 4 5 4 113
130 4 1 1 114
130 4 2 1 114
@ -138,7 +138,7 @@
132 4 3 1 120
132 4 3 2 120
133 4 2 1 113
133 4 1 1 113
133 4 1 2 113
133 4 5 4 113
134 4 1 1 114
134 4 2 1 114

View File

@ -416,7 +416,7 @@ void CHeroHandler::loadHeroes()
specialInfo dummy;
si32 hid;
inp.ignore(100, '\n');
for (int i = 0; i < 174; ++i)
for (int i = 0; i < 175; ++i)
{
inp >> hid;
inp >> dummy.type;

View File

@ -766,6 +766,7 @@ CGHeroInstance::CGHeroInstance()
type = NULL;
boat = NULL;
secSkills.push_back(std::make_pair(-1, -1));
speciality.nodeType = CBonusSystemNode::SPECIALITY;
}
void CGHeroInstance::initHero(int SUBID)
@ -1021,7 +1022,7 @@ void CGHeroInstance::initObj()
break;
}
speciality.bonuses.push_back (bonus);
bonus.val = valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, it->subtype) * it->val/100; //TODO: limit range to hero only
bonus.val = valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, it->subtype) * it->val; //TODO: limit range to hero only
speciality.bonuses.push_back(bonus);
break;
case 3://spell damage bonus, level dependant
@ -1035,19 +1036,28 @@ void CGHeroInstance::initObj()
switch (it->subtype)
{
case 1://attack
bonus.type = Bonus::PRIMARY_SKILL;
bonus.subtype = PrimarySkill::ATTACK;
break;
case 2://defense
bonus.type = Bonus::PRIMARY_SKILL;
bonus.subtype = it->subtype;
bonus.subtype = PrimarySkill::DEFENSE;
break;
case 3://damage, TODO: handle it!
bonus.type = Bonus::CREATURE_DAMAGE;
bonus.subtype = 0; //both min and max
break;
case 4://hp
bonus.type = Bonus::STACK_HEALTH;
break;
case 5:
bonus.type = Bonus::STACKS_SPEED;
bonus.subtype = 0;
break;
default:
continue; //TODO: damage, hp
continue;
}
bonus.valType = Bonus::ADDITIVE_VALUE;
bonus.additionalInfo = it->additionalinfo;
bonus.limiter = new CCreatureTypeLimiter (*VLC->creh->creatures[it->additionalinfo], true);
speciality.bonuses.push_back (bonus);
break;
case 5://spell damage bonus in percent
@ -1127,7 +1137,7 @@ void CGHeroInstance::UpdateSpeciality()
{
case Bonus::SECONDARY_SKILL_PREMY:
it->val = (speciality.valOfBonuses(Bonus::SPECIAL_SECONDARY_SKILL, it->subtype) *
valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, it->subtype) * level)/100;
valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, it->subtype) * level); //TODO: use only skills as bonuses
break;
case Bonus::PRIMARY_SKILL: //for crearures, that is
int creLevel = (*creatures)[it->additionalInfo]->level;

View File

@ -155,7 +155,8 @@ namespace PrimarySkill
BONUS_NAME(MAXED_SPELL) /*val = id*/\
BONUS_NAME(SPECIAL_PECULIAR_ENCHANT) /*blesses and curses with id = val dependent on unit's level, subtype = 0 or 1 for Coronius*/\
BONUS_NAME(SPECIAL_UPGRADE) /*val = base, additionalInfo = target */\
BONUS_NAME(DRAGON_NATURE) /*TODO: implement it!*/
BONUS_NAME(DRAGON_NATURE) /*TODO: implement it!*/\
BONUS_NAME(CREATURE_DAMAGE)/*subtype 0 = both, 1 = min, 2 = max*/
struct DLL_EXPORT Bonus
{
@ -373,7 +374,7 @@ public:
enum ENodeTypes
{
UNKNOWN, STACK
UNKNOWN, STACK, SPECIALITY
};
};
@ -473,7 +474,6 @@ public:
h & creature & includeUpgrades;
}
};
namespace Selector
{
extern DLL_EXPORT CSelectFieldEqual<TBonusType> type;