mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
Various fixes.
This commit is contained in:
parent
96d198758c
commit
9c9301a495
@ -781,10 +781,10 @@ void CArtHandler::addBonuses()
|
||||
giveArtBonus(142, Bonus::CATAPULT, 0);
|
||||
giveArtBonus(142, Bonus::ACID_BREATH, 20);
|
||||
giveArtBonus(142, Bonus::SHOTS, 200, 0, Bonus::PERCENT_TO_BASE);
|
||||
giveArtBonus(142, Bonus::SPELL_BEFORE_ATTACK, 1, Spells::AGE, NULL, 50);
|
||||
giveArtBonus(142, Bonus::SPELL_AFTER_ATTACK, 1, Spells::BERSERK, NULL, 50);
|
||||
giveArtBonus(142, Bonus::SPELL_AFTER_ATTACK, 1, Spells::POISON, NULL, 50);
|
||||
giveArtBonus(142, Bonus::SPELL_AFTER_ATTACK, 1, Spells::DISRUPTING_RAY, NULL, 50);
|
||||
giveArtBonus(142, Bonus::SPELL_BEFORE_ATTACK, 50, Spells::AGE, NULL, 1);
|
||||
giveArtBonus(142, Bonus::SPELL_AFTER_ATTACK, 50, Spells::BERSERK, NULL, 1);
|
||||
giveArtBonus(142, Bonus::SPELL_AFTER_ATTACK, 50, Spells::POISON, NULL, 1);
|
||||
giveArtBonus(142, Bonus::SPELL_AFTER_ATTACK, 50, Spells::DISRUPTING_RAY, NULL, 1);
|
||||
artifacts[142].get()->setDescription ("Tripple shots, tripple attack, casts various spells during attack, attacks have range of Inferno, no distance penalty, catapult");
|
||||
//Monster's Power
|
||||
giveArtBonus(143, Bonus::STACK_HEALTH, +100, -1, Bonus::PERCENT_TO_BASE);
|
||||
|
@ -191,9 +191,9 @@ bool CCreatureHandler::isEvil (si8 faction) const
|
||||
{
|
||||
return faction != -1 && factionAlignments[faction] == -1;
|
||||
}
|
||||
static Bonus ParseBonus (const JsonVector &ability_vec) //TODO: merge with AddAbility, create universal parser for all bonus properties
|
||||
static Bonus * ParseBonus (const JsonVector &ability_vec) //TODO: merge with AddAbility, create universal parser for all bonus properties
|
||||
{
|
||||
Bonus b;
|
||||
Bonus * b = new Bonus();
|
||||
std::string type = ability_vec[0].String();
|
||||
auto it = bonusNameMap.find(type);
|
||||
if (it == bonusNameMap.end())
|
||||
@ -201,12 +201,12 @@ static Bonus ParseBonus (const JsonVector &ability_vec) //TODO: merge with AddAb
|
||||
tlog1 << "Error: invalid ability type " << type << " in creatures.txt" << std::endl;
|
||||
return b;
|
||||
}
|
||||
b.type = it->second;
|
||||
b.val = ability_vec[1].Float();
|
||||
b.subtype = ability_vec[2].Float();
|
||||
b.additionalInfo = ability_vec[3].Float();
|
||||
b.duration = Bonus::PERMANENT;
|
||||
b.turnsRemain = 0;
|
||||
b->type = it->second;
|
||||
b->val = ability_vec[1].Float();
|
||||
b->subtype = ability_vec[2].Float();
|
||||
b->additionalInfo = ability_vec[3].Float();
|
||||
b->duration = Bonus::PERMANENT;
|
||||
b->turnsRemain = 0;
|
||||
return b;
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ void CCreatureHandler::loadCreatures()
|
||||
}
|
||||
BOOST_FOREACH (auto bonus, config3["bonusPerLevel"].Vector())
|
||||
{
|
||||
commanderLevelPremy.push_back(&ParseBonus (bonus.Vector()));
|
||||
commanderLevelPremy.push_back(ParseBonus (bonus.Vector()));
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@ -632,7 +632,7 @@ void CCreatureHandler::loadCreatures()
|
||||
BOOST_FOREACH (auto ability, config3["abilityRequirements"].Vector())
|
||||
{
|
||||
std::pair <Bonus, std::pair <ui8, ui8> > a;
|
||||
a.first = ParseBonus (ability["ability"].Vector());
|
||||
a.first = *ParseBonus (ability["ability"].Vector());
|
||||
a.second.first = ability["skills"].Vector()[0].Float();
|
||||
a.second.second = ability["skills"].Vector()[1].Float();
|
||||
skillRequirements.push_back (a);
|
||||
|
@ -654,13 +654,13 @@ void CBonusSystemNode::addNewBonus(Bonus *b)
|
||||
CBonusSystemNode::treeChanged++;
|
||||
}
|
||||
|
||||
void CBonusSystemNode::accumulateBonus(Bonus *b)
|
||||
void CBonusSystemNode::accumulateBonus(Bonus &b)
|
||||
{
|
||||
Bonus *bonus = bonuses.getFirst(Selector::typeSubtype(b->type, b->subtype)); //only local bonuses are interesting //TODO: what about value type?
|
||||
Bonus *bonus = bonuses.getFirst(Selector::typeSubtype(b.type, b.subtype)); //only local bonuses are interesting //TODO: what about value type?
|
||||
if(bonus)
|
||||
bonus += b->val;
|
||||
bonus += b.val;
|
||||
else
|
||||
addNewBonus(b);
|
||||
addNewBonus(new Bonus(b)); //duplicate needed, original may get destroyed
|
||||
}
|
||||
|
||||
void CBonusSystemNode::removeBonus(Bonus *b)
|
||||
|
@ -563,7 +563,7 @@ public:
|
||||
void detachFrom(CBonusSystemNode *parent);
|
||||
void detachFromAll();
|
||||
void addNewBonus(Bonus *b); //b will be deleted with destruction of node
|
||||
void accumulateBonus(Bonus *b); //add value of bonus with same type/subtype or create new
|
||||
void accumulateBonus(Bonus &b); //add value of bonus with same type/subtype or create new
|
||||
|
||||
void newChildAttached(CBonusSystemNode *child);
|
||||
void childDetached(CBonusSystemNode *child);
|
||||
|
Loading…
x
Reference in New Issue
Block a user