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;
|
||||
|
||||
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.font.*;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
|
@ -31,6 +18,18 @@ import java.text.CharacterIterator;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
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;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -849,6 +848,9 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
inset = cardWidth / 12;
|
||||
}
|
||||
int availWidth = w - inset;
|
||||
if (availWidth < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
FontRenderContext frc = g.getFontRenderContext();
|
||||
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_MINOR = 4;
|
||||
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 = "";
|
||||
|
||||
private final int major;
|
||||
|
|
|
|||
|
|
@ -161,10 +161,9 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
Game sim = createSimulation(game);
|
||||
SimulationNode2.resetCount();
|
||||
root = new SimulationNode2(null, sim, maxDepth, playerId);
|
||||
|
||||
addActionsTimed();
|
||||
if (root.children != null && !root.children.isEmpty()) {
|
||||
logger.trace("After add actions timed: root.children.size = " + root.children.size());
|
||||
if (!root.children.isEmpty()) {
|
||||
root = root.children.get(0);
|
||||
// int bestScore = root.getScore();
|
||||
// if (bestScore > currentScore || allowBadMoves) {
|
||||
|
|
|
|||
|
|
@ -205,9 +205,11 @@ public class HumanPlayer extends PlayerImpl {
|
|||
return;
|
||||
}
|
||||
response.clear();
|
||||
if (isInGame()) {
|
||||
loop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
||||
// logger.info("Adding an action " + response);
|
||||
actionQueueSaved.add(new PlayerResponse(response));
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class DarksteelMutation extends CardImpl {
|
|||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||
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.",
|
||||
Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ALL)));
|
||||
Duration.WhileOnBattlefield, BecomesCreatureAttachedEffect.LoseType.ALL_BUT_COLOR)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
/**
|
||||
|
|
@ -114,8 +113,6 @@ class ElkinLairUpkeepEffect extends OneShotEffect {
|
|||
|
||||
DelayedTriggeredAbility delayed = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ElkinLairPutIntoGraveyardEffect());
|
||||
game.addDelayedTriggeredAbility(delayed, source);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -173,7 +170,6 @@ class ElkinLairPutIntoGraveyardEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player != null) {
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), 0);
|
||||
Set<Card> cardsInExile = game.getExile().getExileZone(source.getSourceId()).getCards(game);
|
||||
if (cardsInExile != null) {
|
||||
player.moveCardsToGraveyardWithInfo(cardsInExile, source, game, Zone.EXILED);
|
||||
|
|
|
|||
|
|
@ -37,10 +37,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
import static mage.filter.StaticFilters.FILTER_PERMANENT_CREATURES;
|
||||
|
||||
/**
|
||||
|
|
@ -72,6 +69,7 @@ class InvasionPlansEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
public InvasionPlansEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, true, false);
|
||||
staticText = "The attacking player chooses how each creature blocks each ";
|
||||
}
|
||||
|
||||
public InvasionPlansEffect(final InvasionPlansEffect effect) {
|
||||
|
|
@ -103,4 +101,3 @@ class InvasionPlansEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.cards.k;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
|
|
@ -111,7 +112,9 @@ class KopalaWardenOfWavesCostReductionEffect extends CostModificationEffectImpl
|
|||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getAbilityType() == AbilityType.SPELL) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||
for (Target target : abilityToModify.getTargets()) {
|
||||
for (UUID modeId : abilityToModify.getModes().getSelectedModes()) {
|
||||
Mode mode = abilityToModify.getModes().get(modeId);
|
||||
for (Target target : mode.getTargets()) {
|
||||
for (UUID targetUUID : target.getTargets()) {
|
||||
Permanent creature = game.getPermanent(targetUUID);
|
||||
if (creature != null
|
||||
|
|
@ -123,6 +126,7 @@ class KopalaWardenOfWavesCostReductionEffect extends CostModificationEffectImpl
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@
|
|||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
|
@ -96,23 +94,16 @@ class MistOfStagnationEffect extends OneShotEffect {
|
|||
if (activePlayer != null) {
|
||||
int cardsInGrave = activePlayer.getGraveyard().size();
|
||||
if (cardsInGrave > 0) {
|
||||
Set<TargetPermanent> targets = new HashSet<>();
|
||||
for (int i = 1; 1 <= cardsInGrave; i++) {
|
||||
TargetPermanent target = new TargetPermanent(1, 1, new FilterPermanent(), true);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
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());
|
||||
TargetPermanent target = new TargetPermanent(cardsInGrave, cardsInGrave, new FilterPermanent("permanents to untap"), true);
|
||||
activePlayer.chooseTarget(outcome, target, source, game);
|
||||
for (UUID oneTarget : target.getTargets()) {
|
||||
Permanent p = game.getPermanent(oneTarget);
|
||||
if (p != null) {
|
||||
p.untap(game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.condition.InvertCondition;
|
||||
import mage.abilities.condition.common.TargetAttackedThisTurnCondition;
|
||||
import mage.abilities.condition.common.BeforeAttackersAreDeclaredCondition;
|
||||
import mage.abilities.condition.common.TargetAttackedThisTurnCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||
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.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
|
@ -64,11 +63,13 @@ import mage.watchers.common.AttackedThisTurnWatcher;
|
|||
public class Norritt extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filterBlue = new FilterCreaturePermanent("blue creature");
|
||||
|
||||
static {
|
||||
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
|
||||
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("non-Wall creature");
|
||||
|
||||
static {
|
||||
filterCreature.add(Predicates.not(new SubtypePredicate(SubType.WALL)));
|
||||
filterCreature.add(new ControlledFromStartOfControllerTurnPredicate());
|
||||
|
|
|
|||
|
|
@ -41,15 +41,13 @@ import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public enum CardRepository {
|
|||
// raise this if db structure was changed
|
||||
private static final long CARD_DB_VERSION = 51;
|
||||
// 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 Set<String> classNames;
|
||||
|
||||
|
|
|
|||
|
|
@ -563,7 +563,12 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
// }
|
||||
@Override
|
||||
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.hasLeft() && player.isHuman()) {
|
||||
if (!concedingPlayers.contains(playerId)) {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class ManaPool implements Serializable {
|
|||
}
|
||||
|
||||
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
|
||||
return true;
|
||||
}
|
||||
|
|
@ -437,10 +437,11 @@ public class ManaPool implements Serializable {
|
|||
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()) {
|
||||
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId(), costToPay)) {
|
||||
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());
|
||||
event.setData(mana.getManaProducerOriginalId().toString());
|
||||
game.fireEvent(event);
|
||||
|
|
|
|||
|
|
@ -1751,7 +1751,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!game.isSimulation()) {
|
||||
game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life");
|
||||
}
|
||||
if (amount > 0) {
|
||||
game.fireEvent(new GameEvent(GameEvent.EventType.LOST_LIFE, playerId, playerId, playerId, amount, atCombat));
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue