1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

General tweaking of specialities for general consistency.

Values now grow with level. Warning: they affect entire hero himself, not the specific type of creature.
This commit is contained in:
DjWarmonger
2010-07-08 19:10:26 +00:00
parent 94f7ee41e2
commit 24b47ce006
6 changed files with 208 additions and 149 deletions

View File

@@ -1,149 +1,149 @@
Hero ID Bonus Type Val Subtype Additional Info "Hero ID" "Bonus Type" "Val" "Subtype" "Additional Info"
0 2 1 0 5 0 2 5 1 0
1 1 2 0 0 1 1 0 0 2
2 1 4 0 0 2 1 0 0 4
3 2 5 1 2 3 2 2 5 1
4 2 13 0 5 4 2 5 13 0
5 1 6 0 0 5 1 0 0 6
6 1 146 0 0 6 1 0 0 146
7 1 10 0 0 7 1 0 0 10
8 2 27 0 5 8 2 5 27 0
9 6 41 0 3 9 6 41 0 3
10 8 45 0 0 10 8 45 0 0
11 3 20 0 3 11 3 20 0 3
12 1 8 0 0 12 1 0 0 8
13 2 11 0 5 13 2 5 11 0
14 8 48 0 0 14 8 48 0 0
15 10 350 6 0 15 10 350 6 0
16 2 23 0 5 16 2 5 23 0
17 1 16 0 0 17 1 0 0 16
18 10 350 6 0 18 10 350 6 0
19 1 22 0 0 19 1 0 0 22
20 2 26 0 5 20 2 5 26 0
21 1 18 0 0 21 1 0 0 18
22 1 24 0 0 22 1 0 0 24
23 2 2 0 5 23 2 5 2 0
24 8 55 1 0 24 8 55 1 0
25 3 37 0 3 25 3 37 0 3
26 2 24 0 5 26 2 5 24 0
27 2 27 0 5 27 2 5 27 0
28 2 11 0 5 28 2 5 11 0
29 7 51 0 0 29 7 51 0 0
30 3 16 0 3 30 3 16 0 3
31 1 20 0 0 31 1 0 0 20
32 1 30 0 0 32 1 0 0 30
33 1 36 0 0 33 1 0 0 36
34 1 32 0 0 34 1 0 0 32
35 2 23 0 5 35 2 5 23 0
36 1 146 0 0 36 1 0 0 146
37 1 38 0 0 37 1 0 0 38
38 10 1 1 0 38 10 1 1 0
39 1 36 0 0 39 1 0 0 36
40 3 60 0 3 40 3 60 0 3
41 2 8 1 5 41 2 5 8 1
42 2 11 0 5 42 2 5 11 0
43 7 51 0 0 43 7 51 0 0
44 1 34 0 0 44 1 0 0 34
45 3 19 0 3 45 3 19 0 3
46 8 53 0 0 46 8 53 0 0
47 10 350 6 0 47 10 350 6 0
48 1 46 0 0 48 1 0 0 46
49 1 52 0 0 49 1 0 0 52
50 1 48 0 0 50 1 0 0 48
51 1 42 0 0 51 1 0 0 42
52 10 350 6 0 52 10 350 6 0
53 1 42 0 0 53 1 0 0 42
54 1 146 0 0 54 1 0 0 146
55 1 50 0 0 55 1 0 0 50
56 2 24 0 5 56 2 5 24 0
57 3 22 0 3 57 3 22 0 3
58 2 8 1 5 58 2 5 8 1
59 8 45 0 0 59 8 45 0 0
60 10 1 3 0 60 10 1 3 0
61 8 43 0 0 61 8 43 0 0
62 2 25 0 5 62 2 5 25 0
63 3 21 0 3 63 3 21 0 3
64 1 58 0 0 64 1 0 0 58
65 1 62 0 0 65 1 0 0 62
66 1 64 0 0 66 1 0 0 64
67 1 60 0 0 67 1 0 0 60
68 1 66 0 0 68 1 0 0 66
69 2 12 0 5 69 2 5 12 0
70 10 350 6 0 70 10 350 6 0
71 1 56 0 0 71 1 0 0 56
72 3 24 0 3 72 3 24 0 3
73 3 23 0 3 73 3 23 0 3
74 2 25 0 5 74 2 5 25 0
75 2 11 1 5 75 2 5 11 1
76 3 39 0 3 76 3 39 0 3
77 8 46 0 0 77 8 46 0 0
78 2 12 0 5 78 2 5 12 0
79 10 350 6 0 79 10 350 6 0
80 1 72 0 0 80 1 0 0 72
81 1 146 0 0 81 1 0 0 146
82 1 78 0 0 82 1 0 0 78
83 1 74 0 0 83 1 0 0 74
84 10 350 6 0 84 10 350 6 0
85 2 2 0 5 85 2 5 2 0
86 1 80 0 0 86 1 0 0 80
87 1 70 0 0 87 1 0 0 70
88 3 38 0 3 88 3 38 0 3
89 2 8 1 5 89 2 5 8 1
90 2 25 0 5 90 2 5 25 0
91 3 38 0 3 91 3 38 0 3
92 2 11 1 5 92 2 5 11 1
93 3 23 0 3 93 3 23 0 3
94 10 1 4 0 94 10 1 4 0
95 8 46 0 0 95 8 46 0 0
96 1 94 0 0 96 1 0 0 94
97 1 146 0 0 97 1 0 0 146
98 1 88 0 0 98 1 0 0 88
99 1 92 0 0 99 1 0 0 92
101 1 84 0 0 101 1 0 0 84
102 1 90 0 0 102 1 0 0 90
103 2 22 0 5 103 2 5 22 0
104 1 86 0 0 104 1 0 0 86
105 2 25 0 5 105 2 5 25 0
106 1 90 0 0 106 1 0 0 90
107 2 2 0 5 107 2 5 2 0
108 8 53 0 0 108 8 53 0 0
109 8 44 0 0 109 8 44 0 0
110 2 25 0 5 110 2 5 25 0
111 2 11 1 5 111 2 5 11 1
112 10 1 5 0 112 10 1 5 0
113 1 106 0 0 113 1 0 0 106
114 1 98 0 0 114 1 0 0 98
115 1 100 0 0 115 1 0 0 100
116 2 23 0 5 116 2 5 23 0
117 1 102 0 0 117 1 0 0 102
118 1 104 0 0 118 1 0 0 104
119 1 146 0 0 119 1 0 0 146
120 1 108 0 0 120 1 0 0 108
121 2 8 1 5 121 2 5 8 1
122 2 5 1 2 122 2 2 5 1
123 2 27 0 5 123 2 5 27 1
124 8 46 0 0 124 8 46 0 0
125 2 25 0 5 125 2 5 25 0
126 2 24 0 5 126 2 5 24 0
127 2 11 1 5 127 2 5 11 1
128 4 120 1 3 128 4 3 1 120
128 4 120 2 3 128 4 3 2 120
129 4 113 1 2 129 4 2 1 113
129 4 113 1 1 129 4 1 1 113
129 4 113 4 5 129 4 5 4 113
130 4 114 1 1 130 4 1 1 114
130 4 114 1 2 130 4 2 1 114
130 4 114 3 2 130 4 2 3 114
131 4 115 1 2 131 4 2 1 115
132 4 120 1 3 132 4 3 1 120
132 4 120 2 3 132 4 3 2 120
133 4 113 1 2 133 4 2 1 113
133 4 113 1 1 133 4 1 1 113
133 4 113 4 5 133 4 5 4 113
134 4 114 1 1 134 4 1 1 114
134 4 114 1 2 134 4 2 1 114
134 4 114 3 2 134 4 2 3 114
135 4 115 1 2 135 4 2 1 115
136 5 13 0 100 136 5 13 0 100
137 8 53 0 0 137 8 53 0 0
138 5 15 0 50 138 5 15 0 50
@@ -154,23 +154,23 @@ Hero ID Bonus Type Val Subtype Additional Info
143 10 350 6 0 143 10 350 6 0
144 12 2 0 0 144 12 2 0 0
145 11 14 0 0 145 11 14 0 0
146 1 4 0 0 146 1 0 0 4
147 9 8 0 136 147 9 8 0 136
147 9 34 0 136 147 9 34 0 136
148 9 2 0 137 148 9 2 0 137
148 9 18 0 137 148 9 18 0 137
149 4 96 1 5 149 4 5 1 96
149 4 96 2 5 149 4 5 2 96
149 4 96 3 10 149 4 10 3 96
150 4 66 1 5 150 4 5 1 66
150 4 66 2 5 150 4 5 2 66
150 4 66 3 10 150 4 10 3 66
151 13 1 1 5 151 13 1 1 5
151 13 1 2 5 151 13 1 2 5
152 1 4 0 0 152 1 0 0 4
153 13 1 1 5 153 13 1 1 5
153 13 1 1 5 153 13 1 1 5
154 1 90 0 0 154 1 0 0 90
155 4 54 1 4 155 4 4 1 54
155 4 54 2 2 155 4 2 2 54
155 4 54 5 1 155 4 1 5 54

View File

@@ -946,43 +946,48 @@ void CGHeroInstance::initObj()
{ {
case 1:// creature speciality case 1:// creature speciality
{ {
bonus.type = Bonus::SPECIAL_CREATURE_LEV; // general info to indicate type of growing bonus
bonus.additionalInfo = it->additionalinfo; //base creature ID
speciality.bonuses.push_back (bonus);
std::vector<CCreature*>* creatures = &VLC->creh->creatures; std::vector<CCreature*>* creatures = &VLC->creh->creatures;
int creLevel = (*creatures)[it->val]->level; int creLevel = (*creatures)[it->additionalinfo]->level;
if(!creLevel) if(!creLevel) //TODO: set fixed level for War Machines
{ {
if(it->val == 146) if(it->additionalinfo == 146)
creLevel = 5; //treat ballista as 5-level creLevel = 5; //treat ballista as 5-level
else else
{ {
tlog2 << "Warning: unknown level of " << (*creatures)[it->val]->namePl << std::endl; tlog2 << "Warning: unknown level of " << (*creatures)[it->additionalinfo]->namePl << std::endl;
continue; continue;
} }
} }
speciality.growthsWithLevel = true; speciality.growthsWithLevel = true;
bonus.type = Bonus::SPECIAL_CREATURE; bonus.type = Bonus::PRIMARY_SKILL; //TODO: limit to specific creature type
bonus.valType = Bonus::ADDITIVE_VALUE; bonus.valType = Bonus::ADDITIVE_VALUE;
bonus.subtype = 1; //attack bonus.subtype = 1; //attack
bonus.additionalInfo = level/creLevel * (*creatures)[it->val]->attack; bonus.val = level * (*creatures)[it->additionalinfo]->attack / (*creatures)[it->additionalinfo]->level /20;
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
bonus.subtype = 2; //defense bonus.subtype = 2; //defense
bonus.additionalInfo = level/creLevel * (*creatures)[it->val]->defence; bonus.val = level * (*creatures)[it->additionalinfo]->defence / (*creatures)[it->additionalinfo]->level /20;
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
bonus.subtype = 5; bonus.type = Bonus::STACKS_SPEED;
bonus.additionalInfo = 1; //+1 speed bonus.val = 1; //+1 speed
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
for (std::set<ui32>::iterator i = (*creatures)[it->val]->upgrades.begin(); for (std::set<ui32>::iterator i = (*creatures)[it->additionalinfo]->upgrades.begin();
i != VLC->creh->creatures[it->val]->upgrades.end(); i++) i != VLC->creh->creatures[it->additionalinfo]->upgrades.end(); i++)
{ {
bonus.val = *i; // for all direct upgrades of that creature bonus.val = (*i); // for all direct upgrades of that creature
bonus.type = Bonus::PRIMARY_SKILL;
bonus.subtype = 1; //attack bonus.subtype = 1; //attack
bonus.additionalInfo = level/(*creatures)[*i]->level * (*creatures)[*i]->attack; bonus.val = level * (*creatures)[*i]->attack / (*creatures)[*i]->level /20;
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
bonus.subtype = 2; //defense bonus.subtype = 2; //defense
bonus.additionalInfo = level/(*creatures)[*i]->level * (*creatures)[*i]->defence; bonus.val = level * (*creatures)[*i]->defence / (*creatures)[*i]->level /20;
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
bonus.subtype = 5; bonus.type = Bonus::STACKS_SPEED;
bonus.additionalInfo = 1; //+1 speed bonus.val = 1; //+1 speed
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
} }
} }
@@ -1002,6 +1007,8 @@ void CGHeroInstance::initObj()
break; break;
} }
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
bonus.val = valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, it->subtype) * it->val/100; //TODO: limit range to hero only
speciality.bonuses.push_back(bonus);
break; break;
case 3://spell damage bonus, level dependant case 3://spell damage bonus, level dependant
speciality.growthsWithLevel = true; speciality.growthsWithLevel = true;
@@ -1011,9 +1018,21 @@ void CGHeroInstance::initObj()
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
break; break;
case 4://creature stat boost case 4://creature stat boost
bonus.type = Bonus::SPECIAL_CREATURE; switch (it->subtype)
{
case 1://attack
case 2://defense
bonus.type = Bonus::PRIMARY_SKILL;
bonus.subtype = it->subtype;
break;
case 5:
bonus.type = Bonus::STACKS_SPEED;
bonus.subtype = 0;
break;
default:
continue; //TODO: damage, hp
}
bonus.valType = Bonus::ADDITIVE_VALUE; bonus.valType = Bonus::ADDITIVE_VALUE;
bonus.subtype = it->subtype;
bonus.additionalInfo = it->additionalinfo; bonus.additionalInfo = it->additionalinfo;
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
break; break;
@@ -1064,15 +1083,15 @@ void CGHeroInstance::initObj()
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
break; break;
case 13://Dragon bonuses (Mutare) case 13://Dragon bonuses (Mutare)
bonus.type = Bonus::SPECIAL_CREATURE; bonus.type = Bonus::PRIMARY_SKILL;
bonus.valType = Bonus::ADDITIVE_VALUE; bonus.valType = Bonus::ADDITIVE_VALUE;
bonus.additionalInfo = it->additionalinfo; //value bonus.additionalInfo = it->additionalinfo; //id
bonus.subtype = it->subtype; //which stat it is bonus.subtype = it->subtype; //which stat it is
for (std::vector<CCreature*>::iterator i = VLC->creh->creatures.begin(); i != VLC->creh->creatures.end(); i++) for (std::vector<CCreature*>::iterator i = VLC->creh->creatures.begin(); i != VLC->creh->creatures.end(); i++)
{ //TODO: what if creature changes type during the game (Dragon Eye Ring?) { //TODO: what if creature changes type during the game (Dragon Eye Ring?)
if ((*i)->hasBonusOfType(Bonus::DRAGON_NATURE)) //TODO: implement it! if ((*i)->hasBonusOfType(Bonus::DRAGON_NATURE)) //TODO: implement it!
{ {
bonus.val = (*i)->idNumber; //for each Dragon separately bonus.additionalInfo = (*i)->idNumber; //for each Dragon separately
speciality.bonuses.push_back (bonus); speciality.bonuses.push_back (bonus);
} }
} }
@@ -1081,10 +1100,7 @@ void CGHeroInstance::initObj()
tlog2 << "Unexpected hero speciality " << type <<'\n'; tlog2 << "Unexpected hero speciality " << type <<'\n';
} }
} }
if (speciality.growthsWithLevel)
speciality.recalculateSpecials();
} }
void CGHeroInstance::setPropertyDer( ui8 what, ui32 val ) void CGHeroInstance::setPropertyDer( ui8 what, ui32 val )
{ {
if(what == ObjProperty::PRIMARY_STACK_COUNT) if(what == ObjProperty::PRIMARY_STACK_COUNT)

View File

@@ -46,9 +46,9 @@ struct TerrainTile;
struct InfoWindow; struct InfoWindow;
struct Component; struct Component;
struct BankConfig; struct BankConfig;
struct UpdateHeroSpeciality;
class CGBoat; class CGBoat;
class DLL_EXPORT CCastleEvent class DLL_EXPORT CCastleEvent
{ {
public: public:
@@ -305,7 +305,6 @@ public:
struct DLL_EXPORT HeroSpecial : CBonusSystemNode struct DLL_EXPORT HeroSpecial : CBonusSystemNode
{ {
bool growthsWithLevel; bool growthsWithLevel;
void recalculateSpecials(){};
template <typename Handler> void serialize(Handler &h, const int version) template <typename Handler> void serialize(Handler &h, const int version)
{ {
h & static_cast<CBonusSystemNode&>(*this); h & static_cast<CBonusSystemNode&>(*this);

View File

@@ -151,7 +151,6 @@ namespace PrimarySkill
BONUS_NAME(SPECIAL_CREATURE_LEV) /*val = base id*/ \ BONUS_NAME(SPECIAL_CREATURE_LEV) /*val = base id*/ \
BONUS_NAME(SPECIAL_SECONDARY_SKILL) /*val = id, additionalInfo = value per level in percent*/ \ BONUS_NAME(SPECIAL_SECONDARY_SKILL) /*val = id, additionalInfo = value per level in percent*/ \
BONUS_NAME(SPECIAL_SPELL_LEV) /*val = id, additionalInfo = value per level in percent*/\ BONUS_NAME(SPECIAL_SPELL_LEV) /*val = id, additionalInfo = value per level in percent*/\
BONUS_NAME(SPECIAL_CREATURE) /*val = base id, subtype = stat, additionalInfo = value*/\
BONUS_NAME(SPECIFIC_SPELL_DAMAGE) /*val = id of spell, additionalInfo = value*/\ BONUS_NAME(SPECIFIC_SPELL_DAMAGE) /*val = id of spell, additionalInfo = value*/\
BONUS_NAME(SPECIAL_BLESS_DAMAGE) /*val = spell (bless), additionalInfo = value per level in percent*/\ BONUS_NAME(SPECIAL_BLESS_DAMAGE) /*val = spell (bless), additionalInfo = value per level in percent*/\
BONUS_NAME(MAXED_SPELL) /*val = id*/\ BONUS_NAME(MAXED_SPELL) /*val = id*/\
@@ -295,6 +294,14 @@ struct DLL_EXPORT Bonus
{ {
return type == cf; return type == cf;
} }
inline void ChangeBonusVal (const ui32 newVal)
{
val = newVal;
}
inline void operator += (const ui32 Val) //no return
{
val += Val;
}
const CSpell * sourceSpell() const; const CSpell * sourceSpell() const;
std::string Description() const; std::string Description() const;

View File

@@ -1204,7 +1204,6 @@ struct AdvmapSpellCast : public CPackForClient //108
} }
}; };
/***********************************************************************************************************/ /***********************************************************************************************************/
struct CloseServer : public CPackForServer struct CloseServer : public CPackForServer

View File

@@ -700,7 +700,45 @@ DLL_EXPORT void SetHoverName::applyGs( CGameState *gs )
DLL_EXPORT void HeroLevelUp::applyGs( CGameState *gs ) DLL_EXPORT void HeroLevelUp::applyGs( CGameState *gs )
{ {
gs->getHero(heroid)->level = level; CGHeroInstance* h = gs->getHero(heroid);
h->level = level;
//speciality
if (h->speciality.growthsWithLevel)
{
std::vector<CCreature*>* creatures = &VLC->creh->creatures;
for (std::list<Bonus>::iterator it = h->speciality.bonuses.begin(); it != h->speciality.bonuses.end(); it++)
{
switch (it->type)
{
case Bonus::SECONDARY_SKILL_PREMY:
it->val = (h->speciality.valOfBonuses(Bonus::SPECIAL_SECONDARY_SKILL, it->subtype) *
h->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY,it->subtype) * h->level)/100;
break;
case Bonus::PRIMARY_SKILL:
int creLevel = (*creatures)[it->additionalInfo]->level;
if(!creLevel)
{
if(it->additionalInfo == 146)
creLevel = 5; //treat ballista as 5-level
else
{
tlog2 << "Warning: unknown level of " << (*creatures)[it->val]->namePl << std::endl;
continue;
}
}
switch (it->subtype)
{
case 1:
it->val = (level * (*creatures)[it->additionalInfo]->attack)/creLevel /20;
break;
case 2:
it->val = (level * (*creatures)[it->additionalInfo]->defence)/creLevel /20;
break;
}
break;
}
}
}
} }
DLL_EXPORT void BattleStart::applyGs( CGameState *gs ) DLL_EXPORT void BattleStart::applyGs( CGameState *gs )