mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Merge
This commit is contained in:
commit
6cbd5369c3
32 changed files with 195 additions and 175 deletions
|
@ -25,6 +25,7 @@ Mage.Sets/target
|
|||
Mage.Tests/target
|
||||
Mage/target
|
||||
|
||||
releases
|
||||
syntax: regexp
|
||||
.class
|
||||
.jar
|
||||
|
@ -37,4 +38,4 @@ glob:Mage.Client/cheat.dck
|
|||
glob:Mage.Client/test.dck
|
||||
glob:Mage.Server.Console/target/
|
||||
|
||||
Mage.Server.Plugins/Mage.Draft.8PlayerBooster/target
|
||||
Mage.Server.Plugins/Mage.Draft.8PlayerBooster/target
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<Properties>
|
||||
|
|
|
@ -34,13 +34,19 @@
|
|||
|
||||
package mage.client;
|
||||
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.event.InternalFrameEvent;
|
||||
import javax.swing.event.InternalFrameListener;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class MagePane extends javax.swing.JInternalFrame {
|
||||
public class MagePane extends javax.swing.JInternalFrame implements InternalFrameListener {
|
||||
|
||||
/** Creates new form MagePane */
|
||||
public MagePane() {
|
||||
|
@ -89,4 +95,36 @@ public class MagePane extends javax.swing.JInternalFrame {
|
|||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
public void internalFrameOpened(InternalFrameEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameClosing(InternalFrameEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameClosed(InternalFrameEvent e) {
|
||||
try {
|
||||
MageFrame.getDesktop().getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER)[0].setSelected(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameIconified(InternalFrameEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameDeiconified(InternalFrameEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameActivated(InternalFrameEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void internalFrameDeactivated(InternalFrameEvent e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
this.btnRight.setVisible(false);
|
||||
this.btnSpecial.setVisible(false);
|
||||
this.lblMessage.setText("");
|
||||
logger.info("feedback - clear");
|
||||
logger.debug("feedback - clear");
|
||||
}
|
||||
|
||||
private synchronized void startModal() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<SyntheticProperties>
|
||||
|
@ -32,4 +32,4 @@
|
|||
<Component class="mage.client.table.TablesPanel" name="tablesPanel">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
|
|
@ -38,6 +38,8 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.event.InternalFrameEvent;
|
||||
import javax.swing.event.InternalFrameListener;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.MagePane;
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
|
||||
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 43]"/>
|
||||
|
|
|
@ -473,7 +473,8 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
|||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
while (!isCancelled()) {
|
||||
this.publish(session.getTables(roomId));
|
||||
if (MageFrame.getDesktop().getSelectedFrame() instanceof TablesPane)
|
||||
this.publish(session.getTables(roomId));
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -97,7 +97,7 @@ public class SessionManager {
|
|||
}
|
||||
|
||||
public void checkSessions() {
|
||||
logger.info("Checking sessions");
|
||||
logger.trace("Checking sessions");
|
||||
for (Session session: sessions.values()) {
|
||||
if (!session.stillAlive()) {
|
||||
logger.info("Client for user " + session.getUsername() + ":" + session.getId() + " timed out - releasing resources");
|
||||
|
|
|
@ -33,11 +33,11 @@ import java.util.UUID;
|
|||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesOnBattlefieldCount;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.PreventAllCombatDamageEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -45,13 +45,17 @@ import mage.cards.CardImpl;
|
|||
*/
|
||||
public class BlunttheAssault extends CardImpl<BlunttheAssault> {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("creature on the battlefield");
|
||||
|
||||
static {
|
||||
filter.getCardType().add(Constants.CardType.CREATURE);
|
||||
}
|
||||
|
||||
public BlunttheAssault (UUID ownerId) {
|
||||
super(ownerId, 113, "Blunt the Assault", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{G}");
|
||||
this.expansionSetCode = "SOM";
|
||||
this.color.setGreen(true);
|
||||
GainLifeEffect effect = new GainLifeEffect(new CreaturesOnBattlefieldCount());
|
||||
effect.setStaticText("You gain 1 life for each creature on the battlefield");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter)));
|
||||
this.getSpellAbility().addEffect(new PreventAllCombatDamageEffect(Constants.Duration.EndOfTurn));
|
||||
}
|
||||
|
||||
|
|
|
@ -37,15 +37,22 @@ import mage.MageInt;
|
|||
import mage.abilities.common.AttacksEachTurnStaticAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
||||
import mage.abilities.dynamicvalue.common.ControlledArtifactsOnBattlefieldCount;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public class DarksteelJuggernaut extends CardImpl<DarksteelJuggernaut> {
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifacts you control");
|
||||
|
||||
static {
|
||||
filter.getCardType().add(Constants.CardType.ARTIFACT);
|
||||
filter.setTargetController(Constants.TargetController.YOU);
|
||||
}
|
||||
|
||||
public DarksteelJuggernaut (UUID ownerId) {
|
||||
super(ownerId, 150, "Darksteel Juggernaut", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
|
||||
|
@ -53,7 +60,9 @@ public class DarksteelJuggernaut extends CardImpl<DarksteelJuggernaut> {
|
|||
this.subtype.add("Juggernaut");
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
SetPowerToughnessSourceEffect effect = new SetPowerToughnessSourceEffect(new ControlledArtifactsOnBattlefieldCount(), new ControlledArtifactsOnBattlefieldCount(), Constants.Duration.EndOfGame);
|
||||
|
||||
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(filter);
|
||||
SetPowerToughnessSourceEffect effect = new SetPowerToughnessSourceEffect(value, value, Constants.Duration.EndOfGame);
|
||||
effect.setStaticText("Darksteel Juggernaut's power and toughness are each equal to the number of artifacts you control");
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.ALL, effect));
|
||||
this.addAbility(IndestructibleAbility.getInstance());
|
||||
|
|
|
@ -42,7 +42,7 @@ import mage.filter.common.FilterLandPermanent;
|
|||
*/
|
||||
public class LandbindRitual extends CardImpl<LandbindRitual> {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("Plains");
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("Plains you control");
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Plains");
|
||||
|
@ -55,7 +55,7 @@ public class LandbindRitual extends CardImpl<LandbindRitual> {
|
|||
|
||||
this.color.setWhite(true);
|
||||
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter)));
|
||||
this.getSpellAbility().addEffect(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)));
|
||||
}
|
||||
|
||||
public LandbindRitual(final LandbindRitual card) {
|
||||
|
|
|
@ -43,7 +43,7 @@ import mage.target.TargetPlayer;
|
|||
*/
|
||||
public class MindSludge extends CardImpl<MindSludge> {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("Swamp");
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("Swamp you control");
|
||||
|
||||
static {
|
||||
filter.getSubtype().add("Swamp");
|
||||
|
|
|
@ -8,4 +8,5 @@ import java.io.Serializable;
|
|||
public interface DynamicValue extends Serializable {
|
||||
int calculate(Game game, Ability sourceAbility);
|
||||
DynamicValue clone();
|
||||
String getMessage();
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
class ArtifactsOnBattlefieldCount implements DynamicValue {
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.getCardType().add(Constants.CardType.ARTIFACT);
|
||||
filter.setScopeCardType(Filter.ComparisonScope.Any);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
return game.getBattlefield().countAll(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue clone() {
|
||||
return new ArtifactsOnBattlefieldCount();
|
||||
}
|
||||
}
|
|
@ -19,4 +19,9 @@ public class CardsInControlledPlayerHandCount implements DynamicValue {
|
|||
public DynamicValue clone() {
|
||||
return new CardsInControlledPlayerHandCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
public class ControlledArtifactsOnBattlefieldCount implements DynamicValue {
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.getCardType().add(Constants.CardType.ARTIFACT);
|
||||
filter.setScopeCardType(Filter.ComparisonScope.Any);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
return game.getBattlefield().countAll(filter, sourceAbility.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue clone() {
|
||||
return new ControlledArtifactsOnBattlefieldCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
}
|
|
@ -35,4 +35,9 @@ public class CountersCount implements DynamicValue {
|
|||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
public class CreaturesOnBattlefieldCount implements DynamicValue {
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.getCardType().add(Constants.CardType.CREATURE);
|
||||
filter.setScopeCardType(Filter.ComparisonScope.Any);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility) {
|
||||
return game.getBattlefield().countAll(filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue clone() {
|
||||
return new CreaturesOnBattlefieldCount();
|
||||
}
|
||||
}
|
|
@ -19,4 +19,9 @@ public class ManacostVariableValue implements DynamicValue {
|
|||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,19 @@ import mage.game.Game;
|
|||
public class PermanentsOnBattlefieldCount implements DynamicValue {
|
||||
|
||||
private FilterPermanent filter;
|
||||
private Integer amount;
|
||||
|
||||
public PermanentsOnBattlefieldCount() {
|
||||
filter = new FilterPermanent();
|
||||
}
|
||||
|
||||
public PermanentsOnBattlefieldCount(FilterPermanent filter) {
|
||||
this(filter, 1);
|
||||
}
|
||||
|
||||
public PermanentsOnBattlefieldCount(FilterPermanent filter, Integer amount) {
|
||||
this.filter = filter;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public PermanentsOnBattlefieldCount(final PermanentsOnBattlefieldCount dynamicValue) {
|
||||
|
@ -37,6 +43,11 @@ public class PermanentsOnBattlefieldCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
return amount.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return " for each " + filter.getMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ public class StaticValue implements DynamicValue {
|
|||
public String toString() {
|
||||
return Integer.toString(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ public class CreateTokenEffect extends OneShotEffect<CreateTokenEffect> {
|
|||
sb.append("put ").append(amount);
|
||||
}
|
||||
sb.append(" ").append(token.getDescription()).append(" onto the battlefield");
|
||||
sb.append(amount.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ public class DamageTargetEffect extends OneShotEffect<DamageTargetEffect> {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{source} deals ").append(amount).append(" damage to target ");
|
||||
sb.append(source.getTargets().get(0).getTargetName());
|
||||
sb.append(amount.getMessage());
|
||||
if (!preventable)
|
||||
sb.append(". The damage can't be prevented");
|
||||
return sb.toString();
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.Constants.Outcome;
|
||||
|
@ -42,45 +41,49 @@ import mage.players.Player;
|
|||
*/
|
||||
public class DiscardTargetEffect extends OneShotEffect<DiscardTargetEffect> {
|
||||
|
||||
protected DynamicValue amount;
|
||||
protected DynamicValue amount;
|
||||
|
||||
public DiscardTargetEffect(DynamicValue amount) {
|
||||
super(Outcome.Discard);
|
||||
this.amount = amount;
|
||||
}
|
||||
public DiscardTargetEffect(DynamicValue amount) {
|
||||
super(Outcome.Discard);
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public DiscardTargetEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
}
|
||||
|
||||
public DiscardTargetEffect(final DiscardTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscardTargetEffect copy() {
|
||||
return new DiscardTargetEffect(this);
|
||||
}
|
||||
public DiscardTargetEffect(final DiscardTargetEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.discard(amount.calculate(game, source), source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public DiscardTargetEffect copy() {
|
||||
return new DiscardTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
int staticAmount = 0;
|
||||
try{
|
||||
staticAmount = Integer.parseInt(amount.toString());
|
||||
} catch (Exception e) {
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.discard(amount.calculate(game, source), source, game);
|
||||
return true;
|
||||
}
|
||||
return "Target player discards " + amount.toString() + " card" + (staticAmount == 1 ? "" : "s");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Ability source) {
|
||||
StringBuilder sb = new StringBuilder("Target player discards ");
|
||||
sb.append(amount).append(" card");
|
||||
try {
|
||||
if (Integer.parseInt(amount.toString()) > 1) {
|
||||
sb.append("s");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sb.append("s");
|
||||
}
|
||||
sb.append(amount.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,10 +77,14 @@ public class DrawCardTargetEffect extends OneShotEffect<DrawCardTargetEffect> {
|
|||
public String getText(Ability source) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Target player draws ").append(amount).append(" card");
|
||||
if (amount instanceof StaticValue && amount.calculate(null, null) == 1) {
|
||||
} else {
|
||||
try {
|
||||
if (Integer.parseInt(amount.toString()) > 1) {
|
||||
sb.append("s");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sb.append("s");
|
||||
}
|
||||
sb.append(amount.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class GainLifeEffect extends OneShotEffect<GainLifeEffect> {
|
|||
|
||||
@Override
|
||||
public String getDynamicText(Ability source) {
|
||||
return "you gain " + life.toString() + " life";
|
||||
return "you gain " + life.toString() + " life" + life.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,9 +93,10 @@ public class BoostEquippedEffect extends ContinuousEffectImpl<BoostEquippedEffec
|
|||
@Override
|
||||
public String getDynamicText(Ability source) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Equipped creatures gets ").append(power.toString()).append("/").append(toughness.toString());
|
||||
sb.append("Equipped creatures gets ").append(power).append("/").append(toughness);
|
||||
if (duration != Duration.WhileOnBattlefield)
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(power.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,12 @@ public class BoostSourceEffect extends ContinuousEffectImpl<BoostSourceEffect> {
|
|||
|
||||
@Override
|
||||
public String getDynamicText(Ability source) {
|
||||
return "{this} gets " + power.toString() + "/" + toughness.toString() + " " + duration.toString();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{this} gets ").append(power).append("/").append(toughness);
|
||||
if (duration != Duration.WhileOnBattlefield)
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(power.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,9 +82,11 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
|
|||
@Override
|
||||
public String getText(Ability source) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("target ").append(source.getTargets().get(0).getTargetName()).append(" gets ");
|
||||
sb.append(power.toString()).append("/").append(toughness.toString());
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append("Target ").append(source.getTargets().get(0).getTargetName()).append(" gets ");
|
||||
sb.append(power).append("/").append(toughness);
|
||||
if (duration != Duration.WhileOnBattlefield)
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(power.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,10 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl<SetPower
|
|||
public String getDynamicText(Ability source) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{this} ").append(" becomes ");
|
||||
sb.append(power).append("/").append(toughness).append(" ").append(duration.toString());
|
||||
sb.append(power).append("/").append(toughness);
|
||||
if (duration != Duration.WhileOnBattlefield)
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(power.getMessage());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
3
pom.xml
3
pom.xml
|
@ -31,8 +31,7 @@
|
|||
<module>Mage.Plugins</module>
|
||||
<module>Mage.Server.Plugins</module>
|
||||
<module>Mage.Server.Console</module>
|
||||
<module>Mage.Tests</module>
|
||||
</modules>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
|
Loading…
Reference in a new issue