mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-27 21:49:10 +02:00
parent
4895540f80
commit
287761a93d
@ -566,8 +566,8 @@ void CDefenceAnim::endAnim()
|
|||||||
|
|
||||||
//printing info to console
|
//printing info to console
|
||||||
|
|
||||||
if(attacker!=NULL)
|
//if(attacker!=NULL)
|
||||||
owner->printConsoleAttacked(stack, dmg, amountKilled, attacker);
|
// owner->printConsoleAttacked(stack, dmg, amountKilled, attacker);
|
||||||
|
|
||||||
//const CStack * attacker = owner->curInt->cb->battleGetStackByID(IDby, false);
|
//const CStack * attacker = owner->curInt->cb->battleGetStackByID(IDby, false);
|
||||||
//const CStack * attacked = owner->curInt->cb->battleGetStackByID(stackID, false);
|
//const CStack * attacked = owner->curInt->cb->battleGetStackByID(stackID, false);
|
||||||
@ -2561,6 +2561,18 @@ void CBattleInterface::stacksAreAttacked(std::vector<SStackAttackedInfo> attacke
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
waitForAnims();
|
waitForAnims();
|
||||||
|
int targets = 0, killed = 0, damage = 0;
|
||||||
|
for(int h = 0; h < attackedInfos.size(); ++h)
|
||||||
|
{
|
||||||
|
++targets;
|
||||||
|
killed += attackedInfos[h].killed;
|
||||||
|
damage += attackedInfos[h].dmg;
|
||||||
|
}
|
||||||
|
if (targets > 1)
|
||||||
|
printConsoleAttacked(attackedInfos.front().defender, damage, killed, attackedInfos.front().attacker, true); //creatures perish
|
||||||
|
else
|
||||||
|
printConsoleAttacked(attackedInfos.front().defender, damage, killed, attackedInfos.front().attacker, false);
|
||||||
|
|
||||||
for(int h = 0; h < attackedInfos.size(); ++h)
|
for(int h = 0; h < attackedInfos.size(); ++h)
|
||||||
{
|
{
|
||||||
if (attackedInfos[h].rebirth)
|
if (attackedInfos[h].rebirth)
|
||||||
@ -3626,21 +3638,26 @@ void CBattleInterface::redrawBackgroundWithHexes(const CStack * activeStack)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBattleInterface::printConsoleAttacked( const CStack * defender, int dmg, int killed, const CStack * attacker )
|
void CBattleInterface::printConsoleAttacked( const CStack * defender, int dmg, int killed, const CStack * attacker, bool multiple )
|
||||||
{
|
{
|
||||||
char tabh[200];
|
char tabh[200];
|
||||||
int end = sprintf(tabh, CGI->generaltexth->allTexts[attacker->count > 1 ? 377 : 376].c_str(),
|
int end = 0;
|
||||||
(attacker->count > 1 ? attacker->getCreature()->namePl.c_str() : attacker->getCreature()->nameSing.c_str()),
|
if (attacker) //ignore if stacks were killed by spell
|
||||||
dmg);
|
{
|
||||||
|
end = sprintf(tabh, CGI->generaltexth->allTexts[attacker->count > 1 ? 377 : 376].c_str(),
|
||||||
|
(attacker->count > 1 ? attacker->getCreature()->namePl.c_str() : attacker->getCreature()->nameSing.c_str()), dmg);
|
||||||
|
}
|
||||||
if(killed > 0)
|
if(killed > 0)
|
||||||
{
|
{
|
||||||
if(killed > 1)
|
if(killed > 1)
|
||||||
{
|
{
|
||||||
sprintf(tabh + end, CGI->generaltexth->allTexts[379].c_str(), killed, defender->getCreature()->namePl.c_str());
|
sprintf(tabh + end, CGI->generaltexth->allTexts[379].c_str(), killed,
|
||||||
|
multiple ? CGI->generaltexth->allTexts[43].c_str() : defender->getCreature()->namePl.c_str()); // creatures perish
|
||||||
}
|
}
|
||||||
else //killed == 1
|
else //killed == 1
|
||||||
{
|
{
|
||||||
sprintf(tabh + end, CGI->generaltexth->allTexts[378].c_str(), defender->getCreature()->nameSing.c_str());
|
sprintf(tabh + end, CGI->generaltexth->allTexts[378].c_str(),
|
||||||
|
multiple ? CGI->generaltexth->allTexts[42].c_str() : defender->getCreature()->nameSing.c_str()); // creature perishes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ private:
|
|||||||
void showPieceOfWall(SDL_Surface * to, int hex, const std::vector<const CStack*> & stacks); //helper function for show
|
void showPieceOfWall(SDL_Surface * to, int hex, const std::vector<const CStack*> & stacks); //helper function for show
|
||||||
void showObstacles(std::multimap<THex, int> *hexToObstacle, std::vector<CObstacleInstance> &obstacles, int hex, SDL_Surface *to); // show all obstacles at a given hex position
|
void showObstacles(std::multimap<THex, int> *hexToObstacle, std::vector<CObstacleInstance> &obstacles, int hex, SDL_Surface *to); // show all obstacles at a given hex position
|
||||||
void redrawBackgroundWithHexes(const CStack * activeStack);
|
void redrawBackgroundWithHexes(const CStack * activeStack);
|
||||||
void printConsoleAttacked(const CStack * defender, int dmg, int killed, const CStack * attacker);
|
void printConsoleAttacked(const CStack * defender, int dmg, int killed, const CStack * attacker, bool Multiple);
|
||||||
|
|
||||||
std::list<SProjectileInfo> projectiles; //projectiles flying on battlefield
|
std::list<SProjectileInfo> projectiles; //projectiles flying on battlefield
|
||||||
void projectileShowHelper(SDL_Surface * to); //prints projectiles present on the battlefield
|
void projectileShowHelper(SDL_Surface * to); //prints projectiles present on the battlefield
|
||||||
|
@ -3453,6 +3453,7 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
if (spellID == 79)
|
if (spellID == 79)
|
||||||
amin(sc.dmgToDisplay, (*attackedCres.begin())->count); //stack is already reduced after attack
|
amin(sc.dmgToDisplay, (*attackedCres.begin())->count); //stack is already reduced after attack
|
||||||
}
|
}
|
||||||
|
StacksInjured si;
|
||||||
|
|
||||||
//applying effects
|
//applying effects
|
||||||
switch(spellID)
|
switch(spellID)
|
||||||
@ -3480,7 +3481,6 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
else //Faerie Dragon
|
else //Faerie Dragon
|
||||||
usedSpellPower = stack->valOfBonuses(Bonus::CREATURE_SPELL_POWER) * stack->count / 100;
|
usedSpellPower = stack->valOfBonuses(Bonus::CREATURE_SPELL_POWER) * stack->count / 100;
|
||||||
}
|
}
|
||||||
StacksInjured si;
|
|
||||||
for(std::set<CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it)
|
for(std::set<CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it)
|
||||||
{
|
{
|
||||||
if(vstd::contains(sc.resisted, (*it)->ID)) //this creature resisted the spell
|
if(vstd::contains(sc.resisted, (*it)->ID)) //this creature resisted the spell
|
||||||
@ -3501,8 +3501,6 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
(*it)->prepareAttacked(bsa);
|
(*it)->prepareAttacked(bsa);
|
||||||
si.stacks.push_back(bsa);
|
si.stacks.push_back(bsa);
|
||||||
}
|
}
|
||||||
if(!si.stacks.empty())
|
|
||||||
sendAndApply(&si);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// permanent effects
|
// permanent effects
|
||||||
@ -3628,7 +3626,6 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
bsm.tilesToMove = tiles;
|
bsm.tilesToMove = tiles;
|
||||||
bsm.teleporting = true;
|
bsm.teleporting = true;
|
||||||
sendAndApply(&bsm);
|
sendAndApply(&bsm);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 37: //cure
|
case 37: //cure
|
||||||
@ -3687,13 +3684,11 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
}
|
}
|
||||||
if(!obr.obstacles.empty())
|
if(!obr.obstacles.empty())
|
||||||
sendAndApply(&obr);
|
sendAndApply(&obr);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 79: //Death stare - handled in a bit different way
|
case 79: //Death stare - handled in a bit different way
|
||||||
{
|
{
|
||||||
StacksInjured si;
|
|
||||||
for(std::set<CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it)
|
for(std::set<CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it)
|
||||||
{
|
{
|
||||||
if((*it)->hasBonusOfType(Bonus::UNDEAD) || (*it)->hasBonusOfType(Bonus::NON_LIVING)) //this creature is immune
|
if((*it)->hasBonusOfType(Bonus::UNDEAD) || (*it)->hasBonusOfType(Bonus::NON_LIVING)) //this creature is immune
|
||||||
@ -3711,13 +3706,10 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
(*it)->prepareAttacked(bsa);
|
(*it)->prepareAttacked(bsa);
|
||||||
si.stacks.push_back(bsa);
|
si.stacks.push_back(bsa);
|
||||||
}
|
}
|
||||||
if(!si.stacks.empty())
|
|
||||||
sendAndApply(&si);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 81: //Acid breath damage - new effect, separate from acid breath defense reduction
|
case 81: //Acid breath damage - new effect, separate from acid breath defense reduction
|
||||||
{
|
{
|
||||||
StacksInjured si;
|
|
||||||
for(std::set<CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it) //no immunities
|
for(std::set<CStack*>::iterator it = attackedCres.begin(); it != attackedCres.end(); ++it) //no immunities
|
||||||
{
|
{
|
||||||
BattleStackAttacked bsa;
|
BattleStackAttacked bsa;
|
||||||
@ -3729,14 +3721,13 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destinati
|
|||||||
(*it)->prepareAttacked(bsa);
|
(*it)->prepareAttacked(bsa);
|
||||||
si.stacks.push_back(bsa);
|
si.stacks.push_back(bsa);
|
||||||
}
|
}
|
||||||
if(!si.stacks.empty())
|
|
||||||
sendAndApply(&si);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendAndApply(&sc);
|
sendAndApply(&sc);
|
||||||
|
if(!si.stacks.empty()) //after spellcast info shows
|
||||||
|
sendAndApply(&si);
|
||||||
//Magic Mirror effect
|
//Magic Mirror effect
|
||||||
if (spell->positiveness < 0 && mode != SpellCasting::MAGIC_MIRROR && spell->level && spell->range[0] == "0") //it is actual spell and can be reflected to single target, no recurrence
|
if (spell->positiveness < 0 && mode != SpellCasting::MAGIC_MIRROR && spell->level && spell->range[0] == "0") //it is actual spell and can be reflected to single target, no recurrence
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user