Hivestone, Muraganda Petroglyphs some minor updates.

This commit is contained in:
LevelX2 2017-01-24 23:28:19 +01:00
parent 357d566e63
commit dd2a1b8b94
2 changed files with 31 additions and 56 deletions

View file

@ -1,30 +1,37 @@
package mage.cards.h;
import mage.abilities.Ability;
import java.util.ArrayList;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.List;
import java.util.UUID;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
* Created by Alexsandr0x.
*/
public class Hivestone extends CardImpl {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public Hivestone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Creatures you control are Slivers in addition to their other creature types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CreaturesAreSliversEffect()));
ArrayList<String> subTypes = new ArrayList<>();
subTypes.add("Slivers");
Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subTypes, filter, false);
effect.setText("Creatures you control are Slivers in addition to their other creature types");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public Hivestone(final Hivestone card) {
@ -37,36 +44,3 @@ public class Hivestone extends CardImpl {
}
}
class CreaturesAreSliversEffect extends ContinuousEffectImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public CreaturesAreSliversEffect() {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
staticText = "Creatures you control are Slivers in addition to their other creature types.";
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
for (Permanent perm : permanents) {
List<String> cardSubType = perm.getSubtype(game);
if (!cardSubType.contains("Sliver") && perm.getOwnerId().equals(player.getId())) {
cardSubType.add("Sliver");
}
}
return true;
}
@Override
public mage.cards.h.CreaturesAreSliversEffect copy() {
return new mage.cards.h.CreaturesAreSliversEffect(this);
}
private CreaturesAreSliversEffect(mage.cards.h.CreaturesAreSliversEffect effect) {
super(effect);
}
}

View file

@ -28,7 +28,6 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Abilities;
import mage.abilities.Ability;
@ -51,14 +50,17 @@ import mage.game.Game;
*/
public class MuragandaPetroglyphs extends CardImpl {
private static final FilterCreaturePermanent filterNoAbilities = new FilterCreaturePermanent(
"Creatures with no ability");
private static final FilterCreaturePermanent filterNoAbilities
= new FilterCreaturePermanent("Creatures with no ability");
static {
filterNoAbilities.add(new NoAbilityPredicate());
}
public MuragandaPetroglyphs(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
this.expansionSetCode = "FUT";
filterNoAbilities.add(new NoAbilityPredicate());
// Creatures with no abilities get +2/+2.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(
2, 2, Duration.WhileOnBattlefield, filterNoAbilities, false)));
@ -80,24 +82,23 @@ class NoAbilityPredicate implements Predicate<MageObject> {
public boolean apply(MageObject input, Game game) {
boolean isFaceDown = false;
Abilities<Ability> abilities;
if (input instanceof Card){
abilities = ((Card)input).getAbilities(game);
isFaceDown = ((Card)input).isFaceDown(game);
if (input instanceof Card) {
abilities = ((Card) input).getAbilities(game);
isFaceDown = ((Card) input).isFaceDown(game);
} else {
abilities = input.getAbilities();
}
if (isFaceDown) {
for (Ability ability : abilities){
if(!ability.getSourceId().equals(input.getId())) {
for (Ability ability : abilities) {
if (!ability.getSourceId().equals(input.getId())) {
return false;
}
}
return true;
}
for (Ability ability : abilities){
if (ability.getClass() != SpellAbility.class){
for (Ability ability : abilities) {
if (ability.getClass() != SpellAbility.class) {
return false;
}
@ -109,4 +110,4 @@ class NoAbilityPredicate implements Predicate<MageObject> {
public String toString() {
return "with no abilities";
}
}
}