mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Some minor formattings.
This commit is contained in:
parent
41e24483f5
commit
943ff0d78d
7 changed files with 61 additions and 39 deletions
|
|
@ -61,7 +61,7 @@ public class TriggeredAbilities extends HashMap<String, TriggeredAbility> {
|
|||
public void checkTriggers(GameEvent event, Game game) {
|
||||
for (TriggeredAbility ability: this.values()) {
|
||||
// for effects like when leaves battlefield use ShortLKI to check if permanent was in the correct zone before (e.g. Oblivion Ring)
|
||||
if (ability.isInUseableZone(game, null, event.getType().equals(GameEvent.EventType.ZONE_CHANGE) ? true :false)) {
|
||||
if (ability.isInUseableZone(game, null, event.getType().equals(GameEvent.EventType.ZONE_CHANGE))) {
|
||||
MageObject object = null;
|
||||
if (!ability.getZone().equals(Zone.COMMAND) && !game.getState().getZone(ability.getSourceId()).equals(ability.getZone())) {
|
||||
object = game.getShortLivingLKI(ability.getSourceId(), ability.getZone());
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ import mage.constants.Layer;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
|
@ -107,6 +109,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean quotes = (ability instanceof SimpleActivatedAbility) || (ability instanceof TriggeredAbility);
|
||||
if (excludeSource) {
|
||||
sb.append("Other ");
|
||||
}
|
||||
|
|
@ -124,7 +127,13 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
sb.append(" gain ");
|
||||
}
|
||||
}
|
||||
if (quotes) {
|
||||
sb.append("\"");
|
||||
}
|
||||
sb.append(ability.getRule());
|
||||
if (quotes) {
|
||||
sb.append("\"");
|
||||
}
|
||||
if (duration.toString().length() > 0) {
|
||||
sb.append(" ").append(duration.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ package mage.abilities.effects.common.search;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -75,32 +76,39 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null)
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
if (player.searchLibrary(target, game)) {
|
||||
List<Card> cards = new ArrayList<Card>();
|
||||
}
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
List<Card> cards = new ArrayList<>();
|
||||
for (UUID cardId: (List<UUID>)target.getTargets()) {
|
||||
Card card = player.getLibrary().remove(cardId, game);
|
||||
if (card != null)
|
||||
Card card = controller.getLibrary().remove(cardId, game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
Cards foundCards = new CardsImpl();
|
||||
foundCards.addAll(cards);
|
||||
if (reveal) {
|
||||
player.revealCards("Revealed", foundCards, game);
|
||||
controller.revealCards(sourceObject.getLogName(), foundCards, game);
|
||||
}
|
||||
if (forceShuffle) {
|
||||
player.shuffleLibrary(game);
|
||||
controller.shuffleLibrary(game);
|
||||
}
|
||||
for (Card card: cards) {
|
||||
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
|
||||
if (cards.size() > 0) {
|
||||
game.informPlayers(controller.getName() + " moves " + cards.size() + " card" + (cards.size() == 1 ? " ":"s ") + "on top of his or her library");
|
||||
}
|
||||
for (Card card: cards) {
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// shuffle
|
||||
if (forceShuffle)
|
||||
player.shuffleLibrary(game);
|
||||
if (forceShuffle) {
|
||||
controller.shuffleLibrary(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue