mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
Implement [PHPR] Sewers of Estark
This commit is contained in:
parent
833d209795
commit
1c76f79fb6
2 changed files with 95 additions and 3 deletions
93
Mage.Sets/src/mage/cards/s/SewersOfEstark.java
Normal file
93
Mage.Sets/src/mage/cards/s/SewersOfEstark.java
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.PreventDamageByTargetEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.target.targetpointer.FixedTargets;
|
||||
import mage.watchers.common.BlockingOrBlockedWatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class SewersOfEstark extends CardImpl {
|
||||
|
||||
public SewersOfEstark(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}{B}");
|
||||
|
||||
// Choose target creature. If it's attacking, it can't be blocked this turn. If it's blocking, prevent all combat damage that would be dealt this combat by it and each creature it's blocking.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new SewersOfEstarkEffect());
|
||||
|
||||
}
|
||||
|
||||
private SewersOfEstark(final SewersOfEstark card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SewersOfEstark copy() {
|
||||
return new SewersOfEstark(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SewersOfEstarkEffect extends OneShotEffect {
|
||||
|
||||
SewersOfEstarkEffect() {
|
||||
super(Outcome.PreventDamage);
|
||||
this.staticText = "Choose target creature. If it's attacking, it can't be blocked this turn. " +
|
||||
"If it's blocking, prevent all combat damage that would be dealt this combat by it and each creature it's blocking.";
|
||||
}
|
||||
|
||||
private SewersOfEstarkEffect(final SewersOfEstarkEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SewersOfEstarkEffect copy() {
|
||||
return new SewersOfEstarkEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (creature == null) {
|
||||
return false;
|
||||
}
|
||||
if (creature.isAttacking()) {
|
||||
ContinuousEffect effect = new CantBeBlockedTargetEffect().setTargetPointer(new FixedTarget(creature.getId(), game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
if (creature.getBlocking() > 0) {
|
||||
List<Permanent> creatures = new ArrayList<>();
|
||||
creatures.add(creature);
|
||||
for (Permanent blockedByTarget : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_ATTACKING_CREATURE, source.getControllerId(), game)) {
|
||||
if (BlockingOrBlockedWatcher.check(blockedByTarget, creature, game)) {
|
||||
creatures.add(blockedByTarget);
|
||||
}
|
||||
}
|
||||
ContinuousEffect effect = new PreventDamageByTargetEffect(Duration.EndOfCombat, true)
|
||||
.setTargetPointer(new FixedTargets(creatures, game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -23,8 +23,7 @@ public class HarperPrismBookPromos extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Arena", 1, Rarity.RARE, mage.cards.a.Arena.class));
|
||||
cards.add(new SetCardInfo("Giant Badger", 4, Rarity.RARE, mage.cards.g.GiantBadger.class));
|
||||
cards.add(new SetCardInfo("Mana Crypt", 5, Rarity.RARE, mage.cards.m.ManaCrypt.class));
|
||||
// TODO: Card not implemented
|
||||
//cards.add(new SetCardInfo("Sewers of Estark", 2, Rarity.RARE, mage.cards.s.SewersOfEstark.class))
|
||||
cards.add(new SetCardInfo("Sewers of Estark", 2, Rarity.RARE, mage.cards.s.SewersOfEstark.class));
|
||||
cards.add(new SetCardInfo("Windseeker Centaur", 3, Rarity.RARE, mage.cards.w.WindseekerCentaur.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue