use of mage.game.permanent.token.Token in project mage by magefree.
the class SokenzanCrucibleOfDefianceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new SpiritToken();
token.putOntoBattlefield(2, game, source);
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance()).setTargetPointer(new FixedTargets(token, game)), source);
return true;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class SwanSongEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean countered = false;
for (UUID targetId : targetPointer.getTargets(game, source)) {
Spell spell = game.getStack().getSpell(targetId);
if (game.getStack().counter(targetId, source, game)) {
countered = true;
}
if (spell != null) {
Token token = new SwanSongBirdToken();
token.putOntoBattlefield(1, game, source, spell.getControllerId());
}
}
return countered;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class WillTheWiseEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int count = 1;
Token token = new ClueArtifactToken();
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId);
if (opponent == null) {
continue;
}
if (opponent.chooseUse(outcome, "Investigate?", source, game)) {
count++;
token.putOntoBattlefield(1, game, source, playerId);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, playerId));
} else {
opponent.loseLife(1, game, source, false);
}
}
token.putOntoBattlefield(count, game, source, source.getControllerId());
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, source.getControllerId()));
return true;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class FlashFoliageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Token token = new SaprolingToken();
token.putOntoBattlefield(1, game, source, source.getControllerId());
Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (attackingCreature != null && game.getState().getCombat() != null) {
// Possible ruling (see Aetherplasm)
// The token you created is blocking the attacking creature,
// even if the block couldn't legally be declared (for example, if that creature
// enters the battlefield tapped, or it can't block, or the attacking creature
// has protection from it)
CombatGroup combatGroup = game.getState().getCombat().findGroup(attackingCreature.getId());
if (combatGroup != null) {
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent saprolingToken = game.getPermanent(tokenId);
if (saprolingToken != null) {
combatGroup.addBlocker(tokenId, source.getControllerId(), game);
game.getCombat().addBlockingGroup(tokenId, attackingCreature.getId(), controller.getId(), game);
}
}
combatGroup.pickBlockerOrder(attackingCreature.getControllerId(), game);
}
}
return true;
}
return false;
}
use of mage.game.permanent.token.Token in project mage by magefree.
the class HiveheartShamanEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new InsectToken();
token.putOntoBattlefield(1, game, source);
int domainCount = xValue.calculate(game, source, this);
if (domainCount < 1) {
return true;
}
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent permanent = game.getPermanent(tokenId);
if (permanent == null) {
continue;
}
permanent.addCounters(CounterType.P1P1.createInstance(domainCount), source, game);
}
return true;
}
Aggregations