mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
Cleanup subtype filters that shouldn't limit to creatures (#11920)
* common Cohort Ability
This commit is contained in:
parent
59bbb1f2b0
commit
347f07ce81
215 changed files with 660 additions and 1212 deletions
|
|
@ -0,0 +1,40 @@
|
|||
package mage.abilities.abilityword;
|
||||
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.common.TapTargetCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
* @author xenohedron
|
||||
*/
|
||||
|
||||
public class CohortAbility extends SimpleActivatedAbility {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.ALLY, "an untapped Ally you control");
|
||||
|
||||
static {
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
public CohortAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect, new TapSourceCost());
|
||||
this.addCost(new TapTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.setAbilityWord(AbilityWord.COHORT);
|
||||
}
|
||||
|
||||
protected CohortAbility(final CohortAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CohortAbility copy() {
|
||||
return new CohortAbility(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.token.ZombieToken;
|
||||
|
|
@ -21,7 +21,7 @@ public final class LilianaTheLastHopeEmblem extends Emblem {
|
|||
// "At the beginning of your end step, create X 2/2 black Zombie creature tokens, where X is two plus the number of Zombies you control."
|
||||
public LilianaTheLastHopeEmblem() {
|
||||
super("Emblem Liliana");
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new ZombieToken(), new LilianaZombiesCount()),
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new ZombieToken(), LilianaZombiesCount.instance),
|
||||
TargetController.YOU, null, false);
|
||||
this.getAbilities().add(ability);
|
||||
}
|
||||
|
|
@ -36,23 +36,19 @@ public final class LilianaTheLastHopeEmblem extends Emblem {
|
|||
}
|
||||
}
|
||||
|
||||
class LilianaZombiesCount implements DynamicValue {
|
||||
enum LilianaZombiesCount implements DynamicValue {
|
||||
instance;
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(SubType.ZOMBIE.getPredicate());
|
||||
}
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.ZOMBIE);
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) + 2;
|
||||
return amount;
|
||||
return game.getBattlefield().countAll(filter, sourceAbility.getControllerId(), game) + 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LilianaZombiesCount copy() {
|
||||
return new LilianaZombiesCount();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue