mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fire PLAY_LAND event when a player plays a land, fixed UphillBattle PlayCreatureLandWatcher
Fire a PLAY_LAND event when a player plays a land. This is necessary for the PlayCreatureLandWatcher to know if a land was played, or put into thte battlefield (make distinction between playing Dryad Arbor and using Sneak Attack to put it on the battlefield)
This commit is contained in:
parent
94de3b405b
commit
0b8e8c0007
2 changed files with 8 additions and 6 deletions
|
@ -33,6 +33,7 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
@ -90,11 +91,10 @@ class PlayCreatureLandWatcher extends Watcher {
|
|||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.PLAY_LAND) {
|
||||
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent != null
|
||||
&& permanent.isLand()
|
||||
&& permanent.isCreature()
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null
|
||||
&& card.isLand()
|
||||
&& card.isCreature()
|
||||
&& !playerPlayedLand.contains(event.getPlayerId())) {
|
||||
playerPlayedLand.add(event.getPlayerId());
|
||||
landPlayed.add(event.getTargetId());
|
||||
|
|
|
@ -1097,6 +1097,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!ignoreTiming && !playLandAbility.canActivate(this.playerId, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, card.getId(), card.getId(), playerId));
|
||||
//20091005 - 305.1
|
||||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, card.getId(), card.getId(), playerId))) {
|
||||
// int bookmark = game.bookmarkState();
|
||||
|
@ -1113,7 +1115,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// what makes no real sense. So it makes no sense to generally do a restorState here.
|
||||
// restoreState(bookmark, card.getName(), game);
|
||||
}
|
||||
// if the to play the land is replaced (e.g. Kjeldoran Outpos and don't sacrificing a Plains) it's a valid satte so returning true here
|
||||
// if the to play the land is replaced (e.g. Kjeldoran Outpos and don't sacrificing a Plains) it's a valid state so returning true here
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue