mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Ugin, the Ineffable - improved +1 ability (one window for all exiled cards, card's id in lookup window);
This commit is contained in:
parent
1ff1833343
commit
085211035f
3 changed files with 28 additions and 14 deletions
|
@ -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);
|
||||
card.turnFaceDown(game, source.getControllerId());
|
||||
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)));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue