use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class UrzasScienceFairProjectEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int amount = controller.rollDice(outcome, source, game, 6);
Effect effect = null;
// 6 - gets +2/+2 until end of turn";
if (amount == 1) {
game.addEffect(new BoostSourceEffect(-2, -2, Duration.EndOfTurn), source);
} else if (amount == 2) {
game.addEffect(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), source);
} else if (amount == 3) {
game.addEffect(new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.EndOfTurn), source);
} else if (amount == 4) {
game.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), source);
} else if (amount == 5) {
game.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
} else if (amount == 6) {
game.addEffect(new BoostSourceEffect(+2, +2, Duration.EndOfTurn), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class WarrenPilferersReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (card != null && controller != null && controller.moveCards(card, Zone.HAND, source, game)) {
if (card.hasSubtype(SubType.GOBLIN, game)) {
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class GiantSlugEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller == null || sourcePermanent == null) {
return false;
}
ChoiceImpl choices = new ChoiceBasicLandType();
if (!controller.choose(outcome, choices, game)) {
return false;
}
game.informPlayers(sourcePermanent.getName() + ": Chosen basic land type is " + choices.getChoice());
switch(choices.getChoice()) {
case "Plains":
game.addEffect(new GainAbilitySourceEffect(new PlainswalkAbility(), Duration.EndOfTurn, false), source);
return true;
case "Island":
game.addEffect(new GainAbilitySourceEffect(new IslandwalkAbility(), Duration.EndOfTurn, false), source);
return true;
case "Swamp":
game.addEffect(new GainAbilitySourceEffect(new SwampwalkAbility(), Duration.EndOfTurn, false), source);
return true;
case "Mountain":
game.addEffect(new GainAbilitySourceEffect(new MountainwalkAbility(), Duration.EndOfTurn, false), source);
return true;
case "Forest":
game.addEffect(new GainAbilitySourceEffect(new ForestwalkAbility(), Duration.EndOfTurn, false), source);
return true;
default:
return false;
}
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class ObzedatGhostCouncilReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
if (card == null) {
return false;
}
Player owner = game.getPlayer(card.getOwnerId());
if (owner == null || !owner.moveCards(card, Zone.BATTLEFIELD, source, game)) {
// comes back from any zone
return false;
}
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield), source);
return true;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class SilverquillPledgemageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
game.addEffect(new GainAbilitySourceEffect(player.chooseUse(Outcome.Neutral, "Choose flying or lifelink", null, "Flying", "Lifelink", source, game) ? FlyingAbility.getInstance() : LifelinkAbility.getInstance(), Duration.EndOfTurn), source);
return true;
}
Aggregations