Improves in some effects:

* ConditionalAsThoughEffect - improved support with target effects (see comments from e6e802033b);
* TargetCardInLibrary - added additional checks on wrong usage (must be used inside effects only, not as ability's target);
* PlayFromNotOwnHandZone - fixed wrong playable mark on battlefield's permanents (AI related too);
This commit is contained in:
Oleg Agafonov 2021-09-17 21:21:37 +04:00
parent aed6a4ac3d
commit 021a2d251c
8 changed files with 173 additions and 3 deletions

View file

@ -26,7 +26,9 @@ import mage.game.stack.Spell;
import mage.game.stack.StackAbility;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetCard;
import mage.target.Targets;
import mage.target.common.TargetCardInLibrary;
import mage.target.targetadjustment.TargetAdjuster;
import mage.util.CardUtil;
import mage.util.GameLog;
@ -881,6 +883,12 @@ public abstract class AbilityImpl implements Ability {
@Override
public void addTarget(Target target) {
// verify check
if (target instanceof TargetCardInLibrary
|| (target instanceof TargetCard && target.getZone().equals(Zone.LIBRARY))) {
throw new IllegalArgumentException("Wrong usage of TargetCardInLibrary - you must use it with SearchLibrary only");
}
if (target != null) {
getTargets().add(target);
}