mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Dragon Tempest - Fixed a problem if damage was redirected (e.g. with Spellskite) - (fixes #3887).
This commit is contained in:
parent
7e8dcef120
commit
cb15d4728d
2 changed files with 8 additions and 5 deletions
|
|
@ -46,7 +46,6 @@ import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreatureOrPlayer;
|
import mage.target.common.TargetCreatureOrPlayer;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -74,7 +73,7 @@ public class DragonTempest extends CardImpl {
|
||||||
new DragonTempestDamageEffect(),
|
new DragonTempestDamageEffect(),
|
||||||
new FilterCreaturePermanent(SubType.DRAGON, "a Dragon"),
|
new FilterCreaturePermanent(SubType.DRAGON, "a Dragon"),
|
||||||
false,
|
false,
|
||||||
SetTargetPointer.PERMANENT,
|
SetTargetPointer.NONE,
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
ability.addTarget(new TargetCreatureOrPlayer());
|
ability.addTarget(new TargetCreatureOrPlayer());
|
||||||
|
|
@ -118,15 +117,16 @@ class DragonTempestDamageEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
|
Permanent damageSource = (Permanent) getValue("permanentEnteringBattlefield");
|
||||||
int amount = game.getBattlefield().countAll(dragonFilter, controller.getId(), game);
|
int amount = game.getBattlefield().countAll(dragonFilter, controller.getId(), game);
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
Permanent targetCreature = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
|
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
if (targetCreature != null) {
|
if (targetCreature != null) {
|
||||||
targetCreature.damage(amount, getTargetPointer().getFirst(game, source), game, false, true);
|
targetCreature.damage(amount, damageSource.getId(), game, false, true);
|
||||||
} else {
|
} else {
|
||||||
Player player = game.getPlayer(source.getTargets().getFirstTarget());
|
Player player = game.getPlayer(source.getTargets().getFirstTarget());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.damage(amount, getTargetPointer().getFirst(game, source), game, false, true);
|
player.damage(amount, damageSource.getId(), game, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,9 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
UUID targetId = event.getTargetId();
|
UUID targetId = event.getTargetId();
|
||||||
Permanent permanent = game.getPermanent(targetId);
|
Permanent permanent = game.getPermanent(targetId);
|
||||||
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||||
|
for (Effect effect : this.getEffects()) {
|
||||||
|
effect.setValue("permanentEnteringBattlefield", permanent);
|
||||||
|
}
|
||||||
if (setTargetPointer != SetTargetPointer.NONE) {
|
if (setTargetPointer != SetTargetPointer.NONE) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
switch (setTargetPointer) {
|
switch (setTargetPointer) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue