mirror of
https://github.com/correl/mage.git
synced 2024-12-27 20:06:31 +00:00
* Some fixes for getting source object on battlefield only if it not had a zone change meanwhile.
This commit is contained in:
parent
393444a87b
commit
a62fc1f77c
6 changed files with 19 additions and 7 deletions
|
@ -109,9 +109,11 @@ class TreacherousPitDwellerEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
return permanent.changeControllerId(source.getFirstTarget(), game);
|
return permanent.changeControllerId(source.getFirstTarget(), game);
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ class ShurikenControlEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent equipment = null;
|
Permanent equipment = null; // TODO: Meanwhile blinked object would be found regardless
|
||||||
for(Cost cost : source.getCosts()) {
|
for(Cost cost : source.getCosts()) {
|
||||||
if (cost instanceof ShurikenUnattachCost) {
|
if (cost instanceof ShurikenUnattachCost) {
|
||||||
equipment = ((ShurikenUnattachCost) cost).getEquipment();
|
equipment = ((ShurikenUnattachCost) cost).getEquipment();
|
||||||
|
|
|
@ -53,7 +53,11 @@ public class JinxedIdol extends CardImpl {
|
||||||
public JinxedIdol(UUID ownerId) {
|
public JinxedIdol(UUID ownerId) {
|
||||||
super(ownerId, 208, "Jinxed Idol", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
super(ownerId, 208, "Jinxed Idol", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||||
this.expansionSetCode = "M11";
|
this.expansionSetCode = "M11";
|
||||||
|
|
||||||
|
// At the beginning of your upkeep, Jinxed Idol deals 2 damage to you.
|
||||||
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DamageControllerEffect(2)));
|
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DamageControllerEffect(2)));
|
||||||
|
|
||||||
|
// Sacrifice a creature: Target opponent gains control of Jinxed Idol.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JinxedIdolEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JinxedIdolEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
||||||
ability.addTarget(new TargetOpponent());
|
ability.addTarget(new TargetOpponent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
@ -88,9 +92,11 @@ class JinxedIdolEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
return permanent.changeControllerId(source.getFirstTarget(), game);
|
return permanent.changeControllerId(source.getFirstTarget(), game);
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ class ContestedWarZoneAbility extends TriggeredAbilityImpl {
|
||||||
class ContestedWarZoneEffect extends ContinuousEffectImpl {
|
class ContestedWarZoneEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public ContestedWarZoneEffect() {
|
public ContestedWarZoneEffect() {
|
||||||
super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContestedWarZoneEffect(final ContestedWarZoneEffect effect) {
|
public ContestedWarZoneEffect(final ContestedWarZoneEffect effect) {
|
||||||
|
@ -146,10 +146,12 @@ class ContestedWarZoneEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString());
|
UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString());
|
||||||
if (permanent != null && controllerId != null) {
|
if (permanent != null && controllerId != null) {
|
||||||
return permanent.changeControllerId(controllerId, game);
|
return permanent.changeControllerId(controllerId, game);
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ class MeasureOfWickednessControlSourceEffect extends ContinuousEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
if (permanent != null && targetOpponent != null) {
|
if (permanent != null && targetOpponent != null) {
|
||||||
permanent.changeControllerId(targetOpponent.getId(), game);
|
permanent.changeControllerId(targetOpponent.getId(), game);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -93,9 +93,11 @@ class GoblinCadetsChangeControlEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
return permanent.changeControllerId(source.getFirstTarget(), game);
|
return permanent.changeControllerId(source.getFirstTarget(), game);
|
||||||
|
} else {
|
||||||
|
discard();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue