Merge origin/master

Conflicts:
	Mage.Sets/src/mage/sets/RivalsOfIxalan.java
This commit is contained in:
LevelX2 2018-01-05 23:41:30 +01:00
commit f95b0e6c0a
75 changed files with 1633 additions and 216 deletions

View file

@ -47,6 +47,6 @@ public enum CitysBlessingCondition implements Condition {
@Override
public String toString() {
return "If you have the city's blessing";
return "you have the city's blessing";
}
}

View file

@ -53,13 +53,16 @@ public class DamageAllEffect extends OneShotEffect {
public DamageAllEffect(int amount, String whoDealDamageName, FilterPermanent filter) {
this(new StaticValue(amount), filter);
this.sourceName = whoDealDamageName;
setText(); // TODO: replace to @Override public String getText()
}
public DamageAllEffect(DynamicValue amount, FilterPermanent filter) {
super(Outcome.Damage);
this.amount = amount;
this.filter = filter;
setText();
}
@ -84,7 +87,7 @@ public class DamageAllEffect extends OneShotEffect {
return true;
}
private void setText() {
public void setText() {
StringBuilder sb = new StringBuilder();
sb.append(this.sourceName).append(" deals ").append(amount.toString()).append(" damage to each ").append(filter.getMessage());
String message = amount.getMessage();

View file

@ -50,11 +50,19 @@ public class DamageEverythingEffect extends OneShotEffect {
private DynamicValue amount;
private FilterPermanent filter;
private UUID damageSource;
private String sourceName = "{source}";
public DamageEverythingEffect(int amount) {
this(new StaticValue(amount), new FilterCreaturePermanent());
}
public DamageEverythingEffect(int amount, String whoDealDamageName) {
this(new StaticValue(amount), new FilterCreaturePermanent());
this.sourceName = whoDealDamageName;
setText(); // TODO: replace to @Override public String getText()
}
public DamageEverythingEffect(DynamicValue amount) {
this(amount, new FilterCreaturePermanent());
}
@ -62,6 +70,7 @@ public class DamageEverythingEffect extends OneShotEffect {
public DamageEverythingEffect(int amount, FilterPermanent filter) {
this(new StaticValue(amount), filter);
}
public DamageEverythingEffect(DynamicValue amount, FilterPermanent filter) {
this(amount, filter, null);
}
@ -71,7 +80,11 @@ public class DamageEverythingEffect extends OneShotEffect {
this.amount = amount;
this.filter = filter;
this.damageSource = damageSource;
staticText = "{source} deals " + amount.toString() + " damage to each " + filter.getMessage() + " and each player";
setText();
}
private void setText() {
staticText = this.sourceName + " deals " + this.amount.toString() + " damage to each " + this.filter.getMessage() + " and each player";
}
public DamageEverythingEffect(final DamageEverythingEffect effect) {
@ -79,6 +92,7 @@ public class DamageEverythingEffect extends OneShotEffect {
this.amount = effect.amount;
this.filter = effect.filter;
this.damageSource = effect.damageSource;
this.sourceName = effect.sourceName;
}
@Override

View file

@ -44,6 +44,7 @@ import mage.players.Player;
public class DamagePlayersEffect extends OneShotEffect {
private DynamicValue amount;
private TargetController controller;
private String sourceName = "{source}";
public DamagePlayersEffect(int amount) {
this(Outcome.Damage, new StaticValue(amount));
@ -53,6 +54,13 @@ public class DamagePlayersEffect extends OneShotEffect {
this(Outcome.Damage, new StaticValue(amount), controller);
}
public DamagePlayersEffect(int amount, TargetController controller, String whoDealDamageName) {
this(Outcome.Damage, new StaticValue(amount), controller);
this.sourceName = whoDealDamageName;
setText(); // TODO: replace to @Override public String getText()
}
public DamagePlayersEffect(Outcome outcome, DynamicValue amount) {
this(outcome, amount, TargetController.ANY);
}
@ -69,6 +77,7 @@ public class DamagePlayersEffect extends OneShotEffect {
super(effect);
this.amount = effect.amount;
this.controller = effect.controller;
this.sourceName = effect.sourceName;
}
@Override
@ -103,7 +112,7 @@ public class DamagePlayersEffect extends OneShotEffect {
private void setText()
{
StringBuilder sb = new StringBuilder("{source} deals ").append(amount.toString());
StringBuilder sb = new StringBuilder().append(this.sourceName).append(" deals ").append(amount.toString());
switch (controller) {
case ANY:
sb.append(" damage to each player");

View file

@ -0,0 +1,74 @@
/*
* 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.combat;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class CantAttackBlockUnlessConditionSourceEffect extends RestrictionEffect {
private Condition condition;
public CantAttackBlockUnlessConditionSourceEffect(Condition condition) {
super(Duration.WhileOnBattlefield);
this.condition = condition;
staticText = "{this} can't attack or block unless " + condition.toString();
}
public CantAttackBlockUnlessConditionSourceEffect(final CantAttackBlockUnlessConditionSourceEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return permanent.getId().equals(source.getSourceId()) && condition.apply(game, source);
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
}
@Override
public boolean canAttack(Game game) {
return false;
}
@Override
public CantAttackBlockUnlessConditionSourceEffect copy() {
return new CantAttackBlockUnlessConditionSourceEffect(this);
}
}

View file

@ -627,46 +627,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
return false;
}
//
// @Override
// public List<UUID> getAttachments() {
// return attachments;
// }
// @Override
// public boolean addAttachment(UUID permanentId, Game game) {
// if (!this.attachments.contains(permanentId)) {
// if (!game.replaceEvent(new GameEvent(GameEvent.EventType.ATTACH, objectId, permanentId, controllerId))) {
// this.attachments.add(permanentId);
// Permanent attachment = game.getPermanent(permanentId);
// if (attachment == null) {
// attachment = game.getPermanentEntering(permanentId);
// }
// if (attachment != null) {
// attachment.attachTo(objectId, game);
// game.fireEvent(new GameEvent(GameEvent.EventType.ATTACHED, objectId, permanentId, controllerId));
// return true;
// }
// }
// }
// return false;
// }
//
// @Override
// public boolean removeAttachment(UUID permanentId, Game game) {
// if (this.attachments.contains(permanentId)) {
// if (!game.replaceEvent(new GameEvent(GameEvent.EventType.UNATTACH, objectId, permanentId, controllerId))) {
// this.attachments.remove(permanentId);
// Permanent attachment = game.getPermanent(permanentId);
// if (attachment != null) {
// attachment.attachTo(null, game);
// }
// game.fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, objectId, permanentId, controllerId));
// return true;
// }
// }
// return false;
// }
@Override
public UUID getAttachedTo() {
return attachedTo;

View file

@ -53,6 +53,7 @@ import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.SplitCard;
import mage.cards.SplitCardHalf;
import mage.cards.decks.Deck;
import mage.choices.ChoiceImpl;
import mage.constants.*;
@ -1341,7 +1342,11 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
}
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
UUID sourceId = object.getId();
if (object instanceof SplitCardHalf) {
sourceId = ((SplitCardHalf) object).getParentCard().getId();
}
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, playerId, game)) {
for (Ability ability : candidateAbilites) {
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
ability.setControllerId(this.getId());