mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 20:59:14 -08:00
ApostlesBlessingEffect becomes stateless
This commit is contained in:
parent
ea13abc6a0
commit
9280a84ecf
1 changed files with 30 additions and 36 deletions
|
|
@ -47,7 +47,6 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Loki
|
* @author Loki
|
||||||
*/
|
*/
|
||||||
public class ApostlesBlessing extends CardImpl<ApostlesBlessing> {
|
public class ApostlesBlessing extends CardImpl<ApostlesBlessing> {
|
||||||
|
|
@ -59,16 +58,16 @@ public class ApostlesBlessing extends CardImpl<ApostlesBlessing> {
|
||||||
filter.setScopeCardType(mage.filter.Filter.ComparisonScope.Any);
|
filter.setScopeCardType(mage.filter.Filter.ComparisonScope.Any);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApostlesBlessing (UUID ownerId) {
|
public ApostlesBlessing(UUID ownerId) {
|
||||||
super(ownerId, 2, "Apostle's Blessing", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{WP}");
|
super(ownerId, 2, "Apostle's Blessing", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{WP}");
|
||||||
this.expansionSetCode = "NPH";
|
this.expansionSetCode = "NPH";
|
||||||
this.color.setWhite(true);
|
this.color.setWhite(true);
|
||||||
this.getSpellAbility().addEffect(new ApostlesBlessingEffect(Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new ApostlesBlessingEffect(Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addTarget(new TargetControlledPermanent(filter));
|
this.getSpellAbility().addTarget(new TargetControlledPermanent(filter));
|
||||||
this.getSpellAbility().addChoice(new ChoiceColorOrArtifact());
|
this.getSpellAbility().addChoice(new ChoiceColorOrArtifact());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApostlesBlessing (final ApostlesBlessing card) {
|
public ApostlesBlessing(final ApostlesBlessing card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,46 +80,41 @@ public class ApostlesBlessing extends CardImpl<ApostlesBlessing> {
|
||||||
|
|
||||||
class ApostlesBlessingEffect extends GainAbilityTargetEffect {
|
class ApostlesBlessingEffect extends GainAbilityTargetEffect {
|
||||||
|
|
||||||
FilterCard protectionFilter;
|
public ApostlesBlessingEffect(Duration duration) {
|
||||||
|
super(new ProtectionAbility(new FilterCard()), duration);
|
||||||
|
staticText = "Target artifact or creature gains protection from artifacts or from the color of your choice until end of turn";
|
||||||
|
}
|
||||||
|
|
||||||
public ApostlesBlessingEffect(Duration duration) {
|
public ApostlesBlessingEffect(final ApostlesBlessingEffect effect) {
|
||||||
super(new ProtectionAbility(new FilterCard()), duration);
|
super(effect);
|
||||||
protectionFilter = (FilterCard)((ProtectionAbility)ability).getFilter();
|
}
|
||||||
staticText = "Target artifact or creature gains protection from artifacts or from the color of your choice until end of turn";
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApostlesBlessingEffect(final ApostlesBlessingEffect effect) {
|
@Override
|
||||||
super(effect);
|
public ApostlesBlessingEffect copy() {
|
||||||
this.protectionFilter = effect.protectionFilter.copy();
|
return new ApostlesBlessingEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApostlesBlessingEffect copy() {
|
public boolean apply(Game game, Ability source) {
|
||||||
return new ApostlesBlessingEffect(this);
|
FilterCard protectionFilter = new FilterCard();
|
||||||
}
|
ChoiceColorOrArtifact choice = (ChoiceColorOrArtifact) source.getChoices().get(0);
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
ChoiceColorOrArtifact choice = (ChoiceColorOrArtifact) source.getChoices().get(0);
|
|
||||||
if (choice.isArtifactSelected()) {
|
if (choice.isArtifactSelected()) {
|
||||||
if (!protectionFilter.getCardType().contains(CardType.ARTIFACT)) {
|
protectionFilter.getCardType().add(Constants.CardType.ARTIFACT);
|
||||||
protectionFilter.getCardType().add(Constants.CardType.ARTIFACT);
|
protectionFilter.setScopeCardType(ComparisonScope.Any);
|
||||||
protectionFilter.setScopeCardType(ComparisonScope.Any);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
protectionFilter.setColor(choice.getColor());
|
protectionFilter.setColor(choice.getColor());
|
||||||
protectionFilter.setUseColor(true);
|
protectionFilter.setUseColor(true);
|
||||||
protectionFilter.setScopeColor(ComparisonScope.Any);
|
protectionFilter.setScopeColor(ComparisonScope.Any);
|
||||||
}
|
}
|
||||||
|
|
||||||
protectionFilter.setMessage(choice.getChoice());
|
protectionFilter.setMessage(choice.getChoice());
|
||||||
((ProtectionAbility)ability).setFilter(protectionFilter);
|
((ProtectionAbility) ability).setFilter(protectionFilter);
|
||||||
Permanent creature = game.getPermanent(source.getFirstTarget());
|
Permanent creature = game.getPermanent(source.getFirstTarget());
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
creature.addAbility(ability, game);
|
creature.addAbility(ability, game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue