mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 05:52:06 -08:00
Refactor: replaced sourceId by source and introduced source param in some methods (part 2);
This commit is contained in:
parent
db239a1055
commit
35f5a8257b
50 changed files with 189 additions and 118 deletions
|
|
@ -47,7 +47,7 @@ public class RollDiceEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
controller.rollDice(game, numSides);
|
||||
controller.rollDice(source, game, numSides);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class RollPlanarDieEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
PlanarDieRoll planarRoll = controller.rollPlanarDie(game);
|
||||
PlanarDieRoll planarRoll = controller.rollPlanarDie(source, game);
|
||||
if (planarRoll == PlanarDieRoll.CHAOS_ROLL && chaosEffects != null && chaosTargets != null) {
|
||||
for (int i = 0; i < chaosTargets.size(); i++) {
|
||||
Target target = chaosTargets.get(i);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.mana;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2220,7 +2220,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
}
|
||||
}
|
||||
//20091005 - 704.5q If a creature is attached to an object or player, it becomes unattached and remains on the battlefield.
|
||||
// Similarly, if a permanent thats neither an Aura, an Equipment, nor a Fortification is attached to an object or player,
|
||||
// Similarly, if a permanent that's neither an Aura, an Equipment, nor a Fortification is attached to an object or player,
|
||||
// it becomes unattached and remains on the battlefield.
|
||||
if (!perm.getAttachments().isEmpty()) {
|
||||
for (UUID attachmentId : perm.getAttachments()) {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,11 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
if (!game.isSimulation()) {
|
||||
Player player = game.getPlayer(attackingPlayerId);
|
||||
if (player != null) {
|
||||
game.informPlayers(player.getLogName() + " attacks with " + groups.size() + (groups.size() == 1 ? " creature" : " creatures"));
|
||||
if (groups.size() > 0) {
|
||||
game.informPlayers(player.getLogName() + " attacks with " + groups.size() + (groups.size() == 1 ? " creature" : " creatures"));
|
||||
} else {
|
||||
game.informPlayers(player.getLogName() + " skip attack");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -615,7 +619,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
* Add info about attacker blocked by blocker to the game log
|
||||
*/
|
||||
private void logBlockerInfo(Player defender, Game game) {
|
||||
boolean shownDefendingPlayer = game.getPlayers().size() < 3; // only two players no ned to sow the attacked player
|
||||
boolean shownDefendingPlayer = game.getPlayers().size() < 3; // only two players no need to saw the attacked player
|
||||
for (CombatGroup group : game.getCombat().getGroups()) {
|
||||
if (group.defendingPlayerId.equals(defender.getId())) {
|
||||
if (!shownDefendingPlayer) {
|
||||
|
|
|
|||
|
|
@ -1153,9 +1153,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
logName = this.getLogName();
|
||||
}
|
||||
if (this.isCreature()) {
|
||||
game.informPlayers(logName + " died");
|
||||
game.informPlayers(logName + " died" + CardUtil.getSourceLogName(game, " by ", source, "", ""));
|
||||
} else {
|
||||
game.informPlayers(logName + " was destroyed");
|
||||
game.informPlayers(logName + " was destroyed" + CardUtil.getSourceLogName(game, " by ", source, "", ""));
|
||||
}
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DESTROYED_PERMANENT, objectId, source, controllerId));
|
||||
|
|
@ -1174,7 +1174,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
moveToZone(Zone.GRAVEYARD, source, game, false);
|
||||
Player player = game.getPlayer(getControllerId());
|
||||
if (player != null && !game.isSimulation()) {
|
||||
game.informPlayers(player.getLogName() + " sacrificed " + this.getLogName());
|
||||
game.informPlayers(player.getLogName() + " sacrificed " + this.getLogName() + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.SACRIFICED_PERMANENT, objectId, source, controllerId));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -86,8 +86,11 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
* @param game
|
||||
* @param source can be null for default game events like mana burn
|
||||
* @param atCombat was the source combat damage
|
||||
* @param attackerId id of the attacker for combat events (can be null)
|
||||
* @return
|
||||
*/
|
||||
int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId);
|
||||
|
||||
int loseLife(int amount, Game game, Ability source, boolean atCombat);
|
||||
|
||||
/**
|
||||
|
|
@ -441,15 +444,15 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean flipCoin(Ability source, Game game, boolean winnable, List<UUID> appliedEffects);
|
||||
|
||||
int rollDice(Game game, int numSides);
|
||||
int rollDice(Ability source, Game game, int numSides);
|
||||
|
||||
int rollDice(Game game, List<UUID> appliedEffects, int numSides);
|
||||
int rollDice(Ability source, Game game, List<UUID> appliedEffects, int numSides);
|
||||
|
||||
PlanarDieRoll rollPlanarDie(Game game);
|
||||
PlanarDieRoll rollPlanarDie(Ability source, Game game);
|
||||
|
||||
PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects);
|
||||
PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects);
|
||||
|
||||
PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides);
|
||||
PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides);
|
||||
|
||||
Card discardOne(boolean random, boolean payForCost, Ability source, Game game);
|
||||
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
// write info to game log first so game log infos from triggered or replacement effects follow in the game log
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(getLogName() + " discards " + card.getLogName());
|
||||
game.informPlayers(getLogName() + " discards " + card.getLogName() + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
/* If a card is discarded while Rest in Peace is on the battlefield, abilities that function
|
||||
* when a card is discarded (such as madness) still work, even though that card never reaches
|
||||
|
|
@ -962,9 +962,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
game.informPlayers(getLogName() + " shuffels " + CardUtil.numberToText(cards.size(), "a")
|
||||
game.informPlayers(getLogName() + " shuffles " + CardUtil.numberToText(cards.size(), "a")
|
||||
+ " card" + (cards.size() == 1 ? "" : "s")
|
||||
+ " into their library.");
|
||||
+ " into their library" + CardUtil.getSourceLogName(game, source));
|
||||
boolean status = moveCards(cards, Zone.LIBRARY, source, game);
|
||||
shuffleLibrary(source, game);
|
||||
return status;
|
||||
|
|
@ -995,7 +995,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
+ getLogName()
|
||||
+ "'s library "
|
||||
+ CardUtil.numberToOrdinalText(xFromTheTop)
|
||||
+ " from the top");
|
||||
+ " from the top" + CardUtil.getSourceLogName(game, source, cardInLib.getId()));
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
|
|
@ -1501,7 +1501,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if ((ability.isUsesStack()
|
||||
|| ability.getRuleVisible())
|
||||
&& !game.isSimulation()) {
|
||||
game.informPlayers(ability.getGameLogMessage(game));
|
||||
game.informPlayers(getLogName() + ability.getGameLogMessage(game));
|
||||
}
|
||||
if (!ability.isUsesStack()) {
|
||||
ability.resolve(game);
|
||||
|
|
@ -1648,7 +1648,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SHUFFLE_LIBRARY, playerId, source, playerId))) {
|
||||
this.library.shuffle();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(getLogName() + "'s library is shuffled");
|
||||
game.informPlayers(getLogName() + "'s library is shuffled" + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, source, playerId));
|
||||
}
|
||||
|
|
@ -1694,6 +1694,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
sb.append(CardUtil.getSourceLogName(game, source));
|
||||
game.informPlayers(sb.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -1991,7 +1992,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int loseLife(int amount, Game game, Ability source, boolean atCombat) {
|
||||
public int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId) {
|
||||
if (!canLoseLife || !this.isInGame()) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2000,7 +2001,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (!game.replaceEvent(event)) {
|
||||
this.life = CardUtil.subtractWithOverflowCheck(this.life, event.getAmount());
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life");
|
||||
UUID needId = attackerId;
|
||||
if (needId == null) {
|
||||
needId = source == null ? null : source.getSourceId();
|
||||
}
|
||||
game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life"
|
||||
+ (atCombat ? " at combat" : "") + CardUtil.getSourceLogName(game, " from ", needId, "", ""));
|
||||
}
|
||||
if (amount > 0) {
|
||||
game.fireEvent(new GameEvent(GameEvent.EventType.LOST_LIFE,
|
||||
|
|
@ -2011,6 +2017,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int loseLife(int amount, Game game, Ability source, boolean atCombat) {
|
||||
return loseLife(amount, game, source, atCombat, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCanGainLife() {
|
||||
return canGainLife;
|
||||
|
|
@ -2034,7 +2045,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// this.life += event.getAmount();
|
||||
this.life = CardUtil.addWithOverflowCheck(this.life, event.getAmount());
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(this.getLogName() + " gains " + event.getAmount() + " life");
|
||||
game.informPlayers(this.getLogName() + " gains " + event.getAmount() + " life" + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.GAINED_LIFE,
|
||||
playerId, source, playerId, event.getAmount()));
|
||||
|
|
@ -2101,7 +2112,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
GameEvent damageToLifeLossEvent = new GameEvent(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS,
|
||||
playerId, source, playerId, actualDamage, combatDamage);
|
||||
if (!game.replaceEvent(damageToLifeLossEvent)) {
|
||||
this.loseLife(damageToLifeLossEvent.getAmount(), game, source, combatDamage);
|
||||
this.loseLife(damageToLifeLossEvent.getAmount(), game, source, combatDamage, attackerId);
|
||||
}
|
||||
}
|
||||
if (sourceAbilities != null && sourceAbilities.containsKey(LifelinkAbility.getInstance().getId())) {
|
||||
|
|
@ -2128,7 +2139,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
game.informPlayers(damage + " damage "
|
||||
+ (sourceObject == null ? "" : "from " + sourceObject.getLogName())
|
||||
+ " to " + getLogName()
|
||||
+ (damage > 1 ? " were" : "was") + " prevented because of protection.");
|
||||
+ (damage > 1 ? " were" : "was") + " prevented because of protection");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -2592,7 +2603,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(searchInfo);
|
||||
game.informPlayers(searchInfo + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
|
||||
// https://www.reddit.com/r/magicTCG/comments/jj8gh9/opposition_agent_and_panglacial_wurm_interaction/
|
||||
|
|
@ -2648,7 +2659,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// END SEARCH
|
||||
if (takeControl) {
|
||||
CardUtil.takeControlUnderPlayerEnd(game, searchingController, searchingPlayer);
|
||||
game.informPlayers("Control of " + searchingPlayer.getLogName() + " is back");
|
||||
game.informPlayers("Control of " + searchingPlayer.getLogName() + " is back" + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
|
||||
LibrarySearchedEvent searchedEvent = new LibrarySearchedEvent(targetPlayer.getId(), source, searchingPlayer.getId(), target);
|
||||
|
|
@ -2745,7 +2756,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
FlipCoinEvent event = new FlipCoinEvent(playerId, source, result, chosen, winnable);
|
||||
event.addAppliedEffects(appliedEffects);
|
||||
game.replaceEvent(event);
|
||||
game.informPlayers(getLogName() + " flipped " + CardUtil.booleanToFlipName(event.getResult()));
|
||||
game.informPlayers(getLogName() + " flipped " + CardUtil.booleanToFlipName(event.getResult())
|
||||
+ CardUtil.getSourceLogName(game, source));
|
||||
if (event.getFlipCount() > 1) {
|
||||
boolean canChooseHeads = event.getResult();
|
||||
boolean canChooseTails = !event.getResult();
|
||||
|
|
@ -2766,7 +2778,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
game.informPlayers(getLogName() + " chose to keep " + CardUtil.booleanToFlipName(event.getResult()));
|
||||
}
|
||||
if (event.isWinnable()) {
|
||||
game.informPlayers(getLogName() + " " + (event.getResult() == event.getChosen() ? "won" : "lost") + " the flip");
|
||||
game.informPlayers(getLogName() + " " + (event.getResult() == event.getChosen() ? "won" : "lost") + " the flip"
|
||||
+ CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
event.setAppliedEffects(appliedEffects);
|
||||
game.fireEvent(event.createFlippedEvent());
|
||||
|
|
@ -2777,31 +2790,30 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int rollDice(Game game, int numSides) {
|
||||
return this.rollDice(game, null, numSides);
|
||||
public int rollDice(Ability source, Game game, int numSides) {
|
||||
return this.rollDice(source, game, null, numSides);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param source
|
||||
* @param game
|
||||
* @param appliedEffects
|
||||
* @param numSides Number of sides the dice has
|
||||
* @return the number that the player rolled
|
||||
*/
|
||||
@Override
|
||||
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
|
||||
public int rollDice(Ability source, Game game, List<UUID> appliedEffects, int numSides) {
|
||||
int result = RandomUtil.nextInt(numSides) + 1;
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("[Roll a die] " + getLogName() + " rolled a "
|
||||
+ result + " on a " + numSides + " sided die");
|
||||
+ result + " on a " + numSides + " sided die" + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
GameEvent event = new GameEvent(GameEvent.EventType.ROLL_DICE, playerId,
|
||||
null, playerId, result, true);
|
||||
GameEvent event = new GameEvent(GameEvent.EventType.ROLL_DICE, playerId, source, playerId, result, true);
|
||||
event.setAppliedEffects(appliedEffects);
|
||||
event.setAmount(result);
|
||||
event.setData(numSides + "");
|
||||
if (!game.replaceEvent(event)) {
|
||||
GameEvent ge = new GameEvent(GameEvent.EventType.DICE_ROLLED, playerId, null,
|
||||
playerId, event.getAmount(), event.getFlag());
|
||||
GameEvent ge = new GameEvent(GameEvent.EventType.DICE_ROLLED, playerId, source, playerId, event.getAmount(), event.getFlag());
|
||||
ge.setData(numSides + "");
|
||||
game.fireEvent(ge);
|
||||
}
|
||||
|
|
@ -2809,13 +2821,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game) {
|
||||
return this.rollPlanarDie(game, null);
|
||||
public PlanarDieRoll rollPlanarDie(Ability source, Game game) {
|
||||
return this.rollPlanarDie(source, game, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
|
||||
return rollPlanarDie(game, appliedEffects, 2, 2);
|
||||
public PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects) {
|
||||
return rollPlanarDie(source, game, appliedEffects, 2, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2829,7 +2841,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* or NilRoll
|
||||
*/
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
public PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
int result = RandomUtil.nextInt(9) + 1;
|
||||
PlanarDieRoll roll = PlanarDieRoll.NIL_ROLL;
|
||||
if (numberChaosSides + numberPlanarSides > 9) {
|
||||
|
|
@ -2843,15 +2855,15 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("[Roll the planar die] " + getLogName()
|
||||
+ " rolled a " + roll + " on the planar die");
|
||||
+ " rolled a " + roll + " on the planar die" + CardUtil.getSourceLogName(game, source));
|
||||
}
|
||||
GameEvent event = new GameEvent(GameEvent.EventType.ROLL_PLANAR_DIE,
|
||||
playerId, null, playerId, result, true);
|
||||
playerId, source, playerId, result, true);
|
||||
event.setAppliedEffects(appliedEffects);
|
||||
event.setData(roll + "");
|
||||
if (!game.replaceEvent(event)) {
|
||||
GameEvent ge = new GameEvent(GameEvent.EventType.PLANAR_DIE_ROLLED,
|
||||
playerId, null, playerId, event.getAmount(), event.getFlag());
|
||||
playerId, source, playerId, event.getAmount(), event.getFlag());
|
||||
ge.setData(roll + "");
|
||||
game.fireEvent(ge);
|
||||
}
|
||||
|
|
@ -4078,7 +4090,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (eventPlayer != null && fromZone != null) {
|
||||
game.informPlayers(eventPlayer.getLogName() + " puts "
|
||||
+ (info.faceDown ? "a card face down " : permanent.getLogName()) + " from "
|
||||
+ fromZone.toString().toLowerCase(Locale.ENGLISH) + " onto the Battlefield");
|
||||
+ fromZone.toString().toLowerCase(Locale.ENGLISH) + " onto the Battlefield"
|
||||
+ CardUtil.getSourceLogName(game, source, permanent.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4180,7 +4193,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
game.informPlayers(getLogName() + " puts "
|
||||
+ (withName ? card.getLogName() : (card.isFaceDown(game) ? "a face down card" : "a card"))
|
||||
+ " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + ' '
|
||||
+ (card.isOwnedBy(this.getId()) ? "into their hand" : "into its owner's hand")
|
||||
+ (card.isOwnedBy(this.getId()) ? "into their hand" : "into its owner's hand"
|
||||
+ CardUtil.getSourceLogName(game, source, card.getId()))
|
||||
);
|
||||
}
|
||||
result = true;
|
||||
|
|
@ -4275,6 +4289,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
} else {
|
||||
sb.append("it into its owner's graveyard");
|
||||
}
|
||||
sb.append(CardUtil.getSourceLogName(game, source, card.getId()));
|
||||
game.informPlayers(sb.toString());
|
||||
}
|
||||
result = true;
|
||||
|
|
@ -4307,6 +4322,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
sb.append(" of ").append(player.getLogName()).append("'s library");
|
||||
}
|
||||
}
|
||||
sb.append(CardUtil.getSourceLogName(game, source, card.getId()));
|
||||
game.informPlayers(sb.toString());
|
||||
}
|
||||
result = true;
|
||||
|
|
@ -4338,6 +4354,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
sb.append(" to ").append(player.getLogName()).append("'s command zone");
|
||||
}
|
||||
}
|
||||
sb.append(CardUtil.getSourceLogName(game, source, card.getId()));
|
||||
game.informPlayers(sb.toString());
|
||||
}
|
||||
result = true;
|
||||
|
|
@ -4370,7 +4387,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
game.informPlayers(this.getLogName() + " moves " + (withName ? card.getLogName()
|
||||
+ (card.isCopy() ? " (Copy)" : "") : "a card face down") + ' '
|
||||
+ (fromZone != null ? "from " + fromZone.toString().toLowerCase(Locale.ENGLISH)
|
||||
+ ' ' : "") + "to the exile zone");
|
||||
+ ' ' : "") + "to the exile zone" + CardUtil.getSourceLogName(game, source, card.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4505,7 +4522,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (game.replaceEvent(event)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(getLogName() + " scries " + event.getAmount());
|
||||
game.informPlayers(getLogName() + " scries " + event.getAmount() + CardUtil.getSourceLogName(game, source));
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(getLibrary().getTopCards(game, event.getAmount()));
|
||||
if (!cards.isEmpty()) {
|
||||
|
|
@ -4527,7 +4544,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (game.replaceEvent(event)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(getLogName() + " surveils " + event.getAmount());
|
||||
game.informPlayers(getLogName() + " surveils " + event.getAmount() + CardUtil.getSourceLogName(game, source));
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(getLibrary().getTopCards(game, event.getAmount()));
|
||||
if (!cards.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,9 @@ import mage.abilities.Abilities;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.*;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.asthought.CanPlayCardControllerEffect;
|
||||
import mage.abilities.effects.common.asthought.YouMaySpendManaAsAnyColorToCastTargetEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
|
|
@ -1017,6 +1015,7 @@ public final class CardUtil {
|
|||
|
||||
/**
|
||||
* Pay life in effects
|
||||
*
|
||||
* @param lifeToPay
|
||||
* @param player
|
||||
* @param source
|
||||
|
|
@ -1046,4 +1045,34 @@ public final class CardUtil {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates source log name to insert into log messages
|
||||
*
|
||||
* @param game
|
||||
* @param sourceId
|
||||
* @param namePrefix if source object exists then that will be added before name
|
||||
* @param namePostfix if source object exists then that will be added after name
|
||||
* @param nonFoundText if source object not exists then it will be used
|
||||
* @return
|
||||
*/
|
||||
public static String getSourceLogName(Game game, String namePrefix, UUID sourceId, String namePostfix, String nonFoundText) {
|
||||
MageObject sourceObject = game.getObject(sourceId);
|
||||
return (sourceObject == null ? nonFoundText : namePrefix + sourceObject.getLogName() + namePostfix);
|
||||
}
|
||||
|
||||
public static String getSourceLogName(Game game, String namePrefix, Ability source, String namePostfix, String nonFoundText) {
|
||||
return getSourceLogName(game, namePrefix, source == null ? null : source.getSourceId(), namePostfix, nonFoundText);
|
||||
}
|
||||
|
||||
public static String getSourceLogName(Game game, Ability source) {
|
||||
return CardUtil.getSourceLogName(game, " (source: ", source, ")", "");
|
||||
}
|
||||
|
||||
public static String getSourceLogName(Game game, Ability source, UUID ignoreSourceId) {
|
||||
if (ignoreSourceId != null && source != null && ignoreSourceId.equals(source.getSourceId())) {
|
||||
return "";
|
||||
}
|
||||
return CardUtil.getSourceLogName(game, " (source: ", source, ")", "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue