本文整理了Java中mage.abilities.Ability.getEffects()
方法的一些代码示例,展示了Ability.getEffects()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.getEffects()
方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:getEffects
[英]Retrieves the effects that are put into the place by the resolution of this ability.
[中]检索通过此技能的分辨率放置到该位置的效果。
代码示例来源:origin: magefree/mage
public void discardEffects() {
for (Ability ability : abilites) {
for (Effect effect : ability.getEffects()) {
if (effect instanceof ContinuousEffect) {
((ContinuousEffect) effect).discard();
}
}
}
}
代码示例来源:origin: magefree/mage
public void discardEffects() {
for (Ability ability : abilites) {
for (Effect effect : ability.getEffects()) {
if (effect instanceof ContinuousEffect) {
((ContinuousEffect) effect).discard();
}
}
}
}
代码示例来源:origin: magefree/mage
@Override
public int getOutcomeTotal() {
return stream().mapToInt(ability -> ability.getEffects().getOutcomeTotal()).sum();
}
代码示例来源:origin: magefree/mage
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) {
super(duration, layer, subLayer,
!ability.getEffects().isEmpty() ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility);
this.ability = ability;
staticText = rule;
this.onCard = onCard;
this.addDependencyType(DependencyType.AddingAbility);
}
代码示例来源:origin: magefree/mage
@Override
public void filter(Game game, List<Ability> actions) {
for (Ability ability : actions) {
for (Effect effect: ability.getEffects()) {
if (effect.getOutcome() == Outcome.AIDontUseIt) {
removeAbility(ability);
break;
}
}
}
}
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
source.getEffects().get(2).setValue("MetalcraftConcussiveBolt", MetalcraftCondition.instance.apply(game, source));
return true;
}
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
UUID creatureId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
if (creature != null) {
ability.getEffects().get(0).setTargetPointer(new FixedTarget(creature.getControllerId()));
}
}
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
UUID controllerId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
if (controllerId != null) {
ability.getTargets().get(0).setTargetController(controllerId);
ability.getEffects().get(0).setTargetPointer(new FirstTargetPointer());
}
}
}
代码示例来源:origin: magefree/mage
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Permanent permanent = game.getPermanent(ability.getSourceId());
List<UUID> attachments = permanent.getAttachments();
for (UUID attachmentId : attachments) {
Permanent attachment = game.getPermanent(attachmentId);
if (attachment != null && attachment.getName().equals("Blazing Torch")) {
((BlazingTorchDamageEffect) ability.getEffects().get(0)).setSourceId(attachmentId);
paid |= attachment.sacrifice(sourceId, game);
return paid;
}
}
return paid;
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
UUID playerId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
if (playerId != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that player controls");
filter.add(new ControllerIdPredicate(playerId));
Target target = new TargetCreaturePermanent(filter);
ability.getTargets().clear();
ability.addTarget(target);
ability.getEffects().get(0).setTargetPointer(new FirstTargetPointer());
}
}
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
for (Effect effect : ability.getEffects()) {
if (effect instanceof ReturnFromGraveyardToBattlefieldTargetEffect) {
int xValue = GetXValue.instance.calculate(game, ability, null);
ability.getTargets().clear();
ability.addTarget(new TargetCardInYourGraveyard(xValue, xValue, new FilterCreatureCard("creature cards from your graveyard")));
}
}
}
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
for (Effect effect : source.getEffects()) {
if (effect.getTargetPointer().getFirst(game, source) != null) {
permanent = game.getPermanentOrLKIBattlefield(effect.getTargetPointer().getFirst(game, source));
}
}
if (permanent != null) {
return permanent.getCounters(game).containsKey(CounterType.M1M1);
}
return false;
}
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
UUID creatureId = ability.getEffects().get(0).getTargetPointer().getFirst(game, ability);
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
ability.getTargets().get(0).setTargetController(creature.getControllerId());
}
}
}
代码示例来源:origin: magefree/mage
public SpectralSearchlight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {T}: Choose a player. That player adds one mana of any color they chooses.
ManaEffect effect = new SpectralSearchlightManaEffect("chosen player");
effect.setText("That player adds one mana of any color they choose");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
// choosing player as first effect, before adding mana effect
ability.getEffects().add(0, new ChoosePlayerEffect(Outcome.PutManaInPool));
this.addAbility(ability);
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(source.getFirstTarget());
if (spell != null) {
source.getEffects().get(1).setTargetPointer(new FixedTarget(spell.getControllerId()));
return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
}
return false;
}
代码示例来源:origin: magefree/mage
public SphereOfTheSuns(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Sphere of the Suns enters the battlefield tapped and with three charge counters on it.
Ability ability = new EntersBattlefieldTappedAbility(ruleText);
((EntersBattlefieldEffect) ability.getEffects().get(0)).addEffect(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)));
this.addAbility(ability);
RemoveCountersSourceCost removeCounterCost = new RemoveCountersSourceCost(CounterType.CHARGE.createInstance());
ability = new AnyColorManaAbility();
ability.addCost(removeCounterCost);
this.addAbility(ability);
}
代码示例来源:origin: magefree/mage
public GuildmagesForum(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {1}, {T}: Add one mana of any color. If that mana is spent on a multicolored creature spell, that creature enters the battlefield with an additional +1/+1 counter on it.
Ability ability = new AnyColorManaAbility(new GenericManaCost(1), true);
ability.getEffects().get(0).setText("Add one mana of any color. If that mana is spent on a multicolored creature spell, that creature enters the battlefield with an additional +1/+1 counter on it");
ability.addCost(new TapSourceCost());
this.addAbility(ability, new GuildmagesForumWatcher(ability));
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
Player opponent = game.getPlayer(ability.getEffects().get(0).getTargetPointer().getFirst(game, ability));
if (opponent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature controlled by " + opponent.getLogName());
filter.add(new ControllerIdPredicate(opponent.getId()));
ability.getTargets().add(new TargetCreaturePermanent(filter));
}
}
}
代码示例来源:origin: magefree/mage
public VictoryChimes(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Untap Victory Chimes during each other player's untap step.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UntapSourceDuringEachOtherPlayersUntapStepEffect()));
// {T}: A player of your choice adds {C}.
ManaEffect effect = new VictoryChimesManaEffect("chosen player");
effect.setText("a player of your choice adds {C}");
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, effect, new TapSourceCost());
// choosing player as first effect, before adding mana effect
ability.getEffects().add(0, new ChoosePlayerEffect(Outcome.PutManaInPool).setText(""));
this.addAbility(ability);
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
Spell spell = game.getStack().getSpell(ability.getEffects().get(0).getTargetPointer().getFirst(game, ability));
if (spell != null) {
int cmc = spell.getConvertedManaCost();
ability.getTargets().clear();
FilterPermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + cmc);
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, cmc));
ability.addTarget(new TargetPermanent(filter));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!