mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Merge pull request #18 from magefree/master
Merge https://github.com/magefree/mage
This commit is contained in:
commit
e6fe4b5478
15 changed files with 78 additions and 80 deletions
|
|
@ -5,19 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.mage.card.arcane;
|
package org.mage.card.arcane;
|
||||||
|
|
||||||
import mage.ObjectColor;
|
|
||||||
import mage.cards.ArtRect;
|
|
||||||
import mage.cards.FrameStyle;
|
|
||||||
import mage.client.dialog.PreferencesDialog;
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.MageObjectType;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.util.SubTypeList;
|
|
||||||
import mage.view.CardView;
|
|
||||||
import mage.view.PermanentView;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.font.*;
|
import java.awt.font.*;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
@ -31,6 +18,18 @@ import java.text.CharacterIterator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.swing.*;
|
||||||
|
import mage.ObjectColor;
|
||||||
|
import mage.cards.ArtRect;
|
||||||
|
import mage.cards.FrameStyle;
|
||||||
|
import mage.client.dialog.PreferencesDialog;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.MageObjectType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.util.SubTypeList;
|
||||||
|
import mage.view.CardView;
|
||||||
|
import mage.view.PermanentView;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -77,9 +76,9 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Font loadFont(String name) {
|
private static Font loadFont(String name) {
|
||||||
try(InputStream in = ModernCardRenderer.class.getResourceAsStream("/cardrender/" + name + ".ttf")) {
|
try (InputStream in = ModernCardRenderer.class.getResourceAsStream("/cardrender/" + name + ".ttf")) {
|
||||||
return Font.createFont(
|
return Font.createFont(
|
||||||
Font.TRUETYPE_FONT,in);
|
Font.TRUETYPE_FONT, in);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.info("Failed to load font `" + name + "`, couldn't find resource.");
|
LOGGER.info("Failed to load font `" + name + "`, couldn't find resource.");
|
||||||
} catch (FontFormatException e) {
|
} catch (FontFormatException e) {
|
||||||
|
|
@ -353,7 +352,7 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
if (useInventionFrame()) {
|
if (useInventionFrame()) {
|
||||||
drawArtIntoRect(g,
|
drawArtIntoRect(g,
|
||||||
borderWidth, borderWidth,
|
borderWidth, borderWidth,
|
||||||
cardWidth - 2*borderWidth, cardHeight - 2*borderWidth,
|
cardWidth - 2 * borderWidth, cardHeight - 2 * borderWidth,
|
||||||
getArtRect(), false);
|
getArtRect(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,11 +366,11 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
// each filling half of the art rect
|
// each filling half of the art rect
|
||||||
drawArtIntoRect(g,
|
drawArtIntoRect(g,
|
||||||
totalContentInset + 1, totalContentInset + boxHeight,
|
totalContentInset + 1, totalContentInset + boxHeight,
|
||||||
contentWidth - 2, (typeLineY - totalContentInset - boxHeight)/2,
|
contentWidth - 2, (typeLineY - totalContentInset - boxHeight) / 2,
|
||||||
ArtRect.SPLIT_LEFT.rect, useInventionFrame());
|
ArtRect.SPLIT_LEFT.rect, useInventionFrame());
|
||||||
drawArtIntoRect(g,
|
drawArtIntoRect(g,
|
||||||
totalContentInset + 1, totalContentInset + boxHeight + (typeLineY - totalContentInset - boxHeight)/2,
|
totalContentInset + 1, totalContentInset + boxHeight + (typeLineY - totalContentInset - boxHeight) / 2,
|
||||||
contentWidth - 2, (typeLineY - totalContentInset - boxHeight)/2,
|
contentWidth - 2, (typeLineY - totalContentInset - boxHeight) / 2,
|
||||||
ArtRect.SPLIT_RIGHT.rect, useInventionFrame());
|
ArtRect.SPLIT_RIGHT.rect, useInventionFrame());
|
||||||
return;
|
return;
|
||||||
} else if (rect != ArtRect.NORMAL) {
|
} else if (rect != ArtRect.NORMAL) {
|
||||||
|
|
@ -849,6 +848,9 @@ public class ModernCardRenderer extends CardRenderer {
|
||||||
inset = cardWidth / 12;
|
inset = cardWidth / 12;
|
||||||
}
|
}
|
||||||
int availWidth = w - inset;
|
int availWidth = w - inset;
|
||||||
|
if (availWidth < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
FontRenderContext frc = g.getFontRenderContext();
|
FontRenderContext frc = g.getFontRenderContext();
|
||||||
AttributedCharacterIterator textIter = text.getIterator();
|
AttributedCharacterIterator textIter = text.getIterator();
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
|
||||||
public final static int MAGE_VERSION_MAJOR = 1;
|
public final static int MAGE_VERSION_MAJOR = 1;
|
||||||
public final static int MAGE_VERSION_MINOR = 4;
|
public final static int MAGE_VERSION_MINOR = 4;
|
||||||
public final static int MAGE_VERSION_PATCH = 26;
|
public final static int MAGE_VERSION_PATCH = 26;
|
||||||
public final static String MAGE_VERSION_MINOR_PATCH = "V7";
|
public final static String MAGE_VERSION_MINOR_PATCH = "V8";
|
||||||
public final static String MAGE_VERSION_INFO = "";
|
public final static String MAGE_VERSION_INFO = "";
|
||||||
|
|
||||||
private final int major;
|
private final int major;
|
||||||
|
|
|
||||||
|
|
@ -161,10 +161,9 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
||||||
Game sim = createSimulation(game);
|
Game sim = createSimulation(game);
|
||||||
SimulationNode2.resetCount();
|
SimulationNode2.resetCount();
|
||||||
root = new SimulationNode2(null, sim, maxDepth, playerId);
|
root = new SimulationNode2(null, sim, maxDepth, playerId);
|
||||||
|
|
||||||
addActionsTimed();
|
addActionsTimed();
|
||||||
logger.trace("After add actions timed: root.children.size = " + root.children.size());
|
if (root.children != null && !root.children.isEmpty()) {
|
||||||
if (!root.children.isEmpty()) {
|
logger.trace("After add actions timed: root.children.size = " + root.children.size());
|
||||||
root = root.children.get(0);
|
root = root.children.get(0);
|
||||||
// int bestScore = root.getScore();
|
// int bestScore = root.getScore();
|
||||||
// if (bestScore > currentScore || allowBadMoves) {
|
// if (bestScore > currentScore || allowBadMoves) {
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.clear();
|
response.clear();
|
||||||
loop = true;
|
if (isInGame()) {
|
||||||
|
loop = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ import mage.target.common.TargetCreaturePermanent;
|
||||||
public class DarksteelMutation extends CardImpl {
|
public class DarksteelMutation extends CardImpl {
|
||||||
|
|
||||||
public DarksteelMutation(UUID ownerId, CardSetInfo setInfo) {
|
public DarksteelMutation(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||||
this.subtype.add(SubType.AURA);
|
this.subtype.add(SubType.AURA);
|
||||||
|
|
||||||
// Enchant creature
|
// Enchant creature
|
||||||
|
|
@ -67,7 +67,7 @@ public class DarksteelMutation extends CardImpl {
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||||
new BecomesCreatureAttachedEffect(new DarksteelMutationInsectToken(),
|
new BecomesCreatureAttachedEffect(new DarksteelMutationInsectToken(),
|
||||||
"Enchanted creature is an Insect artifact creature with base power and toughness 0/1 and has indestructible, and it loses all other abilities, card types, and creature types.",
|
"Enchanted creature is an Insect artifact creature with base power and toughness 0/1 and has indestructible, and it loses all other abilities, card types, and creature types.",
|
||||||
Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ALL)));
|
Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ALL_BUT_COLOR)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,17 +51,16 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
|
||||||
import mage.util.RandomUtil;
|
import mage.util.RandomUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author L_J
|
* @author L_J
|
||||||
*/
|
*/
|
||||||
public class ElkinLair extends CardImpl {
|
public class ElkinLair extends CardImpl {
|
||||||
|
|
||||||
public ElkinLair(UUID ownerId, CardSetInfo setInfo) {
|
public ElkinLair(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
|
||||||
addSuperType(SuperType.WORLD);
|
addSuperType(SuperType.WORLD);
|
||||||
|
|
||||||
// At the beginning of each player's upkeep, that player exiles a card at random from his or her hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, he or she puts it into his or her graveyard.
|
// At the beginning of each player's upkeep, that player exiles a card at random from his or her hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, he or she puts it into his or her graveyard.
|
||||||
|
|
@ -111,11 +110,9 @@ class ElkinLairUpkeepEffect extends OneShotEffect {
|
||||||
ContinuousEffect effect = new ElkinLairPlayExiledEffect(Duration.EndOfTurn);
|
ContinuousEffect effect = new ElkinLairPlayExiledEffect(Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
|
||||||
DelayedTriggeredAbility delayed = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ElkinLairPutIntoGraveyardEffect());
|
DelayedTriggeredAbility delayed = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ElkinLairPutIntoGraveyardEffect());
|
||||||
game.addDelayedTriggeredAbility(delayed, source);
|
game.addDelayedTriggeredAbility(delayed, source);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -150,8 +147,8 @@ class ElkinLairPlayExiledEffect extends AsThoughEffectImpl {
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
Card card = game.getCard(objectId);
|
Card card = game.getCard(objectId);
|
||||||
if (card != null
|
if (card != null
|
||||||
&& affectedControllerId.equals(card.getOwnerId())
|
&& affectedControllerId.equals(card.getOwnerId())
|
||||||
&& game.getState().getZone(card.getId()) == Zone.EXILED) {
|
&& game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -173,7 +170,6 @@ class ElkinLairPutIntoGraveyardEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(game.getActivePlayerId());
|
Player player = game.getPlayer(game.getActivePlayerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), 0);
|
|
||||||
Set<Card> cardsInExile = game.getExile().getExileZone(source.getSourceId()).getCards(game);
|
Set<Card> cardsInExile = game.getExile().getExileZone(source.getSourceId()).getCards(game);
|
||||||
if (cardsInExile != null) {
|
if (cardsInExile != null) {
|
||||||
player.moveCardsToGraveyardWithInfo(cardsInExile, source, game, Zone.EXILED);
|
player.moveCardsToGraveyardWithInfo(cardsInExile, source, game, Zone.EXILED);
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,7 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.players.PlayerList;
|
|
||||||
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
|
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -72,6 +69,7 @@ class InvasionPlansEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
public InvasionPlansEffect() {
|
public InvasionPlansEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, true, false);
|
super(Duration.WhileOnBattlefield, Outcome.Benefit, true, false);
|
||||||
|
staticText = "The attacking player chooses how each creature blocks each ";
|
||||||
}
|
}
|
||||||
|
|
||||||
public InvasionPlansEffect(final InvasionPlansEffect effect) {
|
public InvasionPlansEffect(final InvasionPlansEffect effect) {
|
||||||
|
|
@ -103,4 +101,3 @@ class InvasionPlansEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ package mage.cards.k;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||||
|
|
@ -111,13 +112,16 @@ class KopalaWardenOfWavesCostReductionEffect extends CostModificationEffectImpl
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify.getAbilityType() == AbilityType.SPELL) {
|
if (abilityToModify.getAbilityType() == AbilityType.SPELL) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||||
for (Target target : abilityToModify.getTargets()) {
|
for (UUID modeId : abilityToModify.getModes().getSelectedModes()) {
|
||||||
for (UUID targetUUID : target.getTargets()) {
|
Mode mode = abilityToModify.getModes().get(modeId);
|
||||||
Permanent creature = game.getPermanent(targetUUID);
|
for (Target target : mode.getTargets()) {
|
||||||
if (creature != null
|
for (UUID targetUUID : target.getTargets()) {
|
||||||
&& filter.match(creature, game)
|
Permanent creature = game.getPermanent(targetUUID);
|
||||||
&& creature.getControllerId().equals(source.getControllerId())) {
|
if (creature != null
|
||||||
return true;
|
&& filter.match(creature, game)
|
||||||
|
&& creature.getControllerId().equals(source.getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
|
|
@ -96,23 +94,16 @@ class MistOfStagnationEffect extends OneShotEffect {
|
||||||
if (activePlayer != null) {
|
if (activePlayer != null) {
|
||||||
int cardsInGrave = activePlayer.getGraveyard().size();
|
int cardsInGrave = activePlayer.getGraveyard().size();
|
||||||
if (cardsInGrave > 0) {
|
if (cardsInGrave > 0) {
|
||||||
Set<TargetPermanent> targets = new HashSet<>();
|
TargetPermanent target = new TargetPermanent(cardsInGrave, cardsInGrave, new FilterPermanent("permanents to untap"), true);
|
||||||
for (int i = 1; 1 <= cardsInGrave; i++) {
|
activePlayer.chooseTarget(outcome, target, source, game);
|
||||||
TargetPermanent target = new TargetPermanent(1, 1, new FilterPermanent(), true);
|
for (UUID oneTarget : target.getTargets()) {
|
||||||
target.setTargetController(activePlayer.getId());
|
Permanent p = game.getPermanent(oneTarget);
|
||||||
target.setTargetController(activePlayer.getId());
|
|
||||||
if (target.canChoose(source.getSourceId(), activePlayer.getId(), game) && activePlayer.chooseTarget(Outcome.Untap, target, source, game)) {
|
|
||||||
targets.add(target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (TargetPermanent target : targets) {
|
|
||||||
Permanent p = game.getPermanent(target.getFirstTarget());
|
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
p.untap(game);
|
p.untap(game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
import mage.abilities.condition.InvertCondition;
|
import mage.abilities.condition.InvertCondition;
|
||||||
import mage.abilities.condition.common.TargetAttackedThisTurnCondition;
|
|
||||||
import mage.abilities.condition.common.BeforeAttackersAreDeclaredCondition;
|
import mage.abilities.condition.common.BeforeAttackersAreDeclaredCondition;
|
||||||
|
import mage.abilities.condition.common.TargetAttackedThisTurnCondition;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
|
@ -52,7 +52,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.filter.predicate.permanent.ControlledFromStartOfControllerTurnPredicate;
|
import mage.filter.predicate.permanent.ControlledFromStartOfControllerTurnPredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||||
|
|
@ -62,13 +61,15 @@ import mage.watchers.common.AttackedThisTurnWatcher;
|
||||||
* @author MTGfan & L_J
|
* @author MTGfan & L_J
|
||||||
*/
|
*/
|
||||||
public class Norritt extends CardImpl {
|
public class Norritt extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filterBlue = new FilterCreaturePermanent("blue creature");
|
private static final FilterCreaturePermanent filterBlue = new FilterCreaturePermanent("blue creature");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("non-Wall creature");
|
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("non-Wall creature");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterCreature.add(Predicates.not(new SubtypePredicate(SubType.WALL)));
|
filterCreature.add(Predicates.not(new SubtypePredicate(SubType.WALL)));
|
||||||
filterCreature.add(new ControlledFromStartOfControllerTurnPredicate());
|
filterCreature.add(new ControlledFromStartOfControllerTurnPredicate());
|
||||||
|
|
@ -90,7 +91,7 @@ public class Norritt extends CardImpl {
|
||||||
|
|
||||||
// {T}: Choose target non-Wall creature the active player has controlled continuously since the beginning of the turn. That creature attacks this turn if able. If it doesn't, destroy it at the beginning of the next end step. Activate this ability only before attackers are declared.
|
// {T}: Choose target non-Wall creature the active player has controlled continuously since the beginning of the turn. That creature attacks this turn if able. If it doesn't, destroy it at the beginning of the next end step. Activate this ability only before attackers are declared.
|
||||||
Ability ability2 = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new AttacksIfAbleTargetEffect(Duration.EndOfTurn),
|
Ability ability2 = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new AttacksIfAbleTargetEffect(Duration.EndOfTurn),
|
||||||
new TapSourceCost(), BeforeAttackersAreDeclaredCondition.instance,
|
new TapSourceCost(), BeforeAttackersAreDeclaredCondition.instance,
|
||||||
"{T}: Choose target non-Wall creature the active player has controlled continuously since the beginning of the turn. "
|
"{T}: Choose target non-Wall creature the active player has controlled continuously since the beginning of the turn. "
|
||||||
+ "That creature attacks this turn if able. If it doesn't, destroy it at the beginning of the next end step. "
|
+ "That creature attacks this turn if able. If it doesn't, destroy it at the beginning of the next end step. "
|
||||||
+ "Activate this ability only before attackers are declared.");
|
+ "Activate this ability only before attackers are declared.");
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,13 @@ import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.WatcherScope;
|
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
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.game.permanent.Permanent;
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.watchers.Watcher;
|
import mage.watchers.Watcher;
|
||||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||||
|
|
@ -116,14 +114,14 @@ class SeasonOfTheWitchEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
// Creatures that attacked are safe.
|
// Creatures that attacked are safe.
|
||||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName());
|
||||||
if (watcher != null
|
if (watcher != null
|
||||||
&& watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game)) ) {
|
&& watcher.getAttackedThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Creatures that couldn't attack are safe.
|
// Creatures that couldn't attack are safe.
|
||||||
CouldAttackThisTurnWatcher watcher2 = (CouldAttackThisTurnWatcher) game.getState().getWatchers().get(CouldAttackThisTurnWatcher.class.getSimpleName());
|
CouldAttackThisTurnWatcher watcher2 = (CouldAttackThisTurnWatcher) game.getState().getWatchers().get(CouldAttackThisTurnWatcher.class.getSimpleName());
|
||||||
if (watcher2 != null
|
if (watcher2 != null
|
||||||
&& !watcher2.getCouldAttackThisTurnCreatures().contains(new MageObjectReference(permanent, game)) ) {
|
&& !watcher2.getCouldAttackThisTurnCreatures().contains(new MageObjectReference(permanent, game))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Destroy the rest.
|
// Destroy the rest.
|
||||||
|
|
@ -156,11 +154,11 @@ class CouldAttackThisTurnWatcher extends Watcher {
|
||||||
if (permanent.isCreature()) {
|
if (permanent.isCreature()) {
|
||||||
for (UUID defender : game.getCombat().getDefenders()) {
|
for (UUID defender : game.getCombat().getDefenders()) {
|
||||||
if (defender != activePlayer.getId()) {
|
if (defender != activePlayer.getId()) {
|
||||||
if (permanent.canAttack(defender, game)) {
|
if (permanent.canAttack(defender, game)) {
|
||||||
// exclude Propaganda style effects
|
// exclude Propaganda style effects
|
||||||
if (!game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects(
|
if (!game.getContinuousEffects().checkIfThereArePayCostToAttackBlockEffects(
|
||||||
GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER,
|
GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER,
|
||||||
defender, permanent.getId(), permanent.getControllerId()), game)) {
|
defender, permanent.getId(), permanent.getControllerId()), game)) {
|
||||||
this.couldAttackThisTurnCreatures.add(new MageObjectReference(permanent.getId(), game));
|
this.couldAttackThisTurnCreatures.add(new MageObjectReference(permanent.getId(), game));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public enum CardRepository {
|
||||||
// raise this if db structure was changed
|
// raise this if db structure was changed
|
||||||
private static final long CARD_DB_VERSION = 51;
|
private static final long CARD_DB_VERSION = 51;
|
||||||
// raise this if new cards were added to the server
|
// raise this if new cards were added to the server
|
||||||
private static final long CARD_CONTENT_VERSION = 94;
|
private static final long CARD_CONTENT_VERSION = 95;
|
||||||
private Dao<CardInfo, Object> cardDao;
|
private Dao<CardInfo, Object> cardDao;
|
||||||
private Set<String> classNames;
|
private Set<String> classNames;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -563,7 +563,12 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
// }
|
// }
|
||||||
@Override
|
@Override
|
||||||
public void setConcedingPlayer(UUID playerId) {
|
public void setConcedingPlayer(UUID playerId) {
|
||||||
Player player = getPlayer(state.getPriorityPlayerId());
|
Player player = null;
|
||||||
|
if (state.getChoosingPlayerId() != null) {
|
||||||
|
player = getPlayer(state.getChoosingPlayerId());
|
||||||
|
} else if (state.getPriorityPlayerId() != null) {
|
||||||
|
player = getPlayer(state.getPriorityPlayerId());
|
||||||
|
}
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (!player.hasLeft() && player.isHuman()) {
|
if (!player.hasLeft() && player.isHuman()) {
|
||||||
if (!concedingPlayers.contains(playerId)) {
|
if (!concedingPlayers.contains(playerId)) {
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ public class ManaPool implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConditional(manaType, ability, filter, game, costToPay) > 0) {
|
if (getConditional(manaType, ability, filter, game, costToPay) > 0) {
|
||||||
removeConditional(manaType, ability, game, costToPay);
|
removeConditional(manaType, ability, game, costToPay, usedManaToPay);
|
||||||
lockManaType(); // pay only one mana if mana payment is set to manually
|
lockManaType(); // pay only one mana if mana payment is set to manually
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -437,10 +437,11 @@ public class ManaPool implements Serializable {
|
||||||
return new ManaPool(this);
|
return new ManaPool(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay) {
|
private void removeConditional(ManaType manaType, Ability ability, Game game, Cost costToPay, Mana usedManaToPay) {
|
||||||
for (ConditionalMana mana : getConditionalMana()) {
|
for (ConditionalMana mana : getConditionalMana()) {
|
||||||
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
|
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
|
||||||
mana.set(manaType, mana.get(manaType) - 1);
|
mana.set(manaType, mana.get(manaType) - 1);
|
||||||
|
usedManaToPay.increase(manaType);
|
||||||
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag());
|
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAID, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag());
|
||||||
event.setData(mana.getManaProducerOriginalId().toString());
|
event.setData(mana.getManaProducerOriginalId().toString());
|
||||||
game.fireEvent(event);
|
game.fireEvent(event);
|
||||||
|
|
|
||||||
|
|
@ -1751,7 +1751,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life");
|
game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life");
|
||||||
}
|
}
|
||||||
game.fireEvent(new GameEvent(GameEvent.EventType.LOST_LIFE, playerId, playerId, playerId, amount, atCombat));
|
if (amount > 0) {
|
||||||
|
game.fireEvent(new GameEvent(GameEvent.EventType.LOST_LIFE, playerId, playerId, playerId, amount, atCombat));
|
||||||
|
}
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue