use of mage.game.permanent.token.BloodToken in project mage by magefree.
the class OldRutsteinEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = player.millCards(1, source, game);
if (cards.getCards(game).stream().anyMatch(card -> card.isLand(game))) {
new TreasureToken().putOntoBattlefield(1, game, source, source.getControllerId());
}
if (cards.getCards(game).stream().anyMatch(card -> card.isCreature(game))) {
new InsectToken().putOntoBattlefield(1, game, source, source.getControllerId());
}
if (cards.getCards(game).stream().anyMatch(card -> !card.isCreature(game) && !card.isLand(game))) {
new BloodToken().putOntoBattlefield(1, game, source, source.getControllerId());
}
return true;
}
use of mage.game.permanent.token.BloodToken in project mage by magefree.
the class OliviasAttendantsTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int amount = ((DamagedBatchEvent) event).getEvents().stream().filter(e -> e.getSourceId().equals(getSourceId())).mapToInt(GameEvent::getAmount).sum();
if (amount < 1) {
return false;
}
this.getEffects().clear();
this.addEffect(new CreateTokenEffect(new BloodToken(), amount));
return true;
}
use of mage.game.permanent.token.BloodToken in project mage by magefree.
the class LacerateFleshEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int lethal = Math.min(permanent.getLethalDamage(source.getSourceId(), game), 4);
permanent.damage(4, source.getSourceId(), source, game);
if (lethal < 4) {
new BloodToken().putOntoBattlefield(4 - lethal, game, source);
}
return true;
}
use of mage.game.permanent.token.BloodToken in project mage by magefree.
the class OdricBloodCursedEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int flying = 0;
int firstStrike = 0;
int doubleStrike = 0;
int deathtouch = 0;
int haste = 0;
int hexproof = 0;
int indestructible = 0;
int lifelink = 0;
int menance = 0;
int reach = 0;
int trample = 0;
int vigilance = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent.isCreature(game)) {
for (Ability ability : permanent.getAbilities(game)) {
if (ability instanceof FlyingAbility) {
flying = 1;
}
if (ability instanceof FirstStrikeAbility) {
firstStrike = 1;
}
if (ability instanceof DoubleStrikeAbility) {
doubleStrike = 1;
}
if (ability instanceof DeathtouchAbility) {
deathtouch = 1;
}
if (ability instanceof HasteAbility) {
haste = 1;
}
if (ability instanceof HexproofAbility) {
hexproof = 1;
}
if (ability instanceof IndestructibleAbility) {
indestructible = 1;
}
if (ability instanceof LifelinkAbility) {
lifelink = 1;
}
if (ability instanceof MenaceAbility) {
menance = 1;
}
if (ability instanceof ReachAbility) {
reach = 1;
}
if (ability instanceof TrampleAbility) {
trample = 1;
}
if (ability instanceof VigilanceAbility) {
vigilance = 1;
}
}
}
}
int numTokens = flying + firstStrike + doubleStrike + deathtouch + haste + hexproof + indestructible + lifelink + menance + reach + trample + vigilance;
if (numTokens < 1) {
return false;
}
return new BloodToken().putOntoBattlefield(numTokens, game, source, source.getControllerId());
}
Aggregations