mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Arcbond - Fixed that as damage source was wrongly set Arcbond instead of the targeted creature.
This commit is contained in:
parent
24c757647e
commit
ea5a769683
2 changed files with 12 additions and 5 deletions
|
@ -30,6 +30,7 @@ package mage.sets.fatereforged;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.DelayedTriggeredAbility;
|
import mage.abilities.DelayedTriggeredAbility;
|
||||||
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||||
|
@ -86,7 +87,7 @@ class ArcbondDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.getFirstTarget())) {
|
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.getFirstTarget())) {
|
||||||
for (Effect effect : this.getEffects()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setValue("damage", event.getAmount());
|
effect.setValue("damage", event.getAmount());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +127,7 @@ class ArcbondEffect extends OneShotEffect {
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
FilterPermanent filter = new FilterCreaturePermanent("each other creature");
|
FilterPermanent filter = new FilterCreaturePermanent("each other creature");
|
||||||
filter.add(Predicates.not(new PermanentIdPredicate(source.getTargets().getFirstTarget())));
|
filter.add(Predicates.not(new PermanentIdPredicate(source.getTargets().getFirstTarget())));
|
||||||
return new DamageEverythingEffect(damage, filter).apply(game, source);
|
return new DamageEverythingEffect(new StaticValue(damage), filter, source.getTargets().getFirstTarget()).apply(game, source);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class DamageEverythingEffect extends OneShotEffect {
|
||||||
|
|
||||||
private DynamicValue amount;
|
private DynamicValue amount;
|
||||||
private FilterPermanent filter;
|
private FilterPermanent filter;
|
||||||
|
private UUID damageSource;
|
||||||
|
|
||||||
public DamageEverythingEffect(int amount) {
|
public DamageEverythingEffect(int amount) {
|
||||||
this(new StaticValue(amount), new FilterCreaturePermanent());
|
this(new StaticValue(amount), new FilterCreaturePermanent());
|
||||||
|
@ -57,11 +58,15 @@ public class DamageEverythingEffect extends OneShotEffect {
|
||||||
public DamageEverythingEffect(int amount, FilterPermanent filter) {
|
public DamageEverythingEffect(int amount, FilterPermanent filter) {
|
||||||
this(new StaticValue(amount), filter);
|
this(new StaticValue(amount), filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DamageEverythingEffect(DynamicValue amount, FilterPermanent filter) {
|
public DamageEverythingEffect(DynamicValue amount, FilterPermanent filter) {
|
||||||
|
this(amount, filter, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DamageEverythingEffect(DynamicValue amount, FilterPermanent filter, UUID damageSource) {
|
||||||
super(Outcome.Damage);
|
super(Outcome.Damage);
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
|
this.damageSource = damageSource;
|
||||||
staticText = "{source} deals " + amount.toString() + " damage to each " + filter.getMessage() + " and each player";
|
staticText = "{source} deals " + amount.toString() + " damage to each " + filter.getMessage() + " and each player";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +74,7 @@ public class DamageEverythingEffect extends OneShotEffect {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.amount = effect.amount;
|
this.amount = effect.amount;
|
||||||
this.filter = effect.filter;
|
this.filter = effect.filter;
|
||||||
|
this.damageSource = effect.damageSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,12 +87,12 @@ public class DamageEverythingEffect extends OneShotEffect {
|
||||||
int damage = amount.calculate(game, source, this);
|
int damage = amount.calculate(game, source, this);
|
||||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
|
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
|
||||||
for (Permanent permanent: permanents) {
|
for (Permanent permanent: permanents) {
|
||||||
permanent.damage(damage, source.getSourceId(), game, false, true);
|
permanent.damage(damage, damageSource == null ? source.getSourceId(): damageSource, game, false, true);
|
||||||
}
|
}
|
||||||
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
|
for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.damage(damage, source.getSourceId(), game, false, true);
|
player.damage(damage, damageSource == null ? source.getSourceId(): damageSource, game, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue