mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
[CMB1] Implement Frogkin Kidnapper (#11137)
This commit is contained in:
parent
f4b0b83612
commit
58fdbc9345
3 changed files with 176 additions and 2 deletions
|
|
@ -6,21 +6,30 @@ import mage.abilities.SpecialAction;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CreateSpecialActionEffect extends OneShotEffect {
|
||||
|
||||
protected SpecialAction action;
|
||||
private final SpecialAction action;
|
||||
private final UUID playerId; // If set, that player can activate the special action. If null, use the source controller instead.
|
||||
|
||||
public CreateSpecialActionEffect(SpecialAction action) {
|
||||
this(action, null);
|
||||
}
|
||||
|
||||
public CreateSpecialActionEffect(SpecialAction action, UUID playerId) {
|
||||
super(action.getEffects().getOutcome(action));
|
||||
this.action = action;
|
||||
this.playerId = playerId;
|
||||
}
|
||||
|
||||
protected CreateSpecialActionEffect(final CreateSpecialActionEffect effect) {
|
||||
super(effect);
|
||||
this.action = (SpecialAction) effect.action.copy();
|
||||
this.playerId = effect.playerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -32,7 +41,7 @@ public class CreateSpecialActionEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
SpecialAction newAction = (SpecialAction) action.copy();
|
||||
newAction.setSourceId(source.getSourceId());
|
||||
newAction.setControllerId(source.getControllerId());
|
||||
newAction.setControllerId(playerId == null ? source.getControllerId() : playerId);
|
||||
newAction.getTargets().addAll(source.getTargets());
|
||||
game.getState().getSpecialActions().add(newAction);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue