mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Hapatra, Vizier of Poisons - Fixed that it was not triggering off of Infect (fixes #3288).
This commit is contained in:
parent
e090b26240
commit
67a66d90da
3 changed files with 51 additions and 31 deletions
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.game.permanent;
|
||||
|
||||
import java.util.*;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -55,13 +56,21 @@ import mage.players.Player;
|
|||
import mage.util.GameLog;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public abstract class PermanentImpl extends CardImpl implements Permanent {
|
||||
|
||||
public class MarkedDamageInfo {
|
||||
|
||||
public MarkedDamageInfo(Counter counter, MageObject sourceObject) {
|
||||
this.counter = counter;
|
||||
this.sourceObject = sourceObject;
|
||||
}
|
||||
Counter counter;
|
||||
MageObject sourceObject;
|
||||
}
|
||||
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(300);
|
||||
|
||||
protected boolean tapped;
|
||||
|
|
@ -96,7 +105,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
protected int attachedToZoneChangeCounter;
|
||||
protected MageObjectReference pairedPermanent;
|
||||
protected Counters counters;
|
||||
protected List<Counter> markedDamage;
|
||||
protected List<MarkedDamageInfo> markedDamage;
|
||||
protected int timesLoyaltyUsed = 0;
|
||||
protected Map<String, String> info;
|
||||
protected int createOrder;
|
||||
|
|
@ -141,8 +150,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
if (permanent.markedDamage != null) {
|
||||
markedDamage = new ArrayList<>();
|
||||
for (Counter counter : permanent.markedDamage) {
|
||||
markedDamage.add(counter.copy());
|
||||
for (MarkedDamageInfo mdi : permanent.markedDamage) {
|
||||
markedDamage.add(new MarkedDamageInfo(mdi.counter.copy(), mdi.sourceObject));
|
||||
}
|
||||
}
|
||||
if (permanent.info != null) {
|
||||
|
|
@ -768,8 +777,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
if (markedDamage == null) {
|
||||
return 0;
|
||||
}
|
||||
for (Counter counter : markedDamage) {
|
||||
addCounters(counter, null, game);
|
||||
for (MarkedDamageInfo mdi : markedDamage) {
|
||||
Ability source = null;
|
||||
if (mdi.sourceObject instanceof Permanent) {
|
||||
source = ((Permanent) mdi.sourceObject).getSpellAbility();
|
||||
}
|
||||
addCounters(mdi.counter, source, game);
|
||||
}
|
||||
markedDamage.clear();
|
||||
return 0;
|
||||
|
|
@ -811,10 +824,14 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
|| source.getAbilities().containsKey(WitherAbility.getInstance().getId()))) {
|
||||
if (markDamage) {
|
||||
// mark damage only
|
||||
markDamage(CounterType.M1M1.createInstance(actualDamage));
|
||||
markDamage(CounterType.M1M1.createInstance(actualDamage), source);
|
||||
} else {
|
||||
Ability damageSourceAbility = null;
|
||||
if (source instanceof Permanent) {
|
||||
damageSourceAbility = ((Permanent) source).getSpellAbility();
|
||||
}
|
||||
// deal damage immediately
|
||||
addCounters(CounterType.M1M1.createInstance(actualDamage), null, game);
|
||||
addCounters(CounterType.M1M1.createInstance(actualDamage), damageSourceAbility, game);
|
||||
}
|
||||
} else {
|
||||
this.damage += actualDamage;
|
||||
|
|
@ -840,11 +857,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
return event.getAmount();
|
||||
}
|
||||
|
||||
private void markDamage(Counter counter) {
|
||||
private void markDamage(Counter counter, MageObject source) {
|
||||
if (markedDamage == null) {
|
||||
markedDamage = new ArrayList<>();
|
||||
}
|
||||
markedDamage.add(counter);
|
||||
markedDamage.add(new MarkedDamageInfo(counter, source));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue