forked from External/mage
[WHO] Implement Dan Lewis
This commit is contained in:
parent
a01fd5bb9e
commit
eca0c0d91e
3 changed files with 166 additions and 79 deletions
|
|
@ -1,27 +1,24 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.StaticAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class BludgeonBrawl extends CardImpl {
|
||||
|
|
@ -30,7 +27,7 @@ public final class BludgeonBrawl extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
|
||||
|
||||
// Each noncreature, non-Equipment artifact is an Equipment with equip {X} and "Equipped creature gets +X/+0," where X is that artifact's converted mana cost.
|
||||
this.addAbility(new BludgeonBrawlAbility());
|
||||
this.addAbility(new SimpleStaticAbility(new BludgeonBrawlEffect()));
|
||||
}
|
||||
|
||||
private BludgeonBrawl(final BludgeonBrawl card) {
|
||||
|
|
@ -43,92 +40,67 @@ public final class BludgeonBrawl extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class BludgeonBrawlAbility extends StaticAbility {
|
||||
class BludgeonBrawlEffect extends ContinuousEffectImpl {
|
||||
private static final FilterPermanent filter = new FilterArtifactPermanent();
|
||||
|
||||
public BludgeonBrawlAbility() {
|
||||
super(Zone.BATTLEFIELD, new BludgeonBrawlAddSubtypeEffect());
|
||||
this.addEffect(new BludgeonBrawlGainAbilityEffect());
|
||||
static {
|
||||
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
|
||||
filter.add(Predicates.not(SubType.EQUIPMENT.getPredicate()));
|
||||
}
|
||||
|
||||
private BludgeonBrawlAbility(final BludgeonBrawlAbility ability) {
|
||||
super(ability);
|
||||
public BludgeonBrawlEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "each noncreature, non-Equipment artifact is an Equipment with equip {X} " +
|
||||
"and “Equipped creature gets +X/+0,” where X is that artifact’s mana value.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public BludgeonBrawlAbility copy() {
|
||||
return new BludgeonBrawlAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Each noncreature, non-Equipment artifact is an Equipment with equip {X} and \"Equipped creature gets +X/+0,\" where X is that artifact's mana value.";
|
||||
}
|
||||
}
|
||||
|
||||
class BludgeonBrawlAddSubtypeEffect extends ContinuousEffectImpl {
|
||||
|
||||
public BludgeonBrawlAddSubtypeEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
}
|
||||
|
||||
private BludgeonBrawlAddSubtypeEffect(final BludgeonBrawlAddSubtypeEffect effect) {
|
||||
private BludgeonBrawlEffect(final BludgeonBrawlEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FilterArtifactPermanent filter = new FilterArtifactPermanent("noncreature, non-Equipment artifact");
|
||||
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
|
||||
filter.add(Predicates.not(SubType.EQUIPMENT.getPredicate()));
|
||||
|
||||
Cards affectedPermanents = new CardsImpl();
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
|
||||
for (Permanent permanent : permanents) {
|
||||
if (permanent != null) {
|
||||
permanent.addSubType(game, SubType.EQUIPMENT);
|
||||
affectedPermanents.add(permanent.getId());
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
if (layer == Layer.TypeChangingEffects_4) {
|
||||
affectedObjectList.clear();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
affectedObjectList.add(new MageObjectReference(permanent, game));
|
||||
}
|
||||
}
|
||||
for (MageObjectReference mor : affectedObjectList) {
|
||||
Permanent permanent = mor.getPermanent(game);
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.addSubType(game, SubType.EQUIPMENT);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
int mv = permanent.getManaValue();
|
||||
permanent.addAbility(new SimpleStaticAbility(
|
||||
new BoostEquippedEffect(mv, 0)
|
||||
), source.getSourceId(), game);
|
||||
permanent.addAbility(new EquipAbility(mv, false), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
game.getState().setValue(source.getSourceId() + "BludgeonBrawlAffectedPermanents", affectedPermanents);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BludgeonBrawlAddSubtypeEffect copy() {
|
||||
return new BludgeonBrawlAddSubtypeEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BludgeonBrawlGainAbilityEffect extends ContinuousEffectImpl {
|
||||
|
||||
public BludgeonBrawlGainAbilityEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
}
|
||||
|
||||
private BludgeonBrawlGainAbilityEffect(final BludgeonBrawlGainAbilityEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BludgeonBrawlGainAbilityEffect copy() {
|
||||
return new BludgeonBrawlGainAbilityEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Cards permanents = (Cards) game.getState().getValue(source.getSourceId() + "BludgeonBrawlAffectedPermanents");
|
||||
if (permanents != null) {
|
||||
for (UUID permanentId : permanents) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
int manaValue = permanent.getManaValue();
|
||||
permanent.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(manaValue)), source.getSourceId(), game);
|
||||
permanent.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(manaValue, 0)), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BludgeonBrawlEffect copy() {
|
||||
return new BludgeonBrawlEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Mage.Sets/src/mage/cards/d/DanLewis.java
Normal file
114
Mage.Sets/src/mage/cards/d/DanLewis.java
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.DoctorsCompanionAbility;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class DanLewis extends CardImpl {
|
||||
|
||||
public DanLewis(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Noncreature, non-Equipment artifacts you control are Equipment in addition to their other types and have "Equipped creature gets +1/+0" and equip {1}.
|
||||
this.addAbility(new SimpleStaticAbility(new DanLewisEffect()));
|
||||
|
||||
// Doctor's companion
|
||||
this.addAbility(DoctorsCompanionAbility.getInstance());
|
||||
}
|
||||
|
||||
private DanLewis(final DanLewis card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DanLewis copy() {
|
||||
return new DanLewis(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DanLewisEffect extends ContinuousEffectImpl {
|
||||
private static final FilterPermanent filter = new FilterControlledArtifactPermanent();
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(CardType.CREATURE.getPredicate()));
|
||||
filter.add(Predicates.not(SubType.EQUIPMENT.getPredicate()));
|
||||
}
|
||||
|
||||
public DanLewisEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "noncreature, non-Equipment artifacts you control are Equipment " +
|
||||
"in addition to their other types and have \"Equipped creature gets +1/+0\" and equip {1}";
|
||||
}
|
||||
|
||||
private DanLewisEffect(final DanLewisEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
if (layer == Layer.TypeChangingEffects_4) {
|
||||
affectedObjectList.clear();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
affectedObjectList.add(new MageObjectReference(permanent, game));
|
||||
}
|
||||
}
|
||||
for (MageObjectReference mor : affectedObjectList) {
|
||||
Permanent permanent = mor.getPermanent(game);
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.addSubType(game, SubType.EQUIPMENT);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
permanent.addAbility(new SimpleStaticAbility(
|
||||
new BoostEquippedEffect(1, 0)
|
||||
), source.getSourceId(), game);
|
||||
permanent.addAbility(new EquipAbility(1, false), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DanLewisEffect copy() {
|
||||
return new DanLewisEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,6 +58,7 @@ public final class DoctorWho extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Cybermen Squadron", 176, Rarity.RARE, mage.cards.c.CybermenSquadron.class));
|
||||
cards.add(new SetCardInfo("Dalek Drone", 64, Rarity.RARE, mage.cards.d.DalekDrone.class));
|
||||
cards.add(new SetCardInfo("Dalek Squadron", 65, Rarity.UNCOMMON, mage.cards.d.DalekSquadron.class));
|
||||
cards.add(new SetCardInfo("Dan Lewis", 78, Rarity.RARE, mage.cards.d.DanLewis.class));
|
||||
cards.add(new SetCardInfo("Darkwater Catacombs", 269, Rarity.RARE, mage.cards.d.DarkwaterCatacombs.class));
|
||||
cards.add(new SetCardInfo("Day of Destiny", 206, Rarity.RARE, mage.cards.d.DayOfDestiny.class));
|
||||
cards.add(new SetCardInfo("Decaying Time Loop", 80, Rarity.UNCOMMON, mage.cards.d.DecayingTimeLoop.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue