mage.abilities.Ability.addEffect()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(13.8k)|赞(0)|评价(0)|浏览(58)

本文整理了Java中mage.abilities.Ability.addEffect()方法的一些代码示例,展示了Ability.addEffect()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.addEffect()方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:addEffect

Ability.addEffect介绍

[英]Adds an effect to this ability.
[中]为该能力添加效果。

代码示例

代码示例来源:origin: magefree/mage

public BreakingWave(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}");
  Effect effect = new BreakingWaveEffect();
  // You may cast Breaking Wave as though it had flash if you pay {2} more to cast it.
  Ability ability = new PayMoreToCastAsThoughtItHadFlashAbility(this, new ManaCostsImpl("{2}"));
  ability.addEffect(effect);
  this.addAbility(ability);
  // Simultaneously untap all tapped creatures and tap all untapped creatures.
  this.getSpellAbility().addEffect(effect);
}

代码示例来源:origin: magefree/mage

public ConjurersCloset(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
  // At the beginning of your end step, you may exile target creature you control, then return that card to the battlefield under your control.
  Ability ability = new BeginningOfYourEndStepTriggeredAbility(new ExileTargetForSourceEffect(), true);
  ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true));
  ability.addTarget(new TargetControlledCreaturePermanent());
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public ChampionOfDusk(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
  this.subtype.add(SubType.VAMPIRE);
  this.subtype.add(SubType.KNIGHT);
  this.power = new MageInt(4);
  this.toughness = new MageInt(4);
  // When Champion of Dusk enters the battlefield, you draw X cards and you lose X life, where X is the number of Vampires you control.
  DynamicValue xCount = new PermanentsOnBattlefieldCount(filter);
  Ability ability = new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(xCount));
  ability.addEffect(new LoseLifeSourceControllerEffect(xCount));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public JunkyoBell(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
  // At the beginning of your upkeep, you may have target creature you control get +X/+X until end of turn,
  // where X is the number of creatures you control. If you do, sacrifice that creature at the beginning of the next end step.
  PermanentsOnBattlefieldCount amount = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent());
  Ability ability = new BeginningOfUpkeepTriggeredAbility(new BoostTargetEffect(amount, amount, Duration.EndOfTurn, true), TargetController.YOU, true);
  ability.addTarget(new TargetControlledCreaturePermanent());
  ability.addEffect(new JunkyoBellSacrificeEffect());
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public BudokaGardener(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
  this.subtype.add(SubType.HUMAN, SubType.MONK);
  this.power = new MageInt(2);
  this.toughness = new MageInt(1);
  this.flipCard = true;
  this.flipCardName = "Dokai, Weaver of Life";
  // {T}: You may put a land card from your hand onto the battlefield. If you control ten or more lands, flip Budoka Gardener.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutCardFromHandOntoBattlefieldEffect(StaticFilters.FILTER_CARD_LAND_A), new TapSourceCost());
  ability.addEffect(new BudokaGardenerEffect());
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public BottledCloister(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
  // At the beginning of each opponent's upkeep, exile all cards from your hand face down.
  this.addAbility(new BeginningOfUpkeepTriggeredAbility(new BottledCloisterExileEffect(), TargetController.OPPONENT, false));
  // At the beginning of your upkeep, return all cards you own exiled with Bottled Cloister to your hand, then draw a card.
  Ability ability = new BeginningOfUpkeepTriggeredAbility(new BottledCloisterReturnEffect(), TargetController.YOU, false);
  Effect effect = new DrawCardSourceControllerEffect(1);
  effect.setText(", then draw a card");
  ability.addEffect(effect);
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public CherishedHatchling(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
  this.subtype.add(SubType.DINOSAUR);
  this.power = new MageInt(2);
  this.toughness = new MageInt(1);
  // When Cherished Hatchling dies, you may cast Dinosaur spells this turn as though they had flash, and whenever you cast a Dinosaur spell this turn, it gains "When this creature enters the battlefield, you may have it fight another target creature."
  Ability ability = new DiesTriggeredAbility(new CastAsThoughItHadFlashAllEffect(Duration.EndOfTurn, filterCard, false));
  ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new CherishedHatchlingTriggeredAbility()));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public HighwayRobber(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.MERCENARY);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  Ability ability = new EntersBattlefieldTriggeredAbility(new GainLifeEffect(2));
  ability.addTarget(new TargetOpponent());
  ability.addEffect(new LoseLifeTargetEffect(2));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public BlanketOfNight(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}");
  
  // Each land is a Swamp in addition to its other land types.
  Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new BlackManaAbility(), Duration.WhileOnBattlefield, new FilterLandPermanent(),
      "Each land is a Swamp in addition to its other land types"));
  ability.addEffect(new AddCardSubtypeAllEffect(StaticFilters.FILTER_LAND, SubType.SWAMP, DependencyType.BecomeSwamp));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public LaccolithGrunt(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
  this.subtype.add(SubType.BEAST);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // Whenever Laccolith Grunt becomes blocked, you may have it deal damage equal to its power to target creature. If you do, Laccolith Grunt assigns no combat damage this turn.
  Ability ability = new BecomesBlockedTriggeredAbility(new LaccolithEffect().setText("you may have it deal damage equal to its power to target creature"), true);
  ability.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn, true));
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public InnerFlameIgniter(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
  this.subtype.add(SubType.ELEMENTAL);
  this.subtype.add(SubType.WARRIOR);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // {2}{R}: Creatures you control get +1/+0 until end of turn. If this is the third time this ability has resolved this turn, creatures you control gain first strike until end of turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1,0,Duration.EndOfTurn), new ManaCostsImpl("{2}{R}"));
  ability.addEffect(new InnerFlameIgniterEffect());
  this.addAbility(ability);        
}

代码示例来源:origin: magefree/mage

public BreakThroughTheLine(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
  // {R}: Target creature with power 2 or less gains haste until end of turn and can't be blocked this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{R}"));
  Effect effect = new CantBeBlockedTargetEffect(Duration.EndOfTurn);
  effect.setText("and can't be blocked this turn");
  ability.addEffect(effect);
  ability.addTarget(new TargetCreaturePermanent(filter));
  this.addAbility(ability);
  
}

代码示例来源:origin: magefree/mage

public KukemssaPirates(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.PIRATE);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // Whenever Kukemssa Pirates attacks and isn't blocked, you may gain control of target artifact defending player controls. If you do, Kukemssa Pirates assigns no combat damage this turn.
  Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(new GainControlTargetEffect(Duration.Custom), true);
  ability.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn, true));
  ability.addTarget(new TargetArtifactPermanent(filter));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public Cloudform(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}{U}");
  // When Cloudform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Cloudform to it.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new BecomesAuraAttachToManifestSourceEffect()));
  
  // Enchanted creature has flying and hexproof.
  Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield));
  Effect effect = new GainAbilityAttachedEffect(HexproofAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield);
  effect.setText("and hexproof");
  ability.addEffect(effect);
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public EzurisBrigade (UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{G}");
  this.subtype.add(SubType.ELF);
  this.subtype.add(SubType.WARRIOR);
  this.power = new MageInt(4);
  this.toughness = new MageInt(4);
  ContinuousEffect boostSource = new BoostSourceEffect(4, 4, Duration.WhileOnBattlefield);
  ConditionalContinuousEffect effect = new ConditionalContinuousEffect(boostSource, MetalcraftCondition.instance, text);
  Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
  ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield), MetalcraftCondition.instance, ""));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public InquisitorsOx(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}");
  this.subtype.add(SubType.OX);
  this.power = new MageInt(2);
  this.toughness = new MageInt(5);
  this.color.setWhite(true);
  // <i>Delirium</i> &mdash; Inquisitor's Ox gets +1/+0 and has vigilance as long as there are four or more card types among cards in your graveyard.
  ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new BoostSourceEffect(1, 0, Duration.WhileOnBattlefield), DeliriumCondition.instance, "<i>Delirium</i> &mdash; {this} gets +1/+0");
  Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
  ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance()), DeliriumCondition.instance, "and has vigilance as long as there are four or more card types among cards in your graveyard."));
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public ConsumptiveGoo(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{B}");
  this.subtype.add(SubType.OOZE);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // {2}{B}{B}: Target creature gets -1/-1 until end of turn. Put a +1/+1 counter on Consumptive Goo.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(-1, -1, Duration.EndOfTurn), new ManaCostsImpl("{2}{B}{B}"));
  ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public CelestialDawn(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
  // Lands you control are Plains.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CelestialDawnToPlainsEffect()));
  // Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white.
  this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CelestialDawnToWhiteEffect()));
  // You may spend white mana as though it were mana of any color.
  // You may spend other mana only as though it were colorless mana.
  Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CelestialDawnSpendAnyManaEffect());
  ability.addEffect(new CelestialDawnSpendColorlessManaEffect());
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public DragonMask(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
  // {3}, {tap}: Target creature you control gets +2/+2 until end of turn. Return it to its owner's hand at the beginning of the next end step.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 2, Duration.EndOfTurn), new GenericManaCost(3));
  ability.addCost(new TapSourceCost());
  ability.addTarget(new TargetControlledCreaturePermanent());
  Effect returnEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnToHandTargetEffect()));
  returnEffect.setText("Return it to its owner's hand at the beginning of the next end step");
  ability.addEffect(returnEffect);
  this.addAbility(ability);
}

代码示例来源:origin: magefree/mage

public Benthicore(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{U}");
  this.subtype.add(SubType.ELEMENTAL);
  this.power = new MageInt(5);
  this.toughness = new MageInt(5);
  
  // When Benthicore enters the battlefield, create two 1/1 blue Merfolk Wizard creature tokens.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MerfolkWizardToken(), 2), false));
  
  // Tap two untapped Merfolk you control: Untap Benthicore. It gains shroud until end of turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new TapTargetCost(new TargetControlledPermanent(2, 2, filter, false)));
  ability.addEffect(new GainAbilitySourceEffect(ShroudAbility.getInstance(), Duration.EndOfTurn));
  this.addAbility(ability);
}

相关文章