mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Fixes for Evelyn, the Covetous (fixes #9043)
This commit is contained in:
parent
da10b6397c
commit
5aa20f3e50
1 changed files with 8 additions and 3 deletions
|
@ -16,6 +16,7 @@ import mage.filter.FilterPermanent;
|
||||||
import mage.game.CardState;
|
import mage.game.CardState;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.ManaPoolItem;
|
import mage.players.ManaPoolItem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
@ -161,7 +162,7 @@ class EvelynTheCovetousManaEffect extends AsThoughEffectImpl implements AsThough
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (!source.isControlledBy(affectedControllerId) || !EvelynTheCovetousWatcher.checkUsed(source, game)) {
|
if (!source.isControlledBy(affectedControllerId) || EvelynTheCovetousWatcher.checkUsed(source, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Card card = game.getCard(CardUtil.getMainCardId(game, sourceId));
|
Card card = game.getCard(CardUtil.getMainCardId(game, sourceId));
|
||||||
|
@ -199,7 +200,7 @@ class EvelynTheCovetousWatcher extends Watcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST
|
if ((event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED)
|
||||||
&& event.getAdditionalReference() != null) {
|
&& event.getAdditionalReference() != null) {
|
||||||
usedMap.computeIfAbsent(
|
usedMap.computeIfAbsent(
|
||||||
event.getAdditionalReference()
|
event.getAdditionalReference()
|
||||||
|
@ -228,12 +229,16 @@ class EvelynTheCovetousWatcher extends Watcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean checkUsed(Ability source, Game game) {
|
static boolean checkUsed(Ability source, Game game) {
|
||||||
|
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||||
|
if (sourceObject == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return game
|
return game
|
||||||
.getState()
|
.getState()
|
||||||
.getWatcher(EvelynTheCovetousWatcher.class)
|
.getWatcher(EvelynTheCovetousWatcher.class)
|
||||||
.usedMap
|
.usedMap
|
||||||
.getOrDefault(
|
.getOrDefault(
|
||||||
new MageObjectReference(source),
|
new MageObjectReference(sourceObject, game),
|
||||||
Collections.emptySet()
|
Collections.emptySet()
|
||||||
).contains(source.getControllerId());
|
).contains(source.getControllerId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue