1
0
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:
Ivan Savenko 2023-03-22 11:48:33 +02:00 committed by GitHub
commit 36ab8d4011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;
}