mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
Merge pull request #1180 from LoneFox78/master
Fixes, clean-ups, and Didgeridoo!
This commit is contained in:
commit
0a3e4d534f
41 changed files with 526 additions and 673 deletions
|
|
@ -25,7 +25,7 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
|
@ -46,7 +46,7 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl
|
|||
public DealsDamageToOpponentTriggeredAbility(Effect effect) {
|
||||
this(effect, false, false);
|
||||
}
|
||||
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ public class DomainValue implements DynamicValue {
|
|||
|
||||
private Integer amount;
|
||||
private boolean countTargetPlayer;
|
||||
private UUID player;
|
||||
private UUID playerId;
|
||||
|
||||
public DomainValue() {
|
||||
this(1);
|
||||
|
|
@ -34,15 +34,15 @@ public class DomainValue implements DynamicValue {
|
|||
this.countTargetPlayer = countTargetPlayer;
|
||||
}
|
||||
|
||||
public DomainValue(Integer amount, UUID player) {
|
||||
public DomainValue(Integer amount, UUID playerId) {
|
||||
this(amount, false);
|
||||
this.player = player;
|
||||
this.playerId = playerId;
|
||||
}
|
||||
|
||||
public DomainValue(final DomainValue dynamicValue) {
|
||||
this.amount = dynamicValue.amount;
|
||||
this.countTargetPlayer = dynamicValue.countTargetPlayer;
|
||||
this.player = dynamicValue.player;
|
||||
this.playerId = dynamicValue.playerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -53,8 +53,8 @@ public class DomainValue implements DynamicValue {
|
|||
int haveSwamps = 0;
|
||||
int haveForests = 0;
|
||||
UUID targetPlayer;
|
||||
if(player != null) {
|
||||
targetPlayer = player;
|
||||
if(playerId != null) {
|
||||
targetPlayer = playerId;
|
||||
}
|
||||
else if(countTargetPlayer) {
|
||||
targetPlayer = sourceAbility.getTargets().getFirstTarget();
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class DamageAttachedControllerEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "{this} deals " + amount + " to that creature's controller";
|
||||
return "{this} deals " + amount + " damage to that creature's controller";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
|
@ -14,34 +15,34 @@ import mage.target.common.TargetCardInHand;
|
|||
/**
|
||||
* @author magenoxx_at_gmail.com
|
||||
*/
|
||||
public class PutCreatureOnBattlefieldEffect extends OneShotEffect {
|
||||
public class PutPermanentOnBattlefieldEffect extends OneShotEffect {
|
||||
|
||||
private final FilterCreatureCard filter;
|
||||
private final FilterCard filter;
|
||||
|
||||
public PutCreatureOnBattlefieldEffect() {
|
||||
this(new FilterCreatureCard("a creature card"));
|
||||
public PutPermanentOnBattlefieldEffect() {
|
||||
this(new FilterPermanentCard("a permanent card"));
|
||||
}
|
||||
|
||||
public PutCreatureOnBattlefieldEffect(FilterCreatureCard filter) {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
public PutPermanentOnBattlefieldEffect(FilterCard filter) {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public PutCreatureOnBattlefieldEffect(final PutCreatureOnBattlefieldEffect effect) {
|
||||
public PutPermanentOnBattlefieldEffect(final PutPermanentOnBattlefieldEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutCreatureOnBattlefieldEffect copy() {
|
||||
return new PutCreatureOnBattlefieldEffect(this);
|
||||
public PutPermanentOnBattlefieldEffect copy() {
|
||||
return new PutPermanentOnBattlefieldEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
String choiceText = "Put " + filter.getMessage() + " from your hand onto the battlefield?";
|
||||
if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
|
||||
if (player == null || !player.chooseUse(Outcome.PutCardInPlay, choiceText, source, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +63,6 @@ public class PutCreatureOnBattlefieldEffect extends OneShotEffect {
|
|||
return staticText;
|
||||
}
|
||||
|
||||
return "You may put " + filter.getMessage() + " from your hand onto the battlefield";
|
||||
return "you may put " + filter.getMessage() + " from your hand onto the battlefield";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* 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.continuous;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nicolas.perrenou
|
||||
*/
|
||||
|
||||
|
||||
public class SetCardColorSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private ObjectColor setColor;
|
||||
|
||||
public SetCardColorSourceEffect(ObjectColor setColor, Duration duration, String text) {
|
||||
super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||
this.setColor = setColor;
|
||||
staticText = text;
|
||||
}
|
||||
|
||||
public SetCardColorSourceEffect(ObjectColor setColor, Duration duration) {
|
||||
super(duration, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||
this.setColor = setColor;
|
||||
}
|
||||
|
||||
public SetCardColorSourceEffect(final SetCardColorSourceEffect effect) {
|
||||
super(effect);
|
||||
this.setColor = effect.setColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject o = game.getObject(source.getSourceId());
|
||||
if (o != null) {
|
||||
if (o instanceof Permanent || o instanceof StackObject) {
|
||||
o.getColor(game).setColor(setColor);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetCardColorSourceEffect copy() {
|
||||
return new SetCardColorSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{this} ");
|
||||
if (mode.getTargets().size() > 0) {
|
||||
sb.append(mode.getTargets().get(0).getTargetName());
|
||||
}
|
||||
sb.append(" becomes ").append(setColor.getDescription());
|
||||
sb.append(" ").append(duration.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue