forked from External/mage
updated copy implementation to work with stack objects
This commit is contained in:
parent
1352beee9f
commit
92007f0132
14 changed files with 206 additions and 218 deletions
|
|
@ -19,6 +19,7 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.GolemToken;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.util.TargetAddress;
|
||||
|
|
@ -131,7 +132,7 @@ class PrecursorGolemCopySpellEffect extends CopySpellForEachItCouldTargetEffect
|
|||
|
||||
@Override
|
||||
protected Player getPlayer(Game game, Ability source) {
|
||||
Spell spell = getSpell(game, source);
|
||||
Spell spell = getStackObject(game, source);
|
||||
if (spell == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -139,7 +140,7 @@ class PrecursorGolemCopySpellEffect extends CopySpellForEachItCouldTargetEffect
|
|||
}
|
||||
|
||||
@Override
|
||||
protected List<MageObjectReferencePredicate> getPossibleTargets(Spell spell, Player player, Ability source, Game game) {
|
||||
protected List<MageObjectReferencePredicate> getPossibleTargets(StackObject stackObject, Player player, Ability source, Game game) {
|
||||
Permanent permanent = (Permanent) getValue("targetedGolem");
|
||||
return game.getBattlefield()
|
||||
.getActivePermanents(
|
||||
|
|
@ -147,14 +148,14 @@ class PrecursorGolemCopySpellEffect extends CopySpellForEachItCouldTargetEffect
|
|||
).stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(p -> !p.equals(permanent))
|
||||
.filter(p -> spell.canTarget(game, p.getId()))
|
||||
.filter(p -> stackObject.canTarget(game, p.getId()))
|
||||
.map(p -> new MageObjectReference(p, game))
|
||||
.map(MageObjectReferencePredicate::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Spell getSpell(Game game, Ability source) {
|
||||
protected Spell getStackObject(Game game, Ability source) {
|
||||
return (Spell) getValue("triggeringSpell");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue