Merge branch 'master' into mtga-deck-import

This commit is contained in:
John Hitchings 2019-05-19 13:28:27 -07:00
commit 6e0e3899b8
16 changed files with 57 additions and 41 deletions

View file

@ -426,6 +426,7 @@
<Property name="toolTipText" type="java.lang.String" value="Connect to mtg.powersofwar.com (USA, use any username without registration)"/>
<Property name="actionCommand" type="java.lang.String" value="connectXmageus"/>
<Property name="alignmentY" type="float" value="0.0"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 2, 2, 2]"/>
</Property>

View file

@ -287,6 +287,7 @@ public class ConnectDialog extends MageDialog {
btnFindUs.setToolTipText("Connect to mtg.powersofwar.com (USA, use any username without registration)");
btnFindUs.setActionCommand("connectXmageus");
btnFindUs.setAlignmentY(0.0F);
btnFindUs.setEnabled(false);
btnFindUs.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindUs.setName("connectXmageusBtn"); // NOI18N
btnFindUs.setPreferredSize(new java.awt.Dimension(23, 23));

View file

@ -194,7 +194,7 @@ public class CountryComboBox extends JComboBox {
{"Portugal", "pt"},
{"Puerto Rico", "pr"},
{"Qatar", "qa"},
{"Réunion", "re"},
{"Reunion", "re"},
{"Romania", "ro"},
{"Russian Federation", "ru"},
{"Rwanda", "rw"},

View file

@ -290,7 +290,7 @@ public enum GrabbagImageSource implements CardImageSource {
singleLinks.put("SWS/Senator Bail Organa", "BRkUuYU.jpg");
singleLinks.put("SWS/Senator Lott Dod", "yYQtXZo.jpg");
singleLinks.put("SWS/Senator Onaconda Farr", "oPez77z.png");
singleLinks.put("SWS/Senator Padmé Amidala", "287deD9.jpg");
singleLinks.put("SWS/Senator Padme Amidala", "287deD9.jpg");
singleLinks.put("SWS/Senator Passel Argente", "51qpnaE.jpg");
singleLinks.put("SWS/Shaak Herd", "PtnZD0I.jpg");
singleLinks.put("SWS/Shadow Trooper", "09NAiGa.jpg");

View file

@ -13,7 +13,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public static final int MAGE_VERSION_MINOR = 4;
public static final int MAGE_VERSION_PATCH = 35;
public static final String MAGE_EDITION_INFO = ""; // set "-beta" for 1.4.32-betaV0
public static final String MAGE_VERSION_MINOR_PATCH = "V5"; // default
public static final String MAGE_VERSION_MINOR_PATCH = "V6"; // default
// strict mode
private static final boolean MAGE_VERSION_MINOR_PATCH_MUST_BE_SAME = true; // set true on uncompatible github changes, set false after new major release (after MAGE_VERSION_PATCH changes)

View file

@ -88,7 +88,9 @@ class ArmoryAutomatonEffect extends OneShotEffect {
while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.Benefit, "Select and attach a target Equipment?", source, game)) {
Target targetEquipment = new TargetPermanent(currentFilter);
targetEquipment.setRequired(false);
if (player.choose(Outcome.Benefit, targetEquipment, source.getSourceId(), game)) {
if (player.choose(Outcome.Benefit, targetEquipment, source.getSourceId(), game) && targetEquipment.getFirstTarget() != null) {
currentFilter.add(Predicates.not(new PermanentIdPredicate(targetEquipment.getFirstTarget()))); // exclude selected for next time
Permanent aura = game.getPermanent(targetEquipment.getFirstTarget());
if (aura != null) {
Permanent attachedTo = game.getPermanent(aura.getAttachedTo());
@ -96,10 +98,9 @@ class ArmoryAutomatonEffect extends OneShotEffect {
attachedTo.removeAttachment(aura.getId(), game);
}
sourcePermanent.addAttachment(aura.getId(), game);
// exclude selected
currentFilter.add(Predicates.not(new PermanentIdPredicate(aura.getId())));
}
} else {
break;
}
countBattlefield = game.getBattlefield().getAllActivePermanents(currentFilter, game).size();
}

View file

@ -82,7 +82,7 @@ class FrayingOmnipotenceEffect extends OneShotEffect {
player.discard(cardsToDiscard, false, source, game);
}
}
// then sacrifices half of the creatures they controls,
// then sacrifices half of the creatures they control,
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player == null) {

View file

@ -1,7 +1,5 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
@ -13,11 +11,7 @@ import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -25,6 +19,8 @@ import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -77,8 +73,9 @@ class FrenziedFugueTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
this.getEffects().clear();
boolean result;
if (event.getType()==EventType.ENTERS_THE_BATTLEFIELD) {
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
result = event.getTargetId().equals(this.getSourceId());
} else {
result = event.getPlayerId().equals(this.getControllerId());
@ -88,13 +85,13 @@ class FrenziedFugueTriggeredAbility extends TriggeredAbilityImpl {
if (enchantment != null && enchantment.getAttachedTo() != null) {
Effect effect = new GainControlTargetEffect(Duration.EndOfTurn, true);
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
getEffects().add(effect);
this.getEffects().add(effect);
effect = new UntapTargetEffect();
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
getEffects().add(effect);
this.getEffects().add(effect);
effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
getEffects().add(effect);
this.getEffects().add(effect);
} else {
result = false;
}

View file

@ -1,6 +1,5 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
@ -13,8 +12,9 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author L_J
*/
public final class OrimsPrayer extends CardImpl {
@ -73,8 +73,8 @@ class OrimsPrayerTriggeredAbility extends TriggeredAbilityImpl {
applied = true;
}
}
if (applied
&& numberAttackingController > 0) {
if (applied && numberAttackingController > 0) {
this.getEffects().clear();
this.getEffects().add(new GainLifeEffect(numberAttackingController));
}
return applied;

View file

@ -1,15 +1,20 @@
package mage.cards.u;
import mage.MageObject;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -27,13 +32,11 @@ import mage.game.permanent.token.UginTheIneffableToken;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import static mage.constants.Outcome.Benefit;
@ -101,20 +104,31 @@ class UginTheIneffableEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
MageObject sourceObject = source.getSourceObject(game);
if (player == null || sourceObject == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
player.lookAtCards(sourcePermanent.getIdName(), card, game);
player.moveCards(card, Zone.EXILED, source, game);
if (card == null) {
return false;
}
// exile and look
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (player.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName() + " (" + player.getName() + ")")) {
card.turnFaceDown(game, source.getControllerId());
player.lookAtCards(player.getName() + " - " + card.getIdName() + " - " + CardUtil.sdf.format(System.currentTimeMillis()), card, game);
}
// create token
Set<MageObjectReference> tokenObjs = new HashSet<>();
CreateTokenEffect effect = new CreateTokenEffect(new UginTheIneffableToken());
effect.apply(game, source);
for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
// with return ability
for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
// display referenced exiled face-down card on token
SimpleStaticAbility sa = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("Referenced object: "
+ card.getId().toString().substring(0, 3)));

View file

@ -290,7 +290,7 @@ public final class StarWars extends ExpansionSet {
cards.add(new SetCardInfo("Senator Bail Organa", 209, Rarity.UNCOMMON, mage.cards.s.SenatorBailOrgana.class));
cards.add(new SetCardInfo("Senator Lott Dod", 210, Rarity.UNCOMMON, mage.cards.s.SenatorLottDod.class));
cards.add(new SetCardInfo("Senator Onaconda Farr", 211, Rarity.UNCOMMON, mage.cards.s.SenatorOnacondaFarr.class));
cards.add(new SetCardInfo("Senator Padmé Amidala", 212, Rarity.UNCOMMON, mage.cards.s.SenatorPadmeAmidala.class));
cards.add(new SetCardInfo("Senator Padme Amidala", 212, Rarity.UNCOMMON, mage.cards.s.SenatorPadmeAmidala.class));
cards.add(new SetCardInfo("Senator Passel Argente", 213, Rarity.UNCOMMON, mage.cards.s.SenatorPasselArgente.class));
cards.add(new SetCardInfo("Shaak Herd", 155, Rarity.COMMON, mage.cards.s.ShaakHerd.class));
cards.add(new SetCardInfo("Shadow Trooper", 56, Rarity.COMMON, mage.cards.s.ShadowTrooper.class));

View file

@ -36,7 +36,7 @@ public class CantAttackYouUnlessPayManaAllEffect extends PayCostToAttackBlockEff
+ (payAlsoForAttackingPlaneswalker ? "or a planeswalker you control " : "")
+ "unless their controller pays "
+ (manaCosts == null ? "" : manaCosts.getText())
+ " for each creature they controls that's attacking you";
+ " for each creature they control that's attacking you";
}
public CantAttackYouUnlessPayManaAllEffect(final CantAttackYouUnlessPayManaAllEffect effect) {

View file

@ -15,6 +15,8 @@ public class CardNameUtil {
.replace("í", "i")
.replace("â", "a")
.replace("á", "a")
.replace("à", "a")
.replace("é", "e")
.replace("ú", "u")
.replace("\"", "'");
}

View file

@ -2874,7 +2874,7 @@ public abstract class GameImpl implements Game, Serializable {
player.addCommanderId(card.getId());
// no needs in initCommander call -- it's uses on game startup (init)
}
} else {
} else if (!command.isEmpty()) {
throw new IllegalArgumentException("Command zone supports in commander test games");
}

View file

@ -67,7 +67,6 @@ import mage.util.RandomUtil;
import org.apache.log4j.Logger;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
@ -75,8 +74,6 @@ public abstract class PlayerImpl implements Player, Serializable {
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
/**
* Used to cancel waiting requests send to the player
*/
@ -3471,7 +3468,7 @@ public abstract class PlayerImpl implements Player, Serializable {
String lookNo = abilitiesToActivate > 0 ? "No, activate ability" : "No";
if (chooseUse(Outcome.Benefit, lookMessage, "", lookYes, lookNo, null, game)) {
Cards cards = new CardsImpl(card);
this.lookAtCards(getName() + " - " + sdf.format(System.currentTimeMillis()), cards, game);
this.lookAtCards(getName() + " - " + card.getIdName() + " - " + CardUtil.sdf.format(System.currentTimeMillis()), cards, game);
return true;
}
}

View file

@ -14,6 +14,7 @@ import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.util.functions.CopyTokenFunction;
import java.text.SimpleDateFormat;
import java.util.UUID;
/**
@ -29,6 +30,8 @@ public final class CardUtil {
static final String[] ordinalStrings = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eightth", "ninth",
"tenth", "eleventh", "twelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", "nineteenth", "twentieth"};
public static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
/**
* Increase spell or ability cost to be paid.
*