congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
PreventDamageToControllerEffect
Code IndexAdd Tabnine to your IDE (free)

How to use
PreventDamageToControllerEffect
in
mage.abilities.effects.common

Best Java code snippets using mage.abilities.effects.common.PreventDamageToControllerEffect (Showing top 20 results out of 315)

origin: magefree/mage

@Override
public PreventDamageToControllerEffect copy() {
  return new PreventDamageToControllerEffect(this);
}
origin: magefree/mage

public PreventDamageToControllerEffect(Duration duration, boolean onlyCombat, boolean consumable, DynamicValue amountToPreventDynamic) {
  super(duration, 0, onlyCombat, consumable, amountToPreventDynamic);
  staticText = setText();
}
origin: magefree/mage

@Override
protected PreventionEffectData preventDamageAction(GameEvent event, Ability source, Game game) {
  PreventionEffectData preventionEffectData = super.preventDamageAction(event, source, game);
  int damage = preventionEffectData.getPreventedDamage();
  if (damage > 0) {
    game.damagePlayerOrPlaneswalker(source.getFirstTarget(), damage, source.getSourceId(), game, false, true);
  }
  return preventionEffectData;
}
origin: magefree/mage

@Override
protected PreventionEffectData preventDamageAction(GameEvent event, Ability source, Game game) {
  PreventionEffectData preventionEffectData = super.preventDamageAction(event, source, game);
  int damage = preventionEffectData.getPreventedDamage();
  if (damage > 0) {
    Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
    if (attackingCreature != null) {
      attackingCreature.damage(damage, source.getSourceId(), game, false, true);
    }
  }
  return preventionEffectData;
}
origin: magefree/mage

public SpiritOfResistance(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
  // As long as you control a permanent of each color, prevent all damage that would be dealt to you.
  Effect effect = new ConditionalReplacementEffect(
      new PreventDamageToControllerEffect(Duration.WhileOnBattlefield),
      SpiritOfResistanceCondition.instance);
  effect.setText("As long as you control a permanent of each color, prevent all damage that would be dealt to you.");
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
origin: magefree/mage

public PreventDamageToControllerEffect(Duration duration, boolean onlyCombat, boolean consumable, int amountToPrevent) {
  super(duration, amountToPrevent, onlyCombat, consumable, null);
  staticText = setText();
}
origin: magefree/mage

public ShieldOfTheAges(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
  // {2}: Prevent the next 1 damage that would be dealt to you this turn.
  this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.EndOfTurn, 1), new GenericManaCost(2)));
}
origin: magefree/mage

public Conservator(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
  // {3}, {tap}: Prevent the next 2 damage that would be dealt to you this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.EndOfTurn, 2), new GenericManaCost(3));
  ability.addTarget(new TargetPlayer());
  ability.addCost(new TapSourceCost());
  this.addAbility(ability);
}
origin: magefree/mage

public DecoratedGriffin(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
  this.subtype.add(SubType.GRIFFIN);
  this.power = new MageInt(2);
  this.toughness = new MageInt(3);
  // Flying
  this.addAbility(FlyingAbility.getInstance());
  // {1}{W}: Prevent the next 1 combat damage that would be dealt to you this turn.
  this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.EndOfTurn, true, true, 1), new ManaCostsImpl("{1}{W}")));
}
origin: magefree/mage

public ReinforcedBulwark(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
  this.subtype.add(SubType.WALL);
  this.power = new MageInt(0);
  this.toughness = new MageInt(4);
  // Defender
  this.addAbility(DefenderAbility.getInstance());
  // {tap}: Prevent the next 1 damage that would be dealt to you this turn.
  this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.EndOfTurn, 1), new TapSourceCost()));
}
origin: magefree/mage

public PalliationAccord(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{U}");
  // Whenever a creature an opponent controls becomes tapped, put a shield counter on Palliation Accord.
  this.addAbility(new BecomesTappedTriggeredAbility(new AddCountersSourceEffect(CounterType.SHIELD.createInstance()), false, filter));
  // Remove a shield counter from Palliation Accord: Prevent the next 1 damage that would be dealt to you this turn.
  this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
      new PreventDamageToControllerEffect(Duration.EndOfTurn, 1),
      new RemoveCountersSourceCost(CounterType.SHIELD.createInstance())));
}
origin: magefree/mage

public FestivalOfTheGuildpact(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{W}");
  // Prevent the next X damage that would be dealt to you this turn.
  this.getSpellAbility().addEffect(new PreventDamageToControllerEffect(Duration.EndOfTurn, false, true, ManacostVariableValue.instance));
  // Draw a card.
  this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
}
origin: magefree/mage

public SelflessSquire(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.SOLDIER);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // Flash
  this.addAbility(FlashAbility.getInstance());
  // When Selfless Squire enters the battlefield, prevent all damage that would be dealt to you this turn.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new PreventDamageToControllerEffect(Duration.EndOfTurn), false));
  // Whenever damage that would be dealt to you is prevented, put that many +1/+1 counters on Selfless Squire.
  this.addAbility(new SelflessSquireTriggeredAbility());
}
origin: magefree/mage

public DruidsDeliverance(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
  // Prevent all combat damage that would be dealt to you this turn. Populate.
  // (Create a token that's a copy of a creature token you control.)
  this.getSpellAbility().addEffect(new PreventDamageToControllerEffect(Duration.EndOfTurn, true, false, Integer.MAX_VALUE));
  this.getSpellAbility().addEffect(new PopulateEffect());
}
origin: magefree/mage

public ThoughtLash(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}");
  // Cumulative upkeep - Exile the top card of your library.
  this.addAbility(new CumulativeUpkeepAbility(new ExileFromTopOfLibraryCost(1)));
  // When a player doesn't pay Thought Lash's cumulative upkeep, that player exiles all cards from their library.
  this.addAbility(new ThoughtLashTriggeredAbility());
  // Exile the top card of your library: Prevent the next 1 damage that would be dealt to you this turn.
  this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.EndOfTurn, 1), new ExileFromTopOfLibraryCost(1)));
}
origin: magefree/mage

public RiotControl(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}");
  // Gain 1 life for each creature your opponents control. Prevent all damage that would be dealt to you this turn.
  this.getSpellAbility().addEffect(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter)));
  this.getSpellAbility().addEffect(new PreventDamageToControllerEffect(Duration.EndOfTurn));
}
origin: magefree/mage

public GlacialChasm(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
  // Cumulative upkeep-Pay 2 life.
  this.addAbility(new CumulativeUpkeepAbility(new PayLifeCost(2)));
  // When Glacial Chasm enters the battlefield, sacrifice a land.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeControllerEffect(StaticFilters.FILTER_LAND, 1, "")));
  // Creatures you control can't attack.
  FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
  filter.add(new ControllerPredicate(TargetController.YOU));
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackAnyPlayerAllEffect(Duration.WhileOnBattlefield, filter)));
  // Prevent all damage that would be dealt to you.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.WhileOnBattlefield)));
}
origin: magefree/mage

public SolitaryConfinement(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}");
  // At the beginning of your upkeep, sacrifice Solitary Confinement unless you discard a card.
  this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeSourceUnlessPaysEffect(new DiscardTargetCost(new TargetCardInHand())), TargetController.YOU, false));
  // Skip your draw step.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipDrawStepEffect()));
  // You have shroud.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(ShroudAbility.getInstance())));
  // Prevent all damage that would be dealt to you.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.WhileOnBattlefield)));
}
origin: magefree/mage

public EsperBattlemage(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{U}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.WIZARD);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // {W}, {tap}: Prevent the next 2 damage that would be dealt to you this turn.
  SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
      new PreventDamageToControllerEffect(Duration.EndOfTurn, 2),
      new ColoredManaCost(ColoredManaSymbol.W));
  ability.addCost(new TapSourceCost());
  this.addAbility(ability);
  // {B}, {tap}: Target creature gets -1/-1 until end of turn.
  ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
      new BoostTargetEffect(-1, -1, Duration.EndOfTurn),
      new ColoredManaCost(ColoredManaSymbol.B));
  ability.addCost(new TapSourceCost());
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}
origin: magefree/mage

public SecurityBlockade(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
  this.subtype.add(SubType.AURA);
  this.color.setWhite(true);
  // Enchant land
  TargetPermanent auraTarget = new TargetLandPermanent();
  this.getSpellAbility().addTarget(auraTarget);
  this.getSpellAbility().addEffect(new AttachEffect(Outcome.PutCreatureInPlay));
  Ability ability = new EnchantAbility(auraTarget.getTargetName());
  this.addAbility(ability);
  // When Security Blockade enters the battlefield, create a 2/2 white Knight creature token with vigilance.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KnightToken())));
  // Enchanted land has "{T}: Prevent the next 1 damage that would be dealt to you this turn."
  ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToControllerEffect(Duration.EndOfTurn, 1), new TapSourceCost());
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability, AttachmentType.AURA, Duration.WhileOnBattlefield, rule)));
}
mage.abilities.effects.commonPreventDamageToControllerEffect

Most used methods

  • <init>
  • preventDamageAction
  • setText

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JOptionPane (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now