mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Attempt to fix 2293
This commit is contained in:
@@ -647,16 +647,18 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
|||||||
break;
|
break;
|
||||||
case ESpellCastProblem::ANOTHER_ELEMENTAL_SUMMONED:
|
case ESpellCastProblem::ANOTHER_ELEMENTAL_SUMMONED:
|
||||||
{
|
{
|
||||||
std::string text = CGI->generaltexth->allTexts[538], summoner, elemental, caster;
|
std::string text = CGI->generaltexth->allTexts[538], elemental, caster;
|
||||||
std::vector<const CStack *> stacks = owner->myInt->cb->battleGetStacks();
|
const PlayerColor player = owner->myInt->playerID;
|
||||||
|
|
||||||
|
const TStacks stacks = owner->myInt->cb->battleGetStacksIf([player](const CStack * s)
|
||||||
|
{
|
||||||
|
return s->owner == player
|
||||||
|
&& vstd::contains(s->state, EBattleStackState::SUMMONED)
|
||||||
|
&& !vstd::contains(s->state, EBattleStackState::CLONED);
|
||||||
|
});
|
||||||
for(const CStack * s : stacks)
|
for(const CStack * s : stacks)
|
||||||
{
|
{
|
||||||
if(vstd::contains(s->state, EBattleStackState::SUMMONED))
|
elemental = s->getCreature()->namePl;
|
||||||
{
|
|
||||||
elemental = s->getCreature()->namePl;
|
|
||||||
summoner = owner->myInt->cb->battleGetHeroInfo(!s->attackerOwned).name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (owner->myHero->type->sex)
|
if (owner->myHero->type->sex)
|
||||||
{ //female
|
{ //female
|
||||||
@@ -666,8 +668,9 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
|||||||
{ //male
|
{ //male
|
||||||
caster = CGI->generaltexth->allTexts[539];
|
caster = CGI->generaltexth->allTexts[539];
|
||||||
}
|
}
|
||||||
text = boost::str(boost::format(text) % summoner % elemental % caster);
|
std::string summoner = owner->myHero->name;
|
||||||
|
|
||||||
|
text = boost::str(boost::format(text) % summoner % elemental % caster);
|
||||||
|
|
||||||
owner->myInt->showInfoDialog(text);
|
owner->myInt->showInfoDialog(text);
|
||||||
}
|
}
|
||||||
|
@@ -637,13 +637,11 @@ ESpellCastProblem::ESpellCastProblem SpecialRisingSpellMechanics::isImmuneByStac
|
|||||||
///SummonMechanics
|
///SummonMechanics
|
||||||
ESpellCastProblem::ESpellCastProblem SummonMechanics::canBeCast(const CBattleInfoCallback * cb, PlayerColor player) const
|
ESpellCastProblem::ESpellCastProblem SummonMechanics::canBeCast(const CBattleInfoCallback * cb, PlayerColor player) const
|
||||||
{
|
{
|
||||||
const ui8 side = cb->playerToSide(player);
|
|
||||||
|
|
||||||
//check if there are summoned elementals of other type
|
//check if there are summoned elementals of other type
|
||||||
|
|
||||||
auto otherSummoned = cb->battleGetStacksIf([side, this](const CStack * st)
|
auto otherSummoned = cb->battleGetStacksIf([player, this](const CStack * st)
|
||||||
{
|
{
|
||||||
return (st->attackerOwned == !side)
|
return (st->owner == player)
|
||||||
&& (vstd::contains(st->state, EBattleStackState::SUMMONED))
|
&& (vstd::contains(st->state, EBattleStackState::SUMMONED))
|
||||||
&& (!vstd::contains(st->state, EBattleStackState::CLONED))
|
&& (!vstd::contains(st->state, EBattleStackState::CLONED))
|
||||||
&& (st->getCreature()->idNumber != creatureToSummon);
|
&& (st->getCreature()->idNumber != creatureToSummon);
|
||||||
|
Reference in New Issue
Block a user