forked from External/mage
Rework sacrifice effects to support "can't be sacrificed" (#11587)
* add TargetSacrifice and canBeSacrificed
* SacrificeTargetCost refactor, now uses TargetSacrifice, constructors simplified, subclasses aligned
* fix text errors introduced by refactor
* refactor SacrificeEffect, SacrificeAllEffect, SacrificeOpponentsEffect
* cleanup keyword abilities involving sacrifice
* fix a bunch of custom effect classes involving sacrifice
* fix test choices
* update Assault Suit implementation
* fix filter check arguments
* add documentation to refactored common classes
* [CLB] Implement Jon Irenicus, Shattered One
* implement "{this} can't be sacrificed"
* add tests for Assault Suit and Jon Irenicus
* refactor out PlayerToRightGainsControlOfSourceEffect
* implement [LTC] Hithlain Rope
* add choose hint to all TargetSacrifice
---------
Co-authored-by: Evan Kranzler <theelk801@gmail.com>
Co-authored-by: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com>
This commit is contained in:
parent
f28c5c4fc5
commit
9b3ff32a33
699 changed files with 1837 additions and 1619 deletions
|
|
@ -5,13 +5,13 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetSacrifice;
|
||||
|
||||
/**
|
||||
* Exploit is the signature ability of the blue-black Silumgar clan. When a creature with exploit
|
||||
|
|
@ -71,14 +71,13 @@ class ExploitEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Target target = new TargetPermanent(1, 1, new FilterControlledCreaturePermanent("creature to exploit"), true);
|
||||
Target target = new TargetSacrifice(StaticFilters.FILTER_PERMANENT_A_CREATURE);
|
||||
target.withChooseHint("to exploit");
|
||||
if (target.canChoose(controller.getId(), source, game)) {
|
||||
controller.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
controller.choose(Outcome.Sacrifice, target, source, game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
if (permanent.sacrifice(source, game)) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLOITED_CREATURE, permanent.getId(), source, controller.getId()));
|
||||
}
|
||||
if (permanent != null && (permanent.sacrifice(source, game))) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLOITED_CREATURE, permanent.getId(), source, controller.getId()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue