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

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

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

Ability.addTarget介绍

[英]Adds a target to this ability that must be satisfied before this ability is put onto the stack.
[中]向该技能添加一个目标,在将该技能放入堆栈之前必须满足该目标。

代码示例

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

public BazaarKrovod(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}");
  this.subtype.add(SubType.BEAST);
  this.power = new MageInt(2);
  this.toughness = new MageInt(5);
  // Whenever Bazaar Krovod attacks, another target attacking creature gets +0/+2 until end of turn. Untap that creature.
  Ability ability = new AttacksTriggeredAbility(new BazaarKrovodEffect(), false);
  ability.addTarget(new TargetAttackingCreature(1, 1, filter, false));
  this.addAbility(ability);
}

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

public AlchorsTomb(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
  // {2}, {tap}: Target permanent you control becomes the color of your choice.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(Duration.WhileOnBattlefield), new GenericManaCost(2));
  ability.addCost(new TapSourceCost());
  ability.addTarget(new TargetControlledPermanent());
  this.addAbility(ability);
}

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

public AkoumBoulderfoot(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{R}");
  this.subtype.add(SubType.GIANT);
  this.subtype.add(SubType.WARRIOR);
  this.power = new MageInt(4);
  this.toughness = new MageInt(5);
  Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(1), false);
  Target target = new TargetAnyTarget();
  ability.addTarget(target);
  this.addAbility(ability);
}

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

public AmuletOfKroog(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
  // {2}, {tap}: Prevent the next 1 damage that would be dealt to any target this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), new GenericManaCost(2));
  ability.addCost(new TapSourceCost());
  ability.addTarget(new TargetAnyTarget());
  this.addAbility(ability);
}

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

public AlabornCavalier(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{W}");
  this.subtype.add(SubType.HUMAN);
  this.subtype.add(SubType.KNIGHT);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // Whenever Alaborn Cavalier attacks, you may tap target creature.
  Ability ability = new AttacksTriggeredAbility(new TapTargetEffect(), true);
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

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

public AnglerDrake(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
  
  this.subtype.add(SubType.DRAKE);
  this.power = new MageInt(4);
  this.toughness = new MageInt(4);
  // Flying
  this.addAbility(FlyingAbility.getInstance());
  // When Angler Drake enters the battlefield, you may return target creature to its owner's hand.
  Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

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

public BloodlustInciter(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
  this.subtype.add(SubType.HUMAN, SubType.WARRIOR);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  // {T}: Target creature gains haste until end of turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), new TapSourceCost());
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

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

public AmphinPathmage(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}");
  this.subtype.add(SubType.SALAMANDER);
  this.subtype.add(SubType.WIZARD);
  this.power = new MageInt(3);
  this.toughness = new MageInt(2);
  // {2}{U}: Target creature can't be blocked this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBeBlockedTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{2}{U}"));
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

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

public BeaconBehemoth (UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{G}");
  this.subtype.add(SubType.BEAST);
  this.power = new MageInt(5);
  this.toughness = new MageInt(3);
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{1}"));
  ability.addTarget(new TargetCreaturePermanent(filter));
  this.addAbility(ability);
}

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

public BenevolentAncestor(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}");
  this.subtype.add(SubType.SPIRIT);
  this.power = new MageInt(0);
  this.toughness = new MageInt(4);
  this.addAbility(DefenderAbility.getInstance());
  // {tap}: Prevent the next 1 damage that would be dealt to any target this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), new TapSourceCost());
  ability.addTarget(new TargetAnyTarget());
  this.addAbility(ability);
}

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

public BishopOfTheBloodstained(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
  this.subtype.add(SubType.VAMPIRE);
  this.subtype.add(SubType.CLERIC);
  this.power = new MageInt(3);
  this.toughness = new MageInt(3);
  // When Bishop of the Bloodstained enters the battlefield, target opponent loses 1 life for each vampire you control.
  Ability ability = new EntersBattlefieldTriggeredAbility(new LoseLifeTargetEffect(new PermanentsOnBattlefieldCount(filter)));
  ability.addTarget(new TargetOpponent());
  this.addAbility(ability);
}

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

public AfiyaGrove(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
  // Afiya Grove enters the battlefield with three +1/+1 counters on it.
  this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)), "with three +1/+1 counters on it"));
  // At the beginning of your upkeep, move a +1/+1 counter from Afiya Grove onto target creature.
  Ability ability = new BeginningOfUpkeepTriggeredAbility(new MoveCounterToTargetFromSourceEffect(), TargetController.YOU, false);
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
  // When Afiya Grove has no +1/+1 counters on it, sacrifice it.
  this.addAbility(new AfiyaGroveNoCountersAbility());
}

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

public AlabasterWall(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}");
  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 any target this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), new TapSourceCost());
  ability.addTarget(new TargetAnyTarget());
  this.addAbility(ability);
}

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

public AncientHellkite(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}{R}");
  this.subtype.add(SubType.DRAGON);
  this.power = new MageInt(6);
  this.toughness = new MageInt(6);
  // Flying
  this.addAbility(FlyingAbility.getInstance());
  // {R}: Ancient Hellkite deals 1 damage to target creature defending player controls. Activate this ability only if Ancient Hellkite is attacking.
  Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R}"), SourceAttackingCondition.instance);
  ability.addTarget(new TargetPermanent(filter));
  this.addAbility(ability);
}

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

public BloodriteInvoker (UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
  this.subtype.add(SubType.VAMPIRE, SubType.SHAMAN);
  this.power = new MageInt(3);
  this.toughness = new MageInt(1);
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseLifeTargetEffect(3), new GenericManaCost(8));
  ability.addEffect(new GainLifeEffect(3));
  ability.addTarget(new TargetPlayer());
  this.addAbility(ability);
}

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

public AkroanMastiff(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}");
  this.subtype.add(SubType.HOUND);
  this.power = new MageInt(2);
  this.toughness = new MageInt(2);
  // {W},{T}: Tap target creature.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new ManaCostsImpl("{W}"));
  ability.addCost(new TapSourceCost());
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

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

public AmberPrison(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
  // You may choose not to untap Amber Prison during your untap step.
  this.addAbility(new SkipUntapOptionalAbility());
  // {4}, {tap}: Tap target artifact, creature, or land. That permanent doesn't untap during its controller's untap step for as long as Amber Prison remains tapped.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new GenericManaCost(4));
  ability.addCost(new TapSourceCost());
  ability.addTarget(new TargetPermanent(filter));
  ability.addEffect(new DontUntapAsLongAsSourceTappedEffect());
  this.addAbility(ability);
}

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

public BenBenAkkiHermit(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
  addSuperType(SuperType.LEGENDARY);
  this.subtype.add(SubType.GOBLIN, SubType.SHAMAN);
  this.power = new MageInt(1);
  this.toughness = new MageInt(1);
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter), true), new TapSourceCost());
  ability.addTarget(new TargetAttackingCreature());
  this.addAbility(ability);
}

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

public AlchemistsVial(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
  // When Alchemist's Vial enters the battlefield, draw a card.
  this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1)));
  // {1}, {T}: Sacrifice Alchemist's Vial: Target creature can't attack or block this turn.
  Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantAttackBlockTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}"));
  ability.addCost(new TapSourceCost());
  ability.addCost(new SacrificeSourceCost());
  ability.addTarget(new TargetCreaturePermanent());
  this.addAbility(ability);
}

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

public AltarOfShadows(UUID ownerId, CardSetInfo setInfo) {
  super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{7}");
  // At the beginning of your precombat main phase, add {B} for each charge counter on Altar of Shadows.
  this.addAbility(new BeginningOfPreCombatMainTriggeredAbility(new AltarOfShadowsEffect(), TargetController.YOU, false));
  
  // {7}, {tap}: Destroy target creature. Then put a charge counter on Altar of Shadows.
  Ability destroyAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new GenericManaCost(7));
  destroyAbility.addCost(new TapSourceCost());
  destroyAbility.addEffect(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(), true));
  destroyAbility.addTarget(new TargetCreaturePermanent());
  this.addAbility(destroyAbility);
}

相关文章