mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[STX] Implemented Plumb the Forbidden
This commit is contained in:
parent
298315309b
commit
f37628c5cb
5 changed files with 131 additions and 45 deletions
|
|
@ -0,0 +1,50 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class CopySourceSpellEffect extends OneShotEffect {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public CopySourceSpellEffect() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
public CopySourceSpellEffect(int amount) {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "copy {this}";
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
private CopySourceSpellEffect(final CopySourceSpellEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Spell spell = (Spell) getValue("spellCast");
|
||||
if (spell == null) {
|
||||
spell = game.getSpellOrLKIStack(source.getSourceId());
|
||||
}
|
||||
if (controller == null || spell == null) {
|
||||
return false;
|
||||
}
|
||||
spell.createCopyOnStack(game, source, source.getControllerId(), true, amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CopySourceSpellEffect copy() {
|
||||
return new CopySourceSpellEffect(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue