Merge pull request #29 from magefree/master

merge
This commit is contained in:
theelk801 2017-08-15 16:13:28 -04:00 committed by GitHub
commit 7354f54d8f
3 changed files with 49 additions and 9 deletions

View file

@ -32,6 +32,8 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.CantBlockTargetEffect;
import mage.abilities.keyword.EternalizeAbility;
import mage.abilities.keyword.HasteAbility;
@ -40,11 +42,13 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -67,7 +71,7 @@ public class EarthshakerKhenra extends CardImpl {
this.addAbility(HasteAbility.getInstance());
// When Earthshaker Khenra enters the battlefield, target creature with power less than or equal to Earthshaker Khenra's power can't block this turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn));
Ability ability = new EntersBattlefieldTriggeredAbility(new EarthshakerKhenraEffect());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
originalId = ability.getOriginalId();
@ -82,11 +86,10 @@ public class EarthshakerKhenra extends CardImpl {
if (ability.getOriginalId().equals(originalId)) {
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
if (sourcePermanent != null) {
int power = sourcePermanent.getPower().getValue();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to " + getLogName() + "'s power");
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, power + 1));
FilterCreaturePermanent targetFilter = new FilterCreaturePermanent("creature with power less than or equal to " + getLogName() + "'s power");
targetFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, sourcePermanent.getPower().getValue() + 1));
ability.getTargets().clear();
ability.getTargets().add(new TargetCreaturePermanent(filter));
ability.getTargets().add(new TargetCreaturePermanent(targetFilter));
}
}
}
@ -101,3 +104,40 @@ public class EarthshakerKhenra extends CardImpl {
return new EarthshakerKhenra(this);
}
}
class EarthshakerKhenraEffect extends OneShotEffect {
public EarthshakerKhenraEffect() {
super(Outcome.UnboostCreature);
this.staticText = "target creature with power less than or equal to {this}'s power can't block this turn";
}
public EarthshakerKhenraEffect(final EarthshakerKhenraEffect effect) {
super(effect);
}
@Override
public EarthshakerKhenraEffect copy() {
return new EarthshakerKhenraEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourceObject != null) {
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
/*
27.06.2017 The target creatures power is checked when you target it with Earthshaker Khenras ability
and when that ability resolves. Once the ability resolves, if the creatures power increases
or Earthshaker Khenras power decreases, the target creature will still be unable to block.
*/
if (targetCreature != null && targetCreature.getPower().getValue() <= sourceObject.getPower().getValue()) {
ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(targetCreature, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
}

View file

@ -64,7 +64,7 @@ public class UlvenwaldTracker extends CardImpl {
Target controlledTarget = new TargetControlledCreaturePermanent();
controlledTarget.setTargetTag(1);
ability.addTarget(controlledTarget);
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature to fight");
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new AnotherTargetPredicate(2));
Target secondTarget = new TargetCreaturePermanent(filter);
secondTarget.setTargetTag(2);

View file

@ -49,6 +49,7 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Balan, Wandering Knight", 2, Rarity.RARE, mage.cards.b.BalanWanderingKnight.class));
cards.add(new SetCardInfo("Bloodsworn Steward", 22, Rarity.RARE, mage.cards.b.BloodswornSteward.class));
cards.add(new SetCardInfo("Crimson Honor Guard", 23, Rarity.RARE, mage.cards.c.CrimsonHonorGuard.class));
cards.add(new SetCardInfo("Curse of Bounty", 30, Rarity.UNCOMMON, mage.cards.c.CurseOfBounty.class));
cards.add(new SetCardInfo("Curse of Disturbance", 16, Rarity.UNCOMMON, mage.cards.c.CurseOfDisturbance.class));
cards.add(new SetCardInfo("Curse of Opulence", 24, Rarity.UNCOMMON, mage.cards.c.CurseOfOpulence.class));
@ -56,8 +57,8 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Curse of Vitality", 3, Rarity.UNCOMMON, mage.cards.c.CurseOfVitality.class));
cards.add(new SetCardInfo("Herald's Horn", 53, Rarity.UNCOMMON, mage.cards.h.HeraldsHorn.class));
cards.add(new SetCardInfo("Hungry Lynx", 31, Rarity.RARE, mage.cards.h.HungryLynx.class));
cards.add(new SetCardInfo("Crimson Honor Guard", 23, Rarity.RARE, mage.cards.c.CrimsonHonorGuard.class));
cards.add(new SetCardInfo("Fractured Identity", 37, Rarity.RARE, mage.cards.f.FracturedIdentity.class));
cards.add(new SetCardInfo("Kindred Dominance", 18, Rarity.RARE, mage.cards.k.KindredDominance.class));
cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class));
cards.add(new SetCardInfo("O-Kagachi, Vengeful Kami", 45, Rarity.MYTHIC, mage.cards.o.OKagachiVengefulKami.class));
cards.add(new SetCardInfo("Patron of the Vein", 20, Rarity.RARE, mage.cards.p.PatronOfTheVein.class));
@ -71,6 +72,5 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Traverse the Outlands", 34, Rarity.RARE, mage.cards.t.TraverseTheOutlands.class));
cards.add(new SetCardInfo("Wasitora, Nekoru Queen", 49, Rarity.MYTHIC, mage.cards.w.WasitoraNekoruQueen.class));
cards.add(new SetCardInfo("Kindred Dominance", 18, Rarity.RARE, mage.cards.w.WasitoraNekoruQueen.class));
}
}