mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
Merge origin/master
This commit is contained in:
commit
7ca60078a0
36 changed files with 740 additions and 489 deletions
|
|
@ -18,6 +18,7 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.TimingRule;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
|
|
@ -25,6 +26,7 @@ import java.util.UUID;
|
|||
public class TransmuteAbility extends SimpleActivatedAbility {
|
||||
public TransmuteAbility(String manaCost) {
|
||||
super(Zone.HAND, new TransmuteEffect(), new ManaCostsImpl(manaCost));
|
||||
this.setTiming(TimingRule.SORCERY);
|
||||
this.addCost(new DiscardSourceCost());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,23 +28,6 @@
|
|||
|
||||
package mage.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
|
|
@ -69,13 +52,7 @@ import mage.cards.CardsImpl;
|
|||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
|
@ -90,14 +67,8 @@ import mage.game.combat.Combat;
|
|||
import mage.game.command.CommandObject;
|
||||
import mage.game.command.Commander;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.Listener;
|
||||
import mage.game.events.PlayerQueryEvent;
|
||||
import mage.game.events.PlayerQueryEventSource;
|
||||
import mage.game.events.TableEvent;
|
||||
import mage.game.events.*;
|
||||
import mage.game.events.TableEvent.EventType;
|
||||
import mage.game.events.TableEventSource;
|
||||
import mage.game.permanent.Battlefield;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
|
|
@ -115,14 +86,14 @@ import mage.target.Target;
|
|||
import mage.target.TargetPermanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
import mage.watchers.common.MiracleWatcher;
|
||||
import mage.watchers.common.MorbidWatcher;
|
||||
import mage.watchers.common.PlayerDamagedBySourceWatcher;
|
||||
import mage.watchers.common.PlayerLostLifeWatcher;
|
||||
import mage.watchers.common.SoulbondWatcher;
|
||||
import mage.watchers.common.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class GameImpl implements Game, Serializable {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(GameImpl.class);
|
||||
|
|
@ -1859,7 +1830,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
|
||||
@Override
|
||||
public boolean canPlaySorcery(UUID playerId) {
|
||||
return getActivePlayerId().equals(playerId) && getStack().isEmpty() && isMainPhase();
|
||||
return isMainPhase() && getActivePlayerId().equals(playerId) && getStack().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,21 +28,9 @@
|
|||
|
||||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageItem;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.Modes;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.costs.AlternativeSourceCosts;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
|
|
@ -69,6 +57,9 @@ import mage.target.TargetCard;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.util.Copyable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -340,6 +331,8 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
List<Ability> getPlayable(Game game, boolean hidden);
|
||||
List<Ability> getPlayableOptions(Ability ability, Game game);
|
||||
|
||||
Set<UUID> getPlayableInHand(Game game);
|
||||
|
||||
void addCounters(Counter counter, Game game);
|
||||
List<UUID> getAttachments();
|
||||
boolean addAttachment(UUID permanentId, Game game);
|
||||
|
|
|
|||
|
|
@ -28,31 +28,9 @@
|
|||
|
||||
package mage.players;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.PlayLandAbility;
|
||||
import mage.abilities.SpecialAction;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.*;
|
||||
import mage.abilities.common.PassAbility;
|
||||
import mage.abilities.common.delayed.AtTheEndOfTurnStepPostDelayedTriggeredAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
|
|
@ -62,12 +40,7 @@ import mage.abilities.costs.AlternativeSourceCosts;
|
|||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.RestrictionUntapNotMoreThanEffect;
|
||||
import mage.abilities.effects.common.LoseControlOnOtherPlayersControllerEffect;
|
||||
import mage.abilities.keyword.FlashbackAbility;
|
||||
import mage.abilities.keyword.HexproofAbility;
|
||||
import mage.abilities.keyword.InfectAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.abilities.keyword.*;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.actions.MageDrawAction;
|
||||
|
|
@ -76,14 +49,7 @@ import mage.cards.Cards;
|
|||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.counters.Counters;
|
||||
|
|
@ -116,6 +82,10 @@ import mage.target.common.TargetDiscard;
|
|||
import mage.watchers.common.BloodthirstWatcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class PlayerImpl implements Player, Serializable {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(PlayerImpl.class);
|
||||
|
|
@ -1544,7 +1514,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public void idleTimeout(Game game) {
|
||||
game.informPlayers(new StringBuilder(getName()).append(" has run out of time. Loosing the Match.").toString());
|
||||
game.informPlayers(new StringBuilder(getName()).append(" was idle for too long. Loosing the Match.").toString());
|
||||
quit = true;
|
||||
idleTimeout = true;
|
||||
this.concede(game);
|
||||
|
|
@ -1973,6 +1943,25 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return playable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getPlayableInHand(Game game) {
|
||||
Set<UUID> playable = new HashSet<>();
|
||||
|
||||
ManaOptions available = getManaAvailable(game);
|
||||
available.addMana(manaPool.getMana());
|
||||
|
||||
for (Card card: hand.getCards(game)) {
|
||||
for (ActivatedAbility ability: card.getAbilities().getPlayableAbilities(Zone.HAND)) {
|
||||
if (canPlay(ability, available, game)) {
|
||||
playable.add(card.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return playable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used for AIs
|
||||
*
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ public abstract class TargetImpl implements Target {
|
|||
@Override
|
||||
public boolean isLegal(Ability source, Game game) {
|
||||
//20101001 - 608.2b
|
||||
Set <UUID> illegalTargets = new HashSet<UUID>();
|
||||
Set <UUID> illegalTargets = new HashSet<>();
|
||||
int replacedTargets = 0;
|
||||
for (UUID targetId: targets.keySet()) {
|
||||
Card card = game.getCard(targetId);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,12 @@ public class TargetCreatureOrPlayerAmount extends TargetAmount {
|
|||
protected FilterCreatureOrPlayer filter;
|
||||
|
||||
public TargetCreatureOrPlayerAmount(int amount) {
|
||||
// 107.1c If a rule or ability instructs a player to choose “any number,” that player may choose
|
||||
// any positive number or zero, unless something (such as damage or counters) is being divided
|
||||
// or distributed among “any number” of players and/or objects. In that case, a nonzero number
|
||||
// of players and/or objects must be chosen if possible.
|
||||
this(new StaticValue(amount));
|
||||
this.minNumberOfTargets = 1;
|
||||
}
|
||||
|
||||
public TargetCreatureOrPlayerAmount(DynamicValue amount) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue