本文整理了Java中mage.abilities.Ability.getOriginalId()
方法的一些代码示例,展示了Ability.getOriginalId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.getOriginalId()
方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:getOriginalId
[英]Get the originalId of the ability
[中]获取该能力的原始ID
代码示例来源:origin: magefree/mage
@Override
public UUID getOriginalId() {
return this.ability.getOriginalId();
}
代码示例来源:origin: magefree/mage
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getOriginalId().equals(originalId);
}
代码示例来源:origin: magefree/mage
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getOriginalId().equals(originalId);
}
代码示例来源:origin: magefree/mage
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getOriginalId().equals(originalId);
}
代码示例来源:origin: magefree/mage
public static PlayerQueryEvent askEvent(UUID playerId, String message, Ability source, Map<String, Serializable> options) {
if (source != null) {
if (options == null) {
options = new HashMap<>();
}
options.put("originalId", source.getOriginalId());
}
return new PlayerQueryEvent(playerId, message, null, null, null, null, QueryType.ASK, 0, 0, false, options);
}
代码示例来源:origin: magefree/mage
@Override
public boolean contains(T ability) {
for (Iterator<T> iterator = this.iterator(); iterator.hasNext();) { // simple loop can cause java.util.ConcurrentModificationException
T test = iterator.next();
// Checking also by getRule() without other restrictions is a problem when a triggered ability will be copied to a permanent that had the same ability
// already before the copy. Because then it keeps the triggered ability twice and it triggers twice.
// e.g. 2 Biovisonary and one enchanted with Infinite Reflection
if (ability.getId().equals(test.getId())) {
return true;
}
if (ability.getOriginalId().equals(test.getId())) {
return true;
}
if (ability instanceof MageSingleton && test instanceof MageSingleton && ability.getRule().equals(test.getRule())) {
return true;
}
}
return false;
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(entersBattlefieldAbilityID)) {
// up to X target Zombie cards from your graveyard
// X is the number of opponents you have.
ability.getTargets().clear();
int numbTargets = OpponentsCount.instance.calculate(game, ability, null);
ability.addTarget(new TargetCardInYourGraveyard(0, numbTargets, filterZombie));
}
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.OPTION_USED, source.getOriginalId(), source.getSourceId(), source.getControllerId(), value));
return true;
}
}
代码示例来源:origin: magefree/mage
public PrimalWellspring(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
this.nightCard = true;
// Add one mana of any color.
Ability ability = new AnyColorManaAbility();
this.addAbility(ability);
// When that mana is spent to cast an instant or sorcery spell, copy that spell and you may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell and you may choose new targets for the copy");
this.addAbility(new PyrimalWellspringTriggeredAbility(ability.getOriginalId(), effect));
}
代码示例来源:origin: magefree/mage
Boolean answer = requestAutoAnswerId.get(source.getOriginalId() + "#" + message);
if (answer != null) {
return answer;
代码示例来源:origin: magefree/mage
public PyromancersGoggles(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
addSuperType(SuperType.LEGENDARY);
// {T}: Add {R}.
Ability ability = new RedManaAbility();
this.addAbility(ability);
// When that mana is used to cast a red instant or sorcery spell, copy that spell and you may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell and you may choose new targets for the copy");
this.addAbility(new PyromancersGogglesTriggeredAbility(ability.getOriginalId(), effect));
}
代码示例来源:origin: magefree/mage
public OpalPalace(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Add one mana of any color in your commander's color identity. If you spend this mana to cast your commander, it enters the battlefield with a number of +1/+1 counters on it equal to the number of times it's been cast from the command zone this game.
Ability ability = new CommanderColorIdentityManaAbility(new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability, new OpalPalaceWatcher(ability.getOriginalId().toString()));
ability = new SimpleStaticAbility(Zone.ALL, new OpalPalaceEntersBattlefieldEffect());
ability.setRuleVisible(false);
this.addAbility(ability);
}
代码示例来源:origin: magefree/mage
public RotHulk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}");
this.subtype.add(SubType.ZOMBIE);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Menace
this.addAbility(new MenaceAbility(false));
// When Rot Hulk enters the battlefield, return up to X target Zombie cards from your graveyard to the battlefield, where X is the number of opponents you have.
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
effect.setText("return up to X target Zombie cards from your graveyard to the battlefield, where X is the number of opponents you have.");
Ability ability = new EntersBattlefieldTriggeredAbility(effect);
ability.addTarget(new TargetCardInYourGraveyard());
entersBattlefieldAbilityID = ability.getOriginalId(); // adjust targets
this.addAbility(ability);
}
代码示例来源:origin: magefree/mage
public void addMana(Mana manaToAdd, Game game, Ability source, boolean emptyOnTurnsEnd) {
if (manaToAdd != null) {
Mana mana = manaToAdd.copy();
if (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source.getSourceId(), playerId, mana))) {
if (mana instanceof ConditionalMana) {
ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game),
((ConditionalMana) mana).getManaProducerOriginalId() != null ? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId());
if (emptyOnTurnsEnd) {
item.setDuration(Duration.EndOfTurn);
}
this.manaItems.add(item);
} else {
ManaPoolItem item = new ManaPoolItem(mana.getRed(), mana.getGreen(), mana.getBlue(), mana.getWhite(), mana.getBlack(), mana.getGeneric() + mana.getColorless(), source.getSourceObject(game), source.getOriginalId(), mana.getFlag());
if (emptyOnTurnsEnd) {
item.setDuration(Duration.EndOfTurn);
}
this.manaItems.add(item);
}
ManaEvent manaEvent = new ManaEvent(EventType.MANA_ADDED, source.getId(), source.getSourceId(), playerId, mana);
manaEvent.setData(mana.toString());
game.fireEvent(manaEvent);
}
}
}
代码示例来源:origin: magefree/mage
boolean found = false;
for (Ability ability : sourcePermanent.getAbilities()) {
if (ability instanceof CommanderColorIdentityManaAbility && ability.getOriginalId().toString().equals(event.getData())) {
found = true;
break;
代码示例来源:origin: magefree/mage
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = game.getCard(event.getTargetId());
if (card != null) {
if (controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true)) {
game.applyEffects(); // needed to add Madness ability to cards (e.g. by Falkenrath Gorger)
GameEvent gameEvent = GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), source.getOriginalId(), controller.getId());
game.fireEvent(gameEvent);
}
return true;
}
}
return false;
}
代码示例来源:origin: magefree/mage
public CavernOfSouls(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// As Cavern of Souls enters the battlefield, choose a creature type.
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature)));
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {T}: Add one mana of any color. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
Ability ability = new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new CavernOfSoulsManaBuilder(), true);
this.addAbility(ability, new CavernOfSoulsWatcher(ability.getOriginalId()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect()));
}
代码示例来源:origin: magefree/mage
public Pteramander(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}");
this.subtype.add(SubType.SALAMANDER);
this.subtype.add(SubType.DRAKE);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {7}{U}: Adapt 4. This ability costs {1} less to activate for each instant and sorcery card in your graveyard.
// TODO: Make ability properly copiable
Ability ability = new SimpleActivatedAbility(new AdaptEffect(4).setText("Adapt 4. This ability costs {1} less to activate for each instant and sorcery card in your graveyard."), new ManaCostsImpl("{7}{U}"));
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new PteramanderCostIncreasingEffect(ability.getOriginalId())));
}
代码示例来源:origin: magefree/mage
public NemesisOfMortals(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.SNAKE);
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Nemesis of Mortals costs {1} less to cast for each creature card in your graveyard.
Ability ability = new SimpleStaticAbility(Zone.ALL, new SourceCostReductionForEachCardInGraveyardEffect(new FilterCreatureCard()));
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// {7}{G}{G}: Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard.
// TODO: Make ability properly copiable
ability = new MonstrosityAbility("{7}{G}{G}", 5);
for (Effect effect : ability.getEffects()) {
effect.setText("Monstrosity 5. This ability costs {1} less to activate for each creature card in your graveyard");
}
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new NemesisOfMortalsCostReducingEffect(ability.getOriginalId())));
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
while (game.getBattlefield().count(filter, source.getOriginalId(), source.getControllerId(), game) > 0 &&
controller.chooseUse(outcome, "Look at a face-down attacking creature?", source, game)) {
if (!controller.canRespond()) {
return false;
}
Target target = new TargetCreaturePermanent(filter);
if (controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
Cards cards = new CardsImpl();
cards.add(card);
controller.lookAtCards(sourceObject.getName(), cards, game);
game.informPlayers(controller.getLogName() + " look at a face-down attacking creature");
}
}
}
}
return true;
}
}
内容来源于网络,如有侵权,请联系作者删除!