mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 12:19:59 -08:00
* Nature's Way - Fixed wrong damage source (fixes #2378).
This commit is contained in:
parent
e552d64764
commit
3c93c00d60
4 changed files with 45 additions and 25 deletions
|
|
@ -29,10 +29,8 @@ package mage.sets.eldritchmoon;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.TargetPermanentPowerCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
|
@ -107,7 +105,7 @@ class ClearShotDamageEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent ownCreature = game.getPermanent(source.getFirstTarget());
|
||||
Permanent ownCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (ownCreature != null) {
|
||||
int damage = ownCreature.getPower().getValue();
|
||||
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
|
|
@ -118,4 +116,4 @@ class ClearShotDamageEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,22 +28,25 @@
|
|||
package mage.sets.kaladesh;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.dynamicvalue.common.TargetPermanentPowerCount;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -67,11 +70,7 @@ public class NaturesWay extends CardImpl {
|
|||
this.getSpellAbility().addEffect(effect);
|
||||
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setText("and trample until end of turn");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
effect = new DamageTargetEffect(new TargetPermanentPowerCount(), true, null, true);
|
||||
effect.setTargetPointer(new SecondTargetPointer());
|
||||
effect.setText("It deals damage equal to its power to target creature you don't control");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new NaturesWayEffect());
|
||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||
}
|
||||
|
|
@ -85,3 +84,34 @@ public class NaturesWay extends CardImpl {
|
|||
return new NaturesWay(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NaturesWayEffect extends OneShotEffect {
|
||||
|
||||
public NaturesWayEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "It deals damage equal to its power to target creature you don't control";
|
||||
}
|
||||
|
||||
public NaturesWayEffect(final NaturesWayEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NaturesWayEffect copy() {
|
||||
return new NaturesWayEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent controlledCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && controlledCreature != null) {
|
||||
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (targetCreature != null) {
|
||||
targetCreature.damage(controlledCreature.getPower().getValue(), controlledCreature.getId(), game, false, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class WarstormSurge extends CardImpl {
|
|||
super(ownerId, 160, "Warstorm Surge", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{5}{R}");
|
||||
this.expansionSetCode = "M12";
|
||||
|
||||
|
||||
// Whenever a creature enters the battlefield under your control, it deals damage equal to its power to target creature or player.
|
||||
Ability ability = new WarstormSurgeTriggeredAbility();
|
||||
ability.addTarget(new TargetCreatureOrPlayer());
|
||||
this.addAbility(ability);
|
||||
|
|
@ -127,10 +127,7 @@ class WarstormSurgeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID creatureId = (UUID) getValue("damageSource");
|
||||
Permanent creature = game.getPermanent(creatureId);
|
||||
if (creature == null) {
|
||||
creature = (Permanent) game.getLastKnownInformation(creatureId, Zone.BATTLEFIELD);
|
||||
}
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
|
||||
if (creature != null) {
|
||||
int amount = creature.getPower().getValue();
|
||||
UUID target = source.getTargets().getFirstTarget();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
|
@ -80,7 +79,7 @@ class RabidBiteEffect extends OneShotEffect {
|
|||
public RabidBiteEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "Target creature you control deals damage equal to its power to target creature you don't control";
|
||||
}
|
||||
}
|
||||
|
||||
public RabidBiteEffect(final RabidBiteEffect effect) {
|
||||
super(effect);
|
||||
|
|
@ -88,12 +87,8 @@ class RabidBiteEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getFirstTarget());
|
||||
if (sourcePermanent == null) {
|
||||
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
|
||||
}
|
||||
|
||||
Permanent targetPermanent = (Permanent) game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||
Permanent targetPermanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
|
||||
if (sourcePermanent != null && targetPermanent != null) {
|
||||
targetPermanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue