mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
[C13] Added 7 cards.
This commit is contained in:
parent
7391b23ebb
commit
a85f4a9848
20 changed files with 1120 additions and 23 deletions
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class GainLifeControllerTriggeredAbility extends TriggeredAbilityImpl<GainLifeControllerTriggeredAbility> {
|
||||
|
||||
public GainLifeControllerTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public GainLifeControllerTriggeredAbility(final GainLifeControllerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GainLifeControllerTriggeredAbility copy() {
|
||||
return new GainLifeControllerTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.GAINED_LIFE && event.getPlayerId().equals(this.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("Whenever you gain life, ").append(super.getRule()).toString() ;
|
||||
}
|
||||
|
||||
}
|
||||
114
Mage/src/mage/abilities/costs/common/PayVariableLifeCost.java
Normal file
114
Mage/src/mage/abilities/costs/common/PayVariableLifeCost.java
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* 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.costs.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class PayVariableLifeCost extends CostImpl<PayVariableLifeCost> implements VariableCost {
|
||||
|
||||
protected int amountPaid = 0;
|
||||
|
||||
public PayVariableLifeCost() {
|
||||
this.text = "pay X life";
|
||||
}
|
||||
|
||||
public PayVariableLifeCost(final PayVariableLifeCost cost) {
|
||||
super(cost);
|
||||
this.amountPaid = cost.amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
return controller != null && controller.getLife() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
this.amountPaid = controller.getAmount(0, controller.getLife(), "Choose X", game);
|
||||
if (this.amountPaid> 0) {
|
||||
controller.loseLife(amountPaid, game);
|
||||
}
|
||||
this.paid = true;
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPaid() {
|
||||
paid = false;
|
||||
amountPaid = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmount() {
|
||||
return amountPaid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAmount(int amount) {
|
||||
amountPaid = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Supported
|
||||
* @param filter
|
||||
*/
|
||||
@Override
|
||||
public void setFilter(FilterMana filter) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public FilterMana getFilter() {
|
||||
return new FilterMana();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayVariableLifeCost copy() {
|
||||
return new PayVariableLifeCost(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,8 +11,8 @@ import mage.players.Player;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
public class DoIfCostPaid extends OneShotEffect<DoIfCostPaid> {
|
||||
private OneShotEffect executingEffect;
|
||||
private Cost cost;
|
||||
private final OneShotEffect executingEffect;
|
||||
private final Cost cost;
|
||||
|
||||
public DoIfCostPaid(OneShotEffect effect, Cost cost) {
|
||||
super(Outcome.Benefit);
|
||||
|
|
|
|||
|
|
@ -108,10 +108,11 @@ public class ReboundAbility extends TriggeredAbilityImpl<ReboundAbility> {
|
|||
if (spell != null && spell.getSourceId().equals(this.getSourceId())) {
|
||||
Effect reboundEffect = new ReboundEffect();
|
||||
boolean found = false;
|
||||
for (Effect effect : spell.getSpellAbility().getEffects())
|
||||
if (effect instanceof ReboundEffect) {
|
||||
found = true;
|
||||
break;
|
||||
for (Effect effect : spell.getSpellAbility().getEffects()) {
|
||||
if (effect instanceof ReboundEffect) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
spell.getSpellAbility().addEffect(reboundEffect);
|
||||
|
|
@ -265,10 +266,11 @@ class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility<R
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.UPKEEP_STEP_PRE && MyTurnCondition.getInstance().apply(game, this)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return event.getType() == EventType.UPKEEP_STEP_PRE && MyTurnCondition.getInstance().apply(game, this);
|
||||
}
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Rebound - You may cast {this} from exile without paying its mana cost.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +283,7 @@ class ReboundEffectCastFromExileDelayedTrigger extends DelayedTriggeredAbility<R
|
|||
class ReboundCastSpellFromExileEffect extends OneShotEffect<ReboundCastSpellFromExileEffect> {
|
||||
|
||||
private static String castFromExileText = "Rebound - You may cast {this} from exile without paying its mana cost";
|
||||
private UUID cardId;
|
||||
private final UUID cardId;
|
||||
|
||||
ReboundCastSpellFromExileEffect(UUID cardId) {
|
||||
super(Outcome.Benefit);
|
||||
|
|
@ -297,7 +299,9 @@ class ReboundCastSpellFromExileEffect extends OneShotEffect<ReboundCastSpellFrom
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ExileZone zone = game.getExile().getExileZone(this.cardId);
|
||||
if (zone == null || zone.isEmpty()) return false;
|
||||
if (zone == null || zone.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Card reboundCard = zone.get(this.cardId, game);
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
SpellAbility ability = reboundCard.getSpellAbility();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import mage.ObjectColor;
|
|||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.CastCommanderAbility;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -59,7 +58,7 @@ public class Commander implements CommandObject{
|
|||
this.card = card;
|
||||
abilites.add(new CastCommanderAbility(card));
|
||||
for (Ability ability : card.getAbilities()) {
|
||||
if (ability instanceof ActivatedAbility && ability.getZone().equals(Zone.COMMAND)) {
|
||||
if (ability.getZone().match(Zone.COMMAND)) {
|
||||
Ability newAbility = ability.copy();
|
||||
newAbility.setRuleVisible(false);
|
||||
abilites.add(newAbility);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue