mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fixed a bug that the effect failed when the source attachment of the effect left meanwhile the battlefield.
This commit is contained in:
parent
09aba1bd87
commit
bc7ffd1201
1 changed files with 8 additions and 2 deletions
|
@ -29,6 +29,7 @@
|
||||||
package mage.abilities.effects.common.counter;
|
package mage.abilities.effects.common.counter;
|
||||||
|
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
|
import mage.Constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.counters.common.PlusOneCounter;
|
import mage.counters.common.PlusOneCounter;
|
||||||
|
@ -62,6 +63,9 @@ public class AddPlusOneCountersAttachedEffect extends OneShotEffect<AddPlusOneCo
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||||
|
if (enchantment == null) {
|
||||||
|
enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
|
||||||
|
}
|
||||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||||
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
|
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
|
@ -72,10 +76,12 @@ public class AddPlusOneCountersAttachedEffect extends OneShotEffect<AddPlusOneCo
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setText() {
|
private void setText() {
|
||||||
if (amount > 1)
|
if (amount > 1) {
|
||||||
staticText = "put " + Integer.toString(amount) + " +1/+1 counters on enchanted creature";
|
staticText = "put " + Integer.toString(amount) + " +1/+1 counters on enchanted creature";
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
staticText = "put a +1/+1 counter on enchanted creature";
|
staticText = "put a +1/+1 counter on enchanted creature";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue