Tabnine Logo
GainAbilityControllerEffect
Code IndexAdd Tabnine to your IDE (free)

How to use
GainAbilityControllerEffect
in
mage.abilities.effects.common.continuous

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

origin: magefree/mage

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

@Override
public boolean apply(Game game, Ability source) {
  Player player = game.getPlayer(source.getControllerId());
  if (player != null) {
    player.addAbility(ability);
    if (duration == Duration.Custom) {
      if (game.getPermanent(source.getSourceId()) == null) {
        discard();
      }
    }
    return true;
  } else {
    discard();
  }
  return false;
}
origin: magefree/mage

public IvoryMask(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}");
  // You have shroud.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(ShroudAbility.getInstance())));
}
origin: magefree/mage

public LeylineOfSanctity(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}");
  // If Leyline of Sanctity is in your opening hand, you may begin the game with it on the battlefield.
  this.addAbility(LeylineAbility.getInstance());
  // You have hexproof. (You can't be the target of spells or abilities your opponents control.)
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(HexproofAbility.getInstance())));
}
origin: magefree/mage

public TrueBeliever(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.CLERIC);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // You have shroud.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(ShroudAbility.getInstance(), Duration.WhileOnBattlefield)));
}
origin: magefree/mage

public WitchbaneOrb(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
  // When Witchbane Orb enters the battlefield, destroy all Curses attached to you.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new WitchbaneOrbEffect()));
  // You have hexproof.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(HexproofAbility.getInstance())));
}
origin: magefree/mage

public OrbsOfWarding(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
  // You have hexproof.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield)));
  // If a creature would deal damage to you, prevent 1 of that damage.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OrbsOfWardingEffect()));
}
origin: magefree/mage

public AegisOfTheGods(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT,CardType.CREATURE},"{1}{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.SOLDIER);
  this.power = new MageInt(2);
  this.toughness = new MageInt(1);
  // You have hexproof.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield)));
}
origin: magefree/mage

public SpiritOfTheHearth(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{W}");
  this.subtype.add(SubType.CAT);
  this.subtype.add(SubType.SPIRIT);
  this.power = new MageInt(4);
  this.toughness = new MageInt(5);
  // Flying
  this.addAbility(FlyingAbility.getInstance());
  
  // You have hexproof.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield)));
  
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    game.addEffect(new GainAbilityControllerEffect(new TeferisProtectionAbility(), Duration.UntilYourNextTurn), source);
    return true;
  }
  return false;
}
origin: magefree/mage

public ImperialMask(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
  // When Imperial Mask enters the battlefield, if it's not a token, each of your teammates puts a token that's a copy of Imperial Mask onto the battlefield.
  // No implementation of teammates currently, so no effect needed
  this.addAbility(new ConditionalInterveningIfTriggeredAbility(
      new EntersBattlefieldTriggeredAbility(new InfoEffect("each of your teammates puts a token that's a copy of {this} onto the battlefield"), false),
      new SourceMatchesFilterCondition(filter),
      "When {this} enters the battlefield, if it's not a token, "
      + "each of your teammates puts a token that's a copy of {this} onto the battlefield"
  ));
  // You have hexproof.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(HexproofAbility.getInstance())));
}
origin: magefree/mage

public GildedLight(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}");
  // You gain shroud until end of turn.
  this.getSpellAbility().addEffect(new GainAbilityControllerEffect(ShroudAbility.getInstance(), Duration.EndOfTurn));
  // Cycling {2}
  this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}")));
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
  if (controller != null && cardName != null && !cardName.isEmpty()) {            
    FilterObject filter = new FilterObject("the name [" + cardName + ']');
    filter.add(new NamePredicate(cardName));            
    ContinuousEffect effect = new GainAbilityControllerEffect(new ProtectionAbility(filter), Duration.Custom);
    game.addEffect(effect, source);
    return true;
  }
  return false;
}
origin: magefree/mage

public FormOfTheSquirrel(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}");
  // As Form of the Squirrel enters the battlefield, create a 1/1 green Squirrel creature token. You lose the game when that creature leaves the battlefield.
  this.addAbility(new AsEntersBattlefieldAbility(new FormOfTheSquirrelCreateTokenEffect()));
  // Creatures can't attack you.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackYouAllEffect(Duration.WhileOnBattlefield)));
  // You have shroud.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControllerEffect(ShroudAbility.getInstance())));
  // You can't cast spells.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FormOfTheSquirrelCantCastEffect()));
}
origin: magefree/mage

public GruulSpellbreaker(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}");
  this.subtype.add(SubType.OGRE);
  this.subtype.add(SubType.WARRIOR);
  this.power = new MageInt(3);
  this.toughness = new MageInt(3);
  // Riot
  this.addAbility(new RiotAbility());
  // Trample
  this.addAbility(TrampleAbility.getInstance());
  // As long as it's your turn, you and Gruul Spellbreaker have hexproof.
  Ability ability = new SimpleStaticAbility(
      Zone.BATTLEFIELD,
      new ConditionalContinuousEffect(
          new GainAbilityControllerEffect(
              HexproofAbility.getInstance(),
              Duration.WhileOnBattlefield
          ), MyTurnCondition.instance, "As long as it's your turn, you and"
      )
  );
  ability.addEffect(new ConditionalContinuousEffect(
      new GainAbilitySourceEffect(
          HexproofAbility.getInstance(),
          Duration.WhileOnBattlefield
      ), MyTurnCondition.instance, "{this} have hexproof."
  ));
  this.addAbility(ability);
}
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 YodaEmblem() {
    this.setName("Emblem Yoda, Jedi Master");
    Effect effect = new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.EndOfGame);
    effect.setText("Hexproof, you");
    Ability ability = new SimpleStaticAbility(Zone.COMMAND, effect);
    effect = new GainAbilityControlledEffect(HexproofAbility.getInstance(), Duration.EndOfGame, new FilterCreaturePermanent());
    effect.setText(" you and your creatures have");
    ability.addEffect(effect);
    getAbilities().add(ability);
  }
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  MageObject mageObject = game.getObject(source.getSourceId());
  ChoiceColor choice = new ChoiceColor();
  if (controller != null && mageObject != null && controller.choose(Outcome.Protect, choice, game)) {
    game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
    FilterCard filter = new FilterCard();
    filter.add(new ColorPredicate(choice.getColor()));
    filter.setMessage(choice.getChoice());
    Ability ability = new ProtectionAbility(filter);
    game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
    return true;
  }
  return false;
}
origin: magefree/mage

public SigardaHeronsGrace(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{W}");
  addSuperType(SuperType.LEGENDARY);
  this.subtype.add(SubType.ANGEL);
  this.power = new MageInt(4);
  this.toughness = new MageInt(5);
  // Flying
  this.addAbility(FlyingAbility.getInstance());
  // You and Humans you control have hexproof.
  Effect effect = new GainAbilityControllerEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield);
  effect.setText("You and");
  Ability ability =new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
  effect = new GainAbilityControlledEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield, filter);
  effect.setText("and Humans you control have hexproof");
  ability.addEffect(effect);
  this.addAbility(ability);
  // {2}, Exile a card from your graveyard: Create a 1/1 white Human Soldier creature token.
  ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new HumanSoldierToken()), new GenericManaCost(2));
  ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard()));
  this.addAbility(ability);
}
origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  MageObject mageObject = game.getObject(source.getSourceId());
  if (controller != null && mageObject != null) {
    if (FatefulHourCondition.instance.apply(game, source)) {
      ChoiceColor choice = new ChoiceColor();
      if (!controller.choose(Outcome.Protect, choice, game)) {
        return false;
      }
      if (choice.getColor() != null) {
        game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
        FilterCard filter = new FilterCard();
        filter.add(new ColorPredicate(choice.getColor()));
        filter.setMessage(choice.getChoice());
        Ability ability = new ProtectionAbility(filter);
        game.addEffect(new GainAbilityControlledEffect(ability, Duration.EndOfTurn), source);
        game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
        return true;
      }
    } else {
      game.addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn), source);
      return true;
    }
  }
  return false;
}
mage.abilities.effects.common.continuousGainAbilityControllerEffect

Most used methods

  • <init>
  • discard

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Top plugins for Android Studio
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