mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
commit
906d373e55
12 changed files with 51 additions and 50 deletions
|
@ -1838,7 +1838,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
.addGroup(gl_pnlShortCuts.createSequentialGroup()
|
||||
.addComponent(txtHoldPriority)
|
||||
.addComponent(txtSpellsCast)
|
||||
/* .addComponent(btnToggleMacro)*/
|
||||
/*.addComponent(btnToggleMacro)*/
|
||||
.addComponent(btnSwitchHands)
|
||||
.addComponent(btnCancelSkip)
|
||||
.addComponent(btnConcede)
|
||||
|
@ -1871,7 +1871,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(btnSkipToEndStepBeforeYourTurn)
|
||||
)
|
||||
.addGroup(gl_pnlShortCuts.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(btnToggleMacro)
|
||||
/*.addComponent(btnToggleMacro)*/
|
||||
.addComponent(txtHoldPriority)
|
||||
.addComponent(txtSpellsCast)
|
||||
.addComponent(btnSwitchHands)
|
||||
|
|
|
@ -26,7 +26,6 @@ import mage.client.constants.Constants;
|
|||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
import mage.remote.Connection;
|
||||
import mage.util.RandomUtil;
|
||||
import net.java.truevfs.access.TFile;
|
||||
import net.java.truevfs.access.TFileOutputStream;
|
||||
import net.java.truevfs.access.TVFS;
|
||||
|
@ -107,7 +106,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
p0.add(jLabel1);
|
||||
p0.add(Box.createVerticalStrut(5));
|
||||
ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[]{
|
||||
// "magiccards.info",
|
||||
// "magiccards.info",
|
||||
"wizards.com",
|
||||
"mythicspoiler.com",
|
||||
"tokens.mtg.onl", //"mtgimage.com (HQ)",
|
||||
|
@ -127,7 +126,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
jComboBox1.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
jComboBox1.addActionListener(e -> {
|
||||
JComboBox cb = (JComboBox) e.getSource();
|
||||
switch (cb.getSelectedIndex()) {
|
||||
switch (cb.getSelectedIndex() + 1) {
|
||||
case 0:
|
||||
cardImageSource = MagicCardsImageSource.instance;
|
||||
break;
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
*/
|
||||
package mage.server.game;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import mage.MageException;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
|
@ -61,12 +66,6 @@ import mage.view.ChatMessage.MessageColor;
|
|||
import mage.view.ChatMessage.MessageType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -271,8 +270,8 @@ public class GameController implements GameCallback {
|
|||
};
|
||||
|
||||
PriorityTimer timer = new PriorityTimer(count, delayMs, executeOnNoTimeLeft);
|
||||
timers.put(playerId, timer);
|
||||
timer.init(game.getId());
|
||||
timers.put(playerId, timer);
|
||||
return timer;
|
||||
}
|
||||
|
||||
|
@ -983,6 +982,7 @@ public class GameController implements GameCallback {
|
|||
|
||||
@FunctionalInterface
|
||||
interface Command {
|
||||
|
||||
void execute(UUID player);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.LoseCreatureTypeSourceEffect;
|
||||
import mage.abilities.keyword.IndestructibleAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
@ -49,7 +50,6 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class AthreosGodOfPassage extends CardImpl {
|
|||
}
|
||||
|
||||
public AthreosGodOfPassage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT,CardType.CREATURE},"{1}{W}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{1}{W}{B}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.GOD);
|
||||
|
||||
|
@ -118,7 +118,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
UUID creatureId = (UUID) this.getValue("creatureId");
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
|
||||
Card creature = game.getCard(creatureId);
|
||||
if (creature != null) {
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
boolean paid = false;
|
||||
|
@ -133,7 +133,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
|
|||
}
|
||||
if (opponent == null || !paid) {
|
||||
if (game.getState().getZone(creature.getId()) == Zone.GRAVEYARD) {
|
||||
controller.moveCards(game.getCard(creatureId), Zone.HAND, source, game);
|
||||
controller.moveCards(creature, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,8 +171,7 @@ class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
|
||||
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||
if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) {
|
||||
if (zEvent.getTarget() != null && filter.match(zEvent.getTarget(), sourceId, controllerId, game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setValue("creatureId", event.getTargetId());
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ import mage.target.common.TargetCreatureOrPlayer;
|
|||
public class BlazingTorch extends CardImpl {
|
||||
|
||||
public BlazingTorch(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
this.subtype.add("Equipment");
|
||||
|
||||
// Equipped creature can't be blocked by Vampires or Zombies. (!this is a static ability of the equipment)
|
||||
|
@ -95,7 +95,7 @@ class BlazingTorchEvasionEffect extends RestrictionEffect {
|
|||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
Permanent equipped = game.getPermanent(equipment.getAttachedTo());
|
||||
if (permanent.getId().equals(equipped.getId())) {
|
||||
if (equipped != null && permanent.getId().equals(equipped.getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.filter.predicate.mageobject.AnotherCardPredicate;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
/**
|
||||
|
@ -47,12 +47,13 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
public class CarrionThrash extends CardImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("another creature card from your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(new AnotherPredicate());
|
||||
filter.add(new AnotherCardPredicate());
|
||||
}
|
||||
|
||||
public CarrionThrash(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{R}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}{G}");
|
||||
this.subtype.add("Viashino");
|
||||
this.subtype.add("Warrior");
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class ChandraTorchOfDefianceEffect extends OneShotEffect {
|
|||
|
||||
public ChandraTorchOfDefianceEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "Exile the top card of your library. You may cast that card. If you don't, Chandra, Torch of Defiance deals 2 damage to each opponent";
|
||||
this.staticText = "Exile the top card of your library. You may cast that card. If you don't, {this} deals 2 damage to each opponent";
|
||||
}
|
||||
|
||||
public ChandraTorchOfDefianceEffect(final ChandraTorchOfDefianceEffect effect) {
|
||||
|
@ -111,17 +111,12 @@ class ChandraTorchOfDefianceEffect extends OneShotEffect {
|
|||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
|
||||
Library library = controller.getLibrary();
|
||||
Card card = library.removeFromTop(game);
|
||||
Card card = library.getFromTop(game);
|
||||
if (card != null) {
|
||||
boolean exiledCardWasCast = false;
|
||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
if (!card.getManaCost().isEmpty()) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Cast the card? (You still pay the costs)", source, game) && !card.isLand()) {
|
||||
// LinkedHashMap<UUID, ActivatedAbility> useableAbilities = controller.getUseableActivatedAbilities(card, Zone.EXILED, game);
|
||||
// for (ActivatedAbility ability : useableAbilities.values()) {
|
||||
//
|
||||
// }
|
||||
// controller.activateAbility(useableAbilities, game);
|
||||
exiledCardWasCast = controller.cast(card.getSpellAbility(), game, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class WildfireEternalCastEffect extends OneShotEffect {
|
|||
|
||||
public WildfireEternalCastEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = " you may cast an instant or sorcery card from your hand without paying its mana cost.";
|
||||
this.staticText = "you may cast an instant or sorcery card from your hand without paying its mana cost";
|
||||
}
|
||||
|
||||
public WildfireEternalCastEffect(final WildfireEternalCastEffect effect) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
@ -42,6 +43,7 @@ import mage.constants.TargetController;
|
|||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
@ -215,9 +217,13 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
if (this.controllerId != null && this.controllerId.equals(playerId)) {
|
||||
return true;
|
||||
} else {
|
||||
Card card = (Card) game.getObject(this.sourceId);
|
||||
if (card != null && game.getState().getZone(this.sourceId) != Zone.BATTLEFIELD) {
|
||||
return card.getOwnerId().equals(playerId);
|
||||
MageObject mageObject = game.getObject(this.sourceId);
|
||||
if (mageObject instanceof Emblem) {
|
||||
return ((Emblem) mageObject).getControllerId().equals(playerId);
|
||||
} else {
|
||||
if (game.getState().getZone(this.sourceId) != Zone.BATTLEFIELD) {
|
||||
return ((Card) mageObject).getOwnerId().equals(playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -69,6 +69,6 @@ public class CounterTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "counter target " + (mode.getTargets().get(0) != null ? mode.getTargets().get(0).getTargetName() : "spell");
|
||||
return "counter target " + (!mode.getTargets().isEmpty() ? mode.getTargets().get(0).getTargetName() : "spell");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,9 +109,8 @@ public class BecomesColorSourceEffect extends ContinuousEffectImpl {
|
|||
this.discard();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
throw new UnsupportedOperationException("No color set");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -282,20 +282,22 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
if (blocked) {
|
||||
for (UUID blockerId : blockerOrder) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
int lethalDamage;
|
||||
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
|
||||
lethalDamage = 1;
|
||||
} else {
|
||||
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
if (blocker != null) {
|
||||
int lethalDamage;
|
||||
if (attacker.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
|
||||
lethalDamage = 1;
|
||||
} else {
|
||||
lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
|
||||
}
|
||||
if (lethalDamage >= damage) {
|
||||
assigned.put(blockerId, damage);
|
||||
damage = 0;
|
||||
break;
|
||||
}
|
||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
||||
assigned.put(blockerId, damageAssigned);
|
||||
damage -= damageAssigned;
|
||||
}
|
||||
if (lethalDamage >= damage) {
|
||||
assigned.put(blockerId, damage);
|
||||
damage = 0;
|
||||
break;
|
||||
}
|
||||
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
|
||||
assigned.put(blockerId, damageAssigned);
|
||||
damage -= damageAssigned;
|
||||
}
|
||||
if (damage > 0 && hasTrample(attacker)) {
|
||||
defenderDamage(attacker, damage, game);
|
||||
|
|
Loading…
Reference in a new issue