1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

* bug 97 fixed

* better handling of BLOCK_SPELLS_ABOVE_LEVEL bonus
This commit is contained in:
mateuszb
2011-02-21 13:27:31 +00:00
parent d36f8087aa
commit 43468e16e1
4 changed files with 23 additions and 22 deletions

View File

@ -629,8 +629,8 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
int spell = mySpell;
owner->fexitb();
owner->myInt->battleInt->castThisSpell(spell);
break;
}
break;
case SpellCasting::ANOTHER_ELEMENTAL_SUMMONED:
{
std::string text = CGI->generaltexth->allTexts[538], summoner, elemental, caster;
@ -657,6 +657,14 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
owner->myInt->showInfoDialog(text);
}
break;
case SpellCasting::SPELL_LEVEL_LIMIT_EXCEEDED:
{
std::string text = CGI->generaltexth->allTexts[541], caster = owner->myHero->name;
text = boost::str(boost::format(text) % caster);
owner->myInt->showInfoDialog(text);
}
break;
}
}
else if(!sp->combatSpell && !owner->myInt->battleInt) //adventure spell

View File

@ -1171,29 +1171,16 @@ const CGHeroInstance * BattleInfo::battleGetOwner(const CStack * stack) const
si8 BattleInfo::battleMaxSpellLevel() const
{
// if(!curB) //there is not battle
// {
// tlog1 << "si8 CGameState::maxSpellLevel() call when there is no battle!" << std::endl;
// throw "si8 CGameState::maxSpellLevel() call when there is no battle!";
// }
si8 levelLimit = SPELL_LEVELS;
const CGHeroInstance *h1 = heroes[0];
if(h1)
if(const CGHeroInstance *h1 = heroes[0])
{
BOOST_FOREACH(const Bonus *i, h1->bonuses)
if(i->type == Bonus::BLOCK_SPELLS_ABOVE_LEVEL)
amin(levelLimit, i->val);
amin(levelLimit, h1->valOfBonuses(Bonus::BLOCK_SPELLS_ABOVE_LEVEL));
}
const CGHeroInstance *h2 = heroes[1];
if(h2)
if(const CGHeroInstance *h2 = heroes[1])
{
BOOST_FOREACH(const Bonus *i, h2->bonuses)
if(i->type == Bonus::BLOCK_SPELLS_ABOVE_LEVEL)
amin(levelLimit, i->val);
amin(levelLimit, h2->valOfBonuses(Bonus::BLOCK_SPELLS_ABOVE_LEVEL));
}
return levelLimit;
@ -1473,6 +1460,10 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, int terrain, int terType, const
}
}
//spell level limiting bonus
curB->addNewBonus(new Bonus(Bonus::ONE_BATTLE, Bonus::BLOCK_SPELLS_ABOVE_LEVEL, Bonus::OTHER,
SPELL_LEVELS, -1, -1, Bonus::INDEPENDENT_MIN));;
//giving terrain overalay premies
int bonusSubtype = -1;
switch(terType)
@ -1524,7 +1515,9 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, int terrain, int terType, const
{
curB->addNewBonus(makeFeature(Bonus::NO_MORALE, Bonus::ONE_BATTLE, 0, 0, Bonus::TERRAIN_OVERLAY));
curB->addNewBonus(makeFeature(Bonus::NO_LUCK, Bonus::ONE_BATTLE, 0, 0, Bonus::TERRAIN_OVERLAY));
curB->addNewBonus(makeFeature(Bonus::BLOCK_SPELLS_ABOVE_LEVEL, Bonus::ONE_BATTLE, 0, 1, Bonus::TERRAIN_OVERLAY));
Bonus * b = makeFeature(Bonus::BLOCK_SPELLS_ABOVE_LEVEL, Bonus::ONE_BATTLE, 0, 1, Bonus::TERRAIN_OVERLAY);
b->valType = Bonus::INDEPENDENT_MIN;
curB->addNewBonus(b);
break;
}
}

View File

@ -627,7 +627,7 @@ void CArtHandler::addBonuses()
giveArtBonus(81,Bonus::FIRE_SPELL_DMG_PREMY,+50);//Orb of Tempestuous Fire
giveArtBonus(82,Bonus::WATER_SPELL_DMG_PREMY,+50);//Orb of Driving Rain
giveArtBonus(83,Bonus::BLOCK_SPELLS_ABOVE_LEVEL,3);//Recanter's Cloak
giveArtBonus(83,Bonus::BLOCK_SPELLS_ABOVE_LEVEL,3,-1,Bonus::INDEPENDENT_MIN);//Recanter's Cloak
giveArtBonus(84,Bonus::BLOCK_MORALE,0);//Spirit of Oppression
giveArtBonus(85,Bonus::BLOCK_LUCK,0);//Hourglass of the Evil Hour
@ -684,7 +684,7 @@ void CArtHandler::addBonuses()
giveArtBonus(124,Bonus::SPELLS_OF_LEVEL,3,1); //Spellbinder's Hat
giveArtBonus(125,Bonus::ENEMY_CANT_ESCAPE,0); //Shackles of War
giveArtBonus(126,Bonus::BLOCK_SPELLS_ABOVE_LEVEL,0);//Orb of Inhibition
giveArtBonus(126,Bonus::BLOCK_SPELLS_ABOVE_LEVEL,0,-1,Bonus::INDEPENDENT_MIN);//Orb of Inhibition
//vial of dragon blood
giveArtBonus(127, Bonus::PRIMARY_SKILL, +5, PrimarySkill::ATTACK, Bonus::BASE_NUMBER, new HasAnotherBonusLimiter(Bonus::DRAGON_NATURE));

View File

@ -195,7 +195,7 @@ struct DLL_EXPORT Bonus
CAMPAIGN_BONUS,
SPECIAL_WEEK,
STACK_EXPERIENCE,
OTHER /*used for defensive stance*/
OTHER /*used for defensive stance and default value of spell level limit*/
};
enum LimitEffect