mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Updated how spell triggers get information about the spell that triggered them.
This prevents countering the spell from removing the effect of the trigger.
This commit is contained in:
parent
e3245c496c
commit
7bb7754bb3
26 changed files with 69 additions and 61 deletions
|
|
@ -43,17 +43,30 @@ import mage.players.Player;
|
|||
*/
|
||||
public class CopyTargetSpellEffect extends OneShotEffect {
|
||||
|
||||
private boolean useLKI = false;
|
||||
|
||||
public CopyTargetSpellEffect() {
|
||||
super(Outcome.Copy);
|
||||
}
|
||||
|
||||
public CopyTargetSpellEffect(boolean useLKI) {
|
||||
super(Outcome.Copy);
|
||||
this.useLKI = useLKI;
|
||||
}
|
||||
|
||||
public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) {
|
||||
super(effect);
|
||||
this.useLKI = effect.useLKI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
Spell spell;
|
||||
if (useLKI) {
|
||||
spell = game.getSpellOrLKIStack(targetPointer.getFirst(game, source));
|
||||
} else {
|
||||
spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
}
|
||||
if (spell == null) {
|
||||
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ import mage.game.match.MatchType;
|
|||
import mage.game.permanent.Battlefield;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.SpellStack;
|
||||
import mage.game.turn.Phase;
|
||||
import mage.game.turn.Step;
|
||||
|
|
@ -106,6 +107,10 @@ public interface Game extends MageItem, Serializable {
|
|||
|
||||
UUID getOwnerId(MageObject object);
|
||||
|
||||
Spell getSpell(UUID spellId);
|
||||
|
||||
Spell getSpellOrLKIStack(UUID spellId);
|
||||
|
||||
Permanent getPermanent(UUID permanentId);
|
||||
|
||||
Permanent getPermanentOrLKIBattlefield(UUID permanentId);
|
||||
|
|
|
|||
|
|
@ -445,6 +445,20 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spell getSpell(UUID spellId) {
|
||||
return state.getStack().getSpell(spellId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spell getSpellOrLKIStack(UUID spellId) {
|
||||
Spell spell = state.getStack().getSpell(spellId);
|
||||
if (spell == null) {
|
||||
spell = (Spell) this.getLastKnownInformation(spellId, Zone.STACK);
|
||||
}
|
||||
return spell;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permanent getPermanent(UUID permanentId) {
|
||||
return state.getPermanent(permanentId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue