use of mage.abilities.Ability in project mage by magefree.
the class MomirDuel method init.
@Override
protected void init(UUID choosingPlayerId) {
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Vanguard effects"));
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
Player player = getPlayer(playerId);
if (player != null) {
CardInfo cardInfo = CardRepository.instance.findCard("Momir Vig, Simic Visionary");
addEmblem(new MomirEmblem(), cardInfo.getCard(), playerId);
}
}
getState().addAbility(ability, null);
super.init(choosingPlayerId);
state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
}
use of mage.abilities.Ability in project mage by magefree.
the class AlchemistsGiftEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Ability ability = player.chooseUse(outcome, "Deathtouch or lifelink?", null, "Deathtouch", "Lifelink", source, game) ? DeathtouchAbility.getInstance() : LifelinkAbility.getInstance();
game.addEffect(new BoostTargetEffect(1, 1, Duration.EndOfTurn), source);
game.addEffect(new GainAbilityTargetEffect(ability, Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.Ability in project mage by magefree.
the class AngelicGuardianGainEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
if (you != null) {
game.getCombat().getAttackers().stream().map(game::getPermanent).filter(Objects::nonNull).filter(permanent -> permanent.isControlledBy(you.getId())).filter(permanent1 -> permanent1.isCreature(game)).forEach(permanent -> {
ContinuousEffect effect = new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
});
return true;
}
return false;
}
use of mage.abilities.Ability in project mage by magefree.
the class BloodForBonesEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getGraveyard().getCards(game).stream().noneMatch(card -> card.isCreature(game))) {
return false;
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter);
if (player.choose(outcome, player.getGraveyard(), target, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
}
if (player.getGraveyard().getCards(game).stream().noneMatch(card -> card.isCreature(game))) {
return true;
}
target = new TargetCardInYourGraveyard(filter2);
if (player.choose(outcome, player.getGraveyard(), target, game)) {
player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game);
}
return true;
}
use of mage.abilities.Ability in project mage by magefree.
the class GainReboundEffect method addReboundAbility.
private void addReboundAbility(Card card, Game game) {
if (CastThroughTime.filter.match(card, game)) {
boolean found = card.getAbilities(game).containsClass(ReboundAbility.class);
if (!found) {
Ability ability = new ReboundAbility();
game.getState().addOtherAbility(card, ability);
}
}
}
Aggregations