mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-06 00:24:11 +02:00
Merge pull request #1742 from rilian-la-te/effects-no-open-code
vcmi: no open-code NO_APPROPRIATE_TARGET
This commit is contained in:
commit
36ab8d4011
@ -76,12 +76,7 @@ bool Sacrifice::applicable(Problem & problem, const Mechanics * m) const
|
||||
}
|
||||
|
||||
if(!(targetExists && targetToSacrificeExists))
|
||||
{
|
||||
MetaString text;
|
||||
text.addTxt(MetaString::GENERAL_TXT, 185);
|
||||
problem.add(std::move(text), Problem::NORMAL);
|
||||
return false;
|
||||
}
|
||||
return m->adaptProblem(ESpellCastProblem::NO_APPROPRIATE_TARGET, problem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -46,13 +46,7 @@ bool UnitEffect::applicable(Problem & problem, const Mechanics * m) const
|
||||
auto targets = m->battle()->battleGetUnitsIf(mainFilter);
|
||||
vstd::erase_if(targets, predicate);
|
||||
if(targets.empty())
|
||||
{
|
||||
MetaString text;
|
||||
text.addTxt(MetaString::GENERAL_TXT, 185);
|
||||
problem.add(std::move(text), Problem::NORMAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
return m->adaptProblem(ESpellCastProblem::NO_APPROPRIATE_TARGET, problem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user