mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 06:22:01 -08:00
[CMR] Implemented Benevolent Blessing
This commit is contained in:
parent
b8feae7f3a
commit
319775c0b4
5 changed files with 104 additions and 7 deletions
61
Mage.Sets/src/mage/cards/b/BenevolentBlessing.java
Normal file
61
Mage.Sets/src/mage/cards/b/BenevolentBlessing.java
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.abilities.effects.keyword.ProtectionChosenColorAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BenevolentBlessing extends CardImpl {
|
||||
|
||||
public BenevolentBlessing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// As Benevolent Blessing enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Benefit)));
|
||||
|
||||
// Enchanted creature has protection from the chosen color. This effect doesn't remove Auras and Equipment you control that are already attached to it.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
new ProtectionChosenColorAttachedEffect(false)
|
||||
.setNotRemoveControlled(true)
|
||||
.setText("Enchanted creature has protection from the chosen color. This effect doesn't " +
|
||||
"remove Auras and Equipment you control that are already attached to it.")
|
||||
));
|
||||
}
|
||||
|
||||
private BenevolentBlessing(final BenevolentBlessing card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BenevolentBlessing copy() {
|
||||
return new BenevolentBlessing(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Azure Fleet Admiral", 58, Rarity.COMMON, mage.cards.a.AzureFleetAdmiral.class));
|
||||
cards.add(new SetCardInfo("Beast Within", 423, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class));
|
||||
cards.add(new SetCardInfo("Belbe, Corrupted Observer", 270, Rarity.RARE, mage.cards.b.BelbeCorruptedObserver.class));
|
||||
cards.add(new SetCardInfo("Benevolent Blessing", 13, Rarity.COMMON, mage.cards.b.BenevolentBlessing.class));
|
||||
cards.add(new SetCardInfo("Biowaste Blob", 219, Rarity.RARE, mage.cards.b.BiowasteBlob.class));
|
||||
cards.add(new SetCardInfo("Bitter Revelation", 109, Rarity.COMMON, mage.cards.b.BitterRevelation.class));
|
||||
cards.add(new SetCardInfo("Blackblade Reforged", 457, Rarity.RARE, mage.cards.b.BlackbladeReforged.class));
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ProtectionChosenColorAttachedEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected ObjectColor chosenColor;
|
||||
protected ProtectionAbility protectionAbility;
|
||||
protected boolean notRemoveItself;
|
||||
protected final boolean notRemoveItself;
|
||||
protected boolean notRemoveControlled;
|
||||
|
||||
public ProtectionChosenColorAttachedEffect(boolean notRemoveItself) {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
|
|
@ -59,6 +59,11 @@ public class ProtectionChosenColorAttachedEffect extends ContinuousEffectImpl {
|
|||
if (notRemoveItself) {
|
||||
protectionAbility.setAuraIdNotToBeRemoved(source.getSourceId());
|
||||
}
|
||||
if (notRemoveControlled) {
|
||||
protectionAbility.setDoesntRemoveControlled(true);
|
||||
protectionAbility.setRemoveEquipment(false);
|
||||
protectionAbility.setRemovesAuras(false);
|
||||
}
|
||||
}
|
||||
if (protectionAbility != null) {
|
||||
Permanent attachedTo = game.getPermanent(attachement.getAttachedTo());
|
||||
|
|
@ -70,4 +75,9 @@ public class ProtectionChosenColorAttachedEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ProtectionChosenColorAttachedEffect setNotRemoveControlled(boolean notRemoveControlled) {
|
||||
this.notRemoveControlled = notRemoveControlled;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ public class ProtectionAbility extends StaticAbility {
|
|||
|
||||
protected Filter filter;
|
||||
protected boolean removeAuras;
|
||||
protected boolean removeEquipment;
|
||||
protected boolean doesntRemoveControlled;
|
||||
protected static List<ObjectColor> colors = new ArrayList<>();
|
||||
protected UUID auraIdNotToBeRemoved; // defines an Aura objectId that will not be removed from this protection ability
|
||||
|
||||
|
|
@ -32,6 +34,8 @@ public class ProtectionAbility extends StaticAbility {
|
|||
super(Zone.BATTLEFIELD, null);
|
||||
this.filter = filter;
|
||||
this.removeAuras = true;
|
||||
this.removeEquipment = true;
|
||||
this.doesntRemoveControlled = false;
|
||||
this.auraIdNotToBeRemoved = null;
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +43,8 @@ public class ProtectionAbility extends StaticAbility {
|
|||
super(ability);
|
||||
this.filter = ability.filter.copy();
|
||||
this.removeAuras = ability.removeAuras;
|
||||
this.removeEquipment = ability.removeEquipment;
|
||||
this.doesntRemoveControlled = ability.doesntRemoveControlled;
|
||||
this.auraIdNotToBeRemoved = ability.auraIdNotToBeRemoved;
|
||||
}
|
||||
|
||||
|
|
@ -97,14 +103,14 @@ public class ProtectionAbility extends StaticAbility {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Emrakul, the Aeons Torn
|
||||
if (filter instanceof FilterStackObject) {
|
||||
if (filter.match(source, game)) {
|
||||
return (!source.isInstantOrSorcery());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (filter instanceof FilterObject) {
|
||||
return !filter.match(source, game);
|
||||
}
|
||||
|
|
@ -138,6 +144,22 @@ public class ProtectionAbility extends StaticAbility {
|
|||
return removeAuras;
|
||||
}
|
||||
|
||||
public void setRemoveEquipment(boolean removeEquipment) {
|
||||
this.removeEquipment = removeEquipment;
|
||||
}
|
||||
|
||||
public boolean removesEquipment() {
|
||||
return removeEquipment;
|
||||
}
|
||||
|
||||
public void setDoesntRemoveControlled(boolean doesntRemoveControlled) {
|
||||
this.doesntRemoveControlled = doesntRemoveControlled;
|
||||
}
|
||||
|
||||
public boolean getDoesntRemoveControlled() {
|
||||
return doesntRemoveControlled;
|
||||
}
|
||||
|
||||
public List<ObjectColor> getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1104,9 +1104,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
for (ProtectionAbility ability : this.getAbilities(game).getProtectionAbilities()) {
|
||||
if (!(source.hasSubtype(SubType.AURA, game)
|
||||
&& !ability.removesAuras())
|
||||
&& !source.getId().equals(ability.getAuraIdNotToBeRemoved())
|
||||
&& !ability.canTarget(source, game)) {
|
||||
return true;
|
||||
&& !(source.hasSubtype(SubType.EQUIPMENT, game)
|
||||
&& !ability.removesEquipment())) {
|
||||
if (!source.getId().equals(ability.getAuraIdNotToBeRemoved())
|
||||
&& !ability.canTarget(source, game)) {
|
||||
return !ability.getDoesntRemoveControlled() || isControlledBy(game.getControllerId(source.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(EventType.STAY_ATTACHED, objectId, source.getId(), null), null, game, silentMode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue