mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Karn Liberated - fixed watchers errors on game restart ability
This commit is contained in:
parent
b2d4d1eba8
commit
1d43b38a5f
3 changed files with 14 additions and 18 deletions
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
|
@ -11,18 +7,11 @@ import mage.abilities.LoyaltyAbility;
|
|||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ExileTargetForSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameImpl;
|
||||
import mage.game.command.Commander;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
@ -34,8 +23,11 @@ import mage.target.TargetPlayer;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author bunchOfDevs
|
||||
*/
|
||||
public final class KarnLiberated extends CardImpl {
|
||||
|
@ -102,6 +94,9 @@ class KarnLiberatedEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
game.getState().clear();
|
||||
// default watchers init, TODO: remove all restart/init code to game
|
||||
((GameImpl) game).initGameDefaultWatchers();
|
||||
|
||||
for (Card card : game.getCards()) {
|
||||
game.getState().addCard(card);
|
||||
}
|
||||
|
@ -122,6 +117,7 @@ class KarnLiberatedEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
}
|
||||
((GameImpl) game).initPlayerDefaultWatchers(player.getId());
|
||||
player.init(game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1063,7 +1063,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
|
||||
|
||||
private void initGameDefaultWatchers() {
|
||||
public void initGameDefaultWatchers() {
|
||||
getState().addWatcher(new MorbidWatcher());
|
||||
getState().addWatcher(new CastSpellLastTurnWatcher());
|
||||
getState().addWatcher(new CastSpellYourLastTurnWatcher());
|
||||
|
@ -1075,7 +1075,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
getState().addWatcher(new PlayersAttackedThisTurnWatcher());
|
||||
}
|
||||
|
||||
private void initPlayerDefaultWatchers(UUID playerId) {
|
||||
public void initPlayerDefaultWatchers(UUID playerId) {
|
||||
getState().addWatcher(new PlayerDamagedBySourceWatcher(playerId));
|
||||
getState().addWatcher(new BloodthirstWatcher(playerId));
|
||||
}
|
||||
|
|
|
@ -463,7 +463,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
target.setRequired(true);
|
||||
target.setTargetName("planeswalker or player for " + creature.getLogName() + " to attack");
|
||||
if (player.chooseTarget(Outcome.Damage, target, null, game)) {
|
||||
System.out.println("The player " + player.getName() + " declares an attacker here. " + creature.getName());
|
||||
//System.out.println("The player " + player.getName() + " declares an attacker here. " + creature.getName());
|
||||
player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue