mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09:00
- small refactor Foretell ability
This commit is contained in:
parent
7d92ad45d9
commit
970125c5c4
3 changed files with 6 additions and 4 deletions
|
@ -24,6 +24,7 @@ import mage.util.CardUtil;
|
||||||
import mage.watchers.common.ForetoldWatcher;
|
import mage.watchers.common.ForetoldWatcher;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
@ -142,6 +143,7 @@ public class ForetellAbility extends SpecialAction {
|
||||||
effect.apply(game, source);
|
effect.apply(game, source);
|
||||||
card.setFaceDown(true, game);
|
card.setFaceDown(true, game);
|
||||||
game.addEffect(new ForetellAddCostEffect(new MageObjectReference(card, game)), source);
|
game.addEffect(new ForetellAddCostEffect(new MageObjectReference(card, game)), source);
|
||||||
|
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FORETELL, card.getId(), null, source.getControllerId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -465,6 +465,7 @@ public class GameEvent implements Serializable {
|
||||||
DUNGEON_COMPLETED,
|
DUNGEON_COMPLETED,
|
||||||
REMOVED_FROM_COMBAT, // targetId id of permanent removed from combat
|
REMOVED_FROM_COMBAT, // targetId id of permanent removed from combat
|
||||||
FORETOLD, // targetId id of card foretold
|
FORETOLD, // targetId id of card foretold
|
||||||
|
FORETELL, // targetId id of card foretell playerId id of the controller
|
||||||
//custom events
|
//custom events
|
||||||
CUSTOM_EVENT
|
CUSTOM_EVENT
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ package mage.watchers.common;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.keyword.ForetellAbility;
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.constants.WatcherScope;
|
import mage.constants.WatcherScope;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.util.CardUtil;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,10 +26,9 @@ public class ForetoldWatcher extends Watcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.TAKEN_SPECIAL_ACTION) {
|
if (event.getType() == GameEvent.EventType.FORETELL) {
|
||||||
Card card = game.getCard(event.getSourceId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null
|
if (card != null
|
||||||
&& card.getAbilities(game).containsClass(ForetellAbility.class)
|
|
||||||
&& controllerId == event.getPlayerId()) {
|
&& controllerId == event.getPlayerId()) {
|
||||||
foretellCardsThisTurn.add(card.getId());
|
foretellCardsThisTurn.add(card.getId());
|
||||||
foretoldCards.add(card.getId());
|
foretoldCards.add(card.getId());
|
||||||
|
|
Loading…
Add table
Reference in a new issue