mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
* support for armor of the damned
This commit is contained in:
parent
1002bd2b4f
commit
0ac8430b11
@ -2625,8 +2625,8 @@ void CBattleInterface::spellCast(BattleSpellCast * sc)
|
||||
{
|
||||
CSpell &spell = CGI->spellh->spells[sc->id];
|
||||
|
||||
|
||||
if(sc->castedByHero && sc->side == !curInt->cb->battleGetStackByID(activeStack)->attackerOwned)
|
||||
//spell opening battle is cast when no stack is active
|
||||
if(sc->castedByHero && ( activeStack == -1 || sc->side == !curInt->cb->battleGetStackByID(activeStack)->attackerOwned) )
|
||||
bSpell->block(true);
|
||||
|
||||
std::vector< std::string > anims; //for magic arrow and ice bolt
|
||||
|
@ -2776,10 +2776,10 @@ std::set<CStack*> BattleInfo::getAttackedCreatures( const CSpell * s, int skillL
|
||||
return attackedCres;
|
||||
}
|
||||
|
||||
int BattleInfo::calculateSpellDuration(const CSpell * spell, const CGHeroInstance * caster)
|
||||
int BattleInfo::calculateSpellDuration( const CSpell * spell, const CGHeroInstance * caster, int usedSpellPower )
|
||||
{
|
||||
if(!caster) //TODO: something better
|
||||
return 5;
|
||||
return std::max(5, usedSpellPower);
|
||||
switch(spell->id)
|
||||
{
|
||||
case 56: //frenzy
|
||||
|
@ -208,7 +208,7 @@ struct DLL_EXPORT BattleInfo : public CBonusSystemNode
|
||||
std::pair<ui32, ui32> calculateDmgRange(const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero, bool shooting, ui8 charge, bool lucky); //charge - number of hexes travelled before attack (for champion's jousting); returns pair <min dmg, max dmg>
|
||||
void calculateCasualties(std::map<ui32,si32> *casualties) const; //casualties are array of maps size 2 (attacker, defeneder), maps are (crid => amount)
|
||||
std::set<CStack*> getAttackedCreatures(const CSpell * s, int skillLevel, ui8 attackerOwner, int destinationTile); //calculates stack affected by given spell
|
||||
static int calculateSpellDuration(const CSpell * spell, const CGHeroInstance * caster);
|
||||
static int calculateSpellDuration(const CSpell * spell, const CGHeroInstance * caster, int usedSpellPower);
|
||||
CStack * generateNewStack(const CStackInstance &base, int stackID, bool attackerOwned, int slot, int /*TerrainTile::EterrainType*/ terrain, int position) const; //helper for CGameHandler::setupBattle and spells addign new stacks to the battlefield
|
||||
ui32 getSpellCost(const CSpell * sp, const CGHeroInstance * caster) const; //returns cost of given spell
|
||||
int hexToWallPart(int hex) const; //returns part of destructible wall / gate / keep under given hex or -1 if not found
|
||||
|
@ -349,6 +349,26 @@ void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance
|
||||
}
|
||||
}
|
||||
|
||||
//spells opening battle
|
||||
if (hero1 && hero1->hasBonusOfType(Bonus::OPENING_BATTLE_SPELL))
|
||||
{
|
||||
BonusList bl;
|
||||
hero1->getBonuses(bl, Selector::type(Bonus::OPENING_BATTLE_SPELL));
|
||||
BOOST_FOREACH (Bonus b, bl)
|
||||
{
|
||||
handleSpellCasting(b.subtype, 3, -1, 0, hero1->tempOwner, NULL, hero2, b.val);
|
||||
}
|
||||
}
|
||||
if (hero2 && hero2->hasBonusOfType(Bonus::OPENING_BATTLE_SPELL))
|
||||
{
|
||||
BonusList bl;
|
||||
hero2->getBonuses(bl, Selector::type(Bonus::OPENING_BATTLE_SPELL));
|
||||
BOOST_FOREACH (Bonus b, bl)
|
||||
{
|
||||
handleSpellCasting(b.subtype, 3, -1, 1, hero2->tempOwner, NULL, hero1, b.val);
|
||||
}
|
||||
}
|
||||
|
||||
//main loop
|
||||
while(!battleResult.get()) //till the end of the battle ;]
|
||||
{
|
||||
@ -3736,7 +3756,7 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, int destinatio
|
||||
}
|
||||
sse.effect.id = spellID;
|
||||
sse.effect.level = spellLvl;
|
||||
sse.effect.turnsRemain = BattleInfo::calculateSpellDuration(spell, caster);
|
||||
sse.effect.turnsRemain = BattleInfo::calculateSpellDuration(spell, caster, usedSpellPower);
|
||||
if(!sse.stacks.empty())
|
||||
sendAndApply(&sse);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user