mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
[JOU] Added 6 cards. Fixed some bugs for JOU cards.
This commit is contained in:
parent
4e53ff73ea
commit
6d89011e47
16 changed files with 891 additions and 47 deletions
|
|
@ -64,13 +64,13 @@ public class PutTopCardOfLibraryIntoGraveControllerEffect extends OneShotEffect<
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
int cardsCount = Math.min(numberCards, player.getLibrary().size());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int cardsCount = Math.min(numberCards, controller.getLibrary().size());
|
||||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, true);
|
||||
controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
|
|||
}
|
||||
|
||||
public boolean applySearchAndExile(Game game, Ability source, String cardName, UUID targetPlayerId) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (cardName != null && player != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (cardName != null && controller != null) {
|
||||
Player targetPlayer = game.getPlayer(targetPlayerId);
|
||||
if (targetPlayer != null) {
|
||||
FilterCard filter = new FilterCard("card named " + cardName);
|
||||
|
|
@ -91,13 +91,13 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
|
|||
if (cardsCount > 0) {
|
||||
filter.setMessage("card named " + cardName + " in the graveyard of " + targetPlayer.getName());
|
||||
TargetCardInGraveyard target = new TargetCardInGraveyard((graveyardExileOptional ? 0 :cardsCount), cardsCount, filter);
|
||||
if (player.choose(Outcome.Exile, targetPlayer.getGraveyard(), target, game)) {
|
||||
if (controller.choose(Outcome.Exile, targetPlayer.getGraveyard(), target, game)) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
for (UUID targetId : targets) {
|
||||
Card targetCard = targetPlayer.getGraveyard().get(targetId, game);
|
||||
if (targetCard != null) {
|
||||
targetPlayer.getGraveyard().remove(targetCard);
|
||||
targetCard.moveToZone(Zone.EXILED, source.getId(), game, false);
|
||||
controller.moveCardToExileWithInfo(targetCard, null, null, source.getSourceId(), game, Zone.GRAVEYARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -108,19 +108,19 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
|
|||
if (cardsCount > 0) {
|
||||
filter.setMessage("card named " + cardName + " in the hand of " + targetPlayer.getName());
|
||||
TargetCardInHand target = new TargetCardInHand(0, cardsCount, filter);
|
||||
if (player.choose(Outcome.Exile, targetPlayer.getHand(), target, game)) {
|
||||
if (controller.choose(Outcome.Exile, targetPlayer.getHand(), target, game)) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
for (UUID targetId : targets) {
|
||||
Card targetCard = targetPlayer.getHand().get(targetId, game);
|
||||
if (targetCard != null) {
|
||||
targetPlayer.getHand().remove(targetCard);
|
||||
targetCard.moveToZone(Zone.EXILED, source.getId(), game, false);
|
||||
controller.moveCardToExileWithInfo(targetCard, null, null, source.getSourceId(), game, Zone.HAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (targetPlayer.getHand().size() > 0) {
|
||||
player.lookAtCards(targetPlayer.getName() + " hand", targetPlayer.getHand(), game);
|
||||
controller.lookAtCards(targetPlayer.getName() + " hand", targetPlayer.getHand(), game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,17 +131,17 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
|
|||
if (cardsCount > 0) {
|
||||
filter.setMessage("card named " + cardName + " in the library of " + targetPlayer.getName());
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, cardsCount, filter);
|
||||
if (player.choose(Outcome.Exile, cardsInLibrary, target, game)) {
|
||||
if (controller.choose(Outcome.Exile, cardsInLibrary, target, game)) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
for (UUID targetId : targets) {
|
||||
Card targetCard = targetPlayer.getLibrary().remove(targetId, game);
|
||||
if (targetCard != null) {
|
||||
targetCard.moveToZone(Zone.EXILED, source.getId(), game, false);
|
||||
controller.moveCardToExileWithInfo(targetCard, null, null, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.lookAtCards(targetPlayer.getName() + " library", cardsInLibrary, game);
|
||||
controller.lookAtCards(targetPlayer.getName() + " library", cardsInLibrary, game);
|
||||
}
|
||||
|
||||
targetPlayer.shuffleLibrary(game);
|
||||
|
|
|
|||
|
|
@ -2132,7 +2132,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
game.informPlayers(new StringBuilder(this.getName())
|
||||
.append(" puts ").append(card.getName()).append(" ")
|
||||
.append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" "):"")
|
||||
.append("into his or her hand").toString());
|
||||
.append(card.getOwnerId().equals(this.getId()) ? "into his or her hand":"into its owner's hand").toString());
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ public class TargetCardInYourGraveyard extends TargetCard<TargetCardInYourGravey
|
|||
this(1, 1, new FilterCard("card from your graveyard"));
|
||||
}
|
||||
|
||||
public TargetCardInYourGraveyard(boolean required) {
|
||||
this();
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetCardInYourGraveyard(FilterCard filter, boolean required) {
|
||||
this(filter);
|
||||
this.setRequired(required);
|
||||
|
|
|
|||
72
Mage/src/mage/target/common/TargetEnchantmentPermanent.java
Normal file
72
Mage/src/mage/target/common/TargetEnchantmentPermanent.java
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.target.common;
|
||||
|
||||
import mage.filter.common.FilterEnchantmentPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public class TargetEnchantmentPermanent<T extends TargetEnchantmentPermanent<T>> extends TargetPermanent<TargetEnchantmentPermanent<T>> {
|
||||
|
||||
public TargetEnchantmentPermanent(boolean required) {
|
||||
this();
|
||||
this.setRequired(required);
|
||||
}
|
||||
|
||||
public TargetEnchantmentPermanent() {
|
||||
this(1, 1, new FilterEnchantmentPermanent(), false);
|
||||
}
|
||||
|
||||
public TargetEnchantmentPermanent(FilterEnchantmentPermanent filter) {
|
||||
this(1, 1, filter, false);
|
||||
}
|
||||
|
||||
public TargetEnchantmentPermanent(int numTargets) {
|
||||
this(numTargets, numTargets, new FilterEnchantmentPermanent(), false);
|
||||
}
|
||||
|
||||
public TargetEnchantmentPermanent(int minNumTargets, int maxNumTargets, FilterEnchantmentPermanent filter, boolean notTarget) {
|
||||
super(minNumTargets, maxNumTargets, filter, notTarget);
|
||||
this.targetName = filter.getMessage();
|
||||
}
|
||||
|
||||
public TargetEnchantmentPermanent(final TargetEnchantmentPermanent target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetEnchantmentPermanent copy() {
|
||||
return new TargetEnchantmentPermanent(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue