use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.
the class LairOfTheHydraEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int xValue = source.getManaCostsToPay().getX();
game.addEffect(new BecomesCreatureSourceEffect(new CreatureToken(xValue, xValue, "X/X green Hydra creature").withColor("G").withSubType(SubType.HYDRA), "land", Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.
the class AnsweredPrayersToken method apply.
@Override
public boolean apply(Game game, Ability source) {
new GainLifeEffect(1).apply(game, source);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
return false;
}
if (permanent.isCreature(game)) {
return true;
}
game.addEffect(new BecomesCreatureSourceEffect(new AnsweredPrayersToken(), "enchantment", Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.
the class EbonyFlyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int result = player.rollDice(outcome, source, game, 6);
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null || !player.chooseUse(outcome, "Have " + permanent.getName() + " become a " + result + '/' + result + " creature until end of turn?", source, game)) {
return true;
}
game.addEffect(new BecomesCreatureSourceEffect(new CreatureToken(result, result).withType(CardType.ARTIFACT).withAbility(FlyingAbility.getInstance()), "", Duration.EndOfTurn, false, false), source);
return true;
}
use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.
the class ComputerPlayer method priorityPlay.
private boolean priorityPlay(Game game) {
UUID opponentId = game.getOpponents(playerId).iterator().next();
if (game.isActivePlayer(playerId)) {
if (game.isMainPhase() && game.getStack().isEmpty()) {
playLand(game);
}
switch(game.getTurn().getStepType()) {
case UPKEEP:
findPlayables(game);
break;
case DRAW:
logState(game);
break;
case PRECOMBAT_MAIN:
findPlayables(game);
if (!playableAbilities.isEmpty()) {
for (ActivatedAbility ability : playableAbilities) {
if (ability.canActivate(playerId, game).canActivate()) {
if (ability.getEffects().hasOutcome(ability, Outcome.PutLandInPlay)) {
if (this.activateAbility(ability, game)) {
return true;
}
}
if (ability.getEffects().hasOutcome(ability, Outcome.PutCreatureInPlay)) {
if (getOpponentBlockers(opponentId, game).size() <= 1) {
if (this.activateAbility(ability, game)) {
return true;
}
}
}
}
}
}
break;
case DECLARE_BLOCKERS:
findPlayables(game);
playRemoval(game.getCombat().getBlockers(), game);
playDamage(game.getCombat().getBlockers(), game);
break;
case END_COMBAT:
findPlayables(game);
playDamage(game.getCombat().getBlockers(), game);
break;
case POSTCOMBAT_MAIN:
findPlayables(game);
if (game.getStack().isEmpty()) {
if (!playableNonInstant.isEmpty()) {
for (Card card : playableNonInstant) {
if (card.getSpellAbility().canActivate(playerId, game).canActivate()) {
if (this.activateAbility(card.getSpellAbility(), game)) {
return true;
}
}
}
}
if (!playableAbilities.isEmpty()) {
for (ActivatedAbility ability : playableAbilities) {
if (ability.canActivate(playerId, game).canActivate()) {
if (!(ability.getEffects().get(0) instanceof BecomesCreatureSourceEffect)) {
if (this.activateAbility(ability, game)) {
return true;
}
}
}
}
}
}
break;
}
} else {
// respond to opponent events
switch(game.getTurn().getStepType()) {
case UPKEEP:
findPlayables(game);
break;
case DECLARE_ATTACKERS:
findPlayables(game);
playRemoval(game.getCombat().getAttackers(), game);
playDamage(game.getCombat().getAttackers(), game);
break;
case END_COMBAT:
findPlayables(game);
playDamage(game.getCombat().getAttackers(), game);
break;
}
}
pass(game);
return true;
}
use of mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect in project mage by magefree.
the class CrawlingBarrensEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || !player.chooseUse(outcome, "Have this land become a 0/0 creature until end of turn?", source, game)) {
return false;
}
game.addEffect(new BecomesCreatureSourceEffect(new CreatureToken(0, 0, "0/0 Elemental creature").withSubType(SubType.ELEMENTAL), "land", Duration.EndOfTurn), source);
return true;
}
Aggregations