mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 06:22:01 -08:00
* Added some cards (not finished because land replacement effects need still some work).
This commit is contained in:
parent
0115052b81
commit
ae4c07da9d
28 changed files with 1609 additions and 106 deletions
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package mage.abilities.common.delayed;
|
||||
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class AtTheBeginOfNextCleanupDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||
|
||||
public AtTheBeginOfNextCleanupDelayedTriggeredAbility(Effect effect) {
|
||||
this(effect, Duration.Custom);
|
||||
}
|
||||
|
||||
public AtTheBeginOfNextCleanupDelayedTriggeredAbility(Effect effect, Duration duration) {
|
||||
super(effect, duration);
|
||||
}
|
||||
|
||||
public AtTheBeginOfNextCleanupDelayedTriggeredAbility(AtTheBeginOfNextCleanupDelayedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AtTheBeginOfNextCleanupDelayedTriggeredAbility copy() {
|
||||
return new AtTheBeginOfNextCleanupDelayedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CLEANUP_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String text = modes.getText();
|
||||
if (!text.isEmpty()) {
|
||||
sb.append(Character.toUpperCase(text.charAt(0)));
|
||||
if (text.endsWith(".")) {
|
||||
sb.append(text.substring(1, text.length()-1));
|
||||
} else {
|
||||
sb.append(text.substring(1));
|
||||
}
|
||||
}
|
||||
return sb.append(" at the beginning of the next cleanup step.").toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* 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.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffectImpl {
|
||||
|
||||
private final Cost cost;
|
||||
|
||||
public EnterBattlefieldPayCostOrPutGraveyardEffect(Cost cost) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.PutCardInPlay);
|
||||
this.cost = cost;
|
||||
staticText = "If {this} would enter the battlefield, " + cost.getText() + " instead. If you do, put {this} onto the battlefield. If you don't, put it into its owner's graveyard";
|
||||
}
|
||||
|
||||
public EnterBattlefieldPayCostOrPutGraveyardEffect(final EnterBattlefieldPayCostOrPutGraveyardEffect effect) {
|
||||
super(effect);
|
||||
this.cost = effect.cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnterBattlefieldPayCostOrPutGraveyardEffect copy() {
|
||||
return new EnterBattlefieldPayCostOrPutGraveyardEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (player != null && cost != null && sourceObject != null){
|
||||
boolean replace = true;
|
||||
if (cost.canPay(source.getSourceId(), player.getId(), game)) {
|
||||
if (player.chooseUse(outcome, cost.getText() + "? (otherwise " + sourceObject.getLogName() + " is put into graveyard)", game)) {
|
||||
cost.clearPaid();
|
||||
replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false);
|
||||
}
|
||||
}
|
||||
if (replace) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null) {
|
||||
player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, game.getState().getZone(event.getTargetId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && source.getSourceId().equals(event.getTargetId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if(zEvent.getToZone().equals(Zone.BATTLEFIELD)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class LookLibraryMayPutToBottomEffect extends OneShotEffect {
|
||||
|
||||
public LookLibraryMayPutToBottomEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
this.staticText = "Look at the top card of your library. You may put that card on the bottom of your library.";
|
||||
}
|
||||
|
||||
public LookLibraryMayPutToBottomEffect(final LookLibraryMayPutToBottomEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.getLibrary().isEmptyDraw()) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
boolean toBottom = controller.chooseUse(outcome, "Put card on the bottom of your library?", game);
|
||||
return controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, !toBottom, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookLibraryMayPutToBottomEffect copy() {
|
||||
return new LookLibraryMayPutToBottomEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,12 +19,12 @@ public enum PhaseStep {
|
|||
END_TURN ("End Turn", 11),
|
||||
CLEANUP ("Cleanup", 12);
|
||||
|
||||
private String text;
|
||||
private final String text;
|
||||
|
||||
/**
|
||||
* Index is used for game state scoring system.
|
||||
*/
|
||||
private int index;
|
||||
private final int index;
|
||||
|
||||
PhaseStep(String text, int index) {
|
||||
this.text = text;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue