mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
commit
a1b065c170
4 changed files with 41 additions and 23 deletions
|
@ -27,12 +27,17 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.riseoftheeldrazi;
|
package mage.sets.riseoftheeldrazi;
|
||||||
|
|
||||||
import mage.Constants.*;
|
import java.util.UUID;
|
||||||
|
import mage.Constants.CardType;
|
||||||
|
import mage.Constants.Duration;
|
||||||
|
import mage.Constants.Outcome;
|
||||||
|
import mage.Constants.Rarity;
|
||||||
|
import mage.Constants.Zone;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -40,7 +45,6 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.functions.EmptyApplyToPermanent;
|
import mage.util.functions.EmptyApplyToPermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -106,32 +110,34 @@ class RenegadeDoppelgangerTriggeredAbility extends TriggeredAbilityImpl<Renegade
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenegadeDoppelgangerEffect extends ContinuousEffectImpl<RenegadeDoppelgangerEffect> {
|
class RenegadeDoppelgangerEffect extends OneShotEffect<RenegadeDoppelgangerEffect> {
|
||||||
|
|
||||||
RenegadeDoppelgangerEffect() {
|
public RenegadeDoppelgangerEffect() {
|
||||||
super(Duration.EndOfTurn, Layer.CopyEffects_1, SubLayer.NA, Outcome.Copy);
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "have {this} become a copy of that creature until end of turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
RenegadeDoppelgangerEffect(final RenegadeDoppelgangerEffect effect) {
|
public RenegadeDoppelgangerEffect(final RenegadeDoppelgangerEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
|
|
||||||
if (creature == null || permanent == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
game.copyPermanent(creature, permanent, source, new EmptyApplyToPermanent());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenegadeDoppelgangerEffect copy() {
|
public RenegadeDoppelgangerEffect copy() {
|
||||||
return new RenegadeDoppelgangerEffect(this);
|
return new RenegadeDoppelgangerEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
Permanent targetCreature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||||
|
if (targetCreature == null) {
|
||||||
|
targetCreature = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
|
||||||
|
}
|
||||||
|
if (targetCreature == null || permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
game.copyPermanent(Duration.EndOfTurn, targetCreature, permanent, source, new EmptyApplyToPermanent());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,11 @@ public class CopyEffect extends ContinuousEffectImpl<CopyEffect> {
|
||||||
private UUID sourceId;
|
private UUID sourceId;
|
||||||
|
|
||||||
public CopyEffect(Permanent target, UUID sourceId) {
|
public CopyEffect(Permanent target, UUID sourceId) {
|
||||||
super(Duration.Custom, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature);
|
this(Duration.Custom, target, sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CopyEffect(Duration duration, Permanent target, UUID sourceId) {
|
||||||
|
super(duration, Layer.CopyEffects_1, SubLayer.NA, Outcome.BecomeCreature);
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.sourceId = sourceId;
|
this.sourceId = sourceId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ import mage.util.functions.ApplyToPermanent;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import mage.Constants.Duration;
|
||||||
|
|
||||||
public interface Game extends MageItem, Serializable {
|
public interface Game extends MageItem, Serializable {
|
||||||
|
|
||||||
|
@ -189,6 +190,8 @@ public interface Game extends MageItem, Serializable {
|
||||||
* @param applier
|
* @param applier
|
||||||
*/
|
*/
|
||||||
Permanent copyPermanent(Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier);
|
Permanent copyPermanent(Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier);
|
||||||
|
|
||||||
|
Permanent copyPermanent(Duration duration, Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier);
|
||||||
|
|
||||||
Card copyCard(Card cardToCopy, Ability source, UUID newController);
|
Card copyCard(Card cardToCopy, Ability source, UUID newController);
|
||||||
|
|
||||||
|
|
|
@ -997,6 +997,11 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Permanent copyPermanent(Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier) {
|
public Permanent copyPermanent(Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier) {
|
||||||
|
return copyPermanent(Duration.Custom, copyFromPermanent, copyToPermanent, source, applier);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Permanent copyPermanent(Duration duration, Permanent copyFromPermanent, Permanent copyToPermanent, Ability source, ApplyToPermanent applier) {
|
||||||
Permanent permanent = copyFromPermanent.copy();
|
Permanent permanent = copyFromPermanent.copy();
|
||||||
|
|
||||||
//getState().addCard(permanent);
|
//getState().addCard(permanent);
|
||||||
|
@ -1009,7 +1014,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
||||||
|
|
||||||
Ability newAbility = source.copy();
|
Ability newAbility = source.copy();
|
||||||
|
|
||||||
CopyEffect newEffect = new CopyEffect(permanent, copyToPermanent.getId());
|
CopyEffect newEffect = new CopyEffect(duration, permanent, copyToPermanent.getId());
|
||||||
newEffect.newId();
|
newEffect.newId();
|
||||||
newEffect.setTimestamp();
|
newEffect.setTimestamp();
|
||||||
newEffect.init(newAbility, this);
|
newEffect.init(newAbility, this);
|
||||||
|
|
Loading…
Reference in a new issue