Merge pull request #1116 from LoneFox78/master

New stuff
This commit is contained in:
LevelX2 2015-07-14 23:31:33 +02:00
commit f6ef8e7e85
23 changed files with 1018 additions and 56 deletions

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,7 +20,7 @@
* 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.
@ -47,8 +47,8 @@ public class AttacksIfAbleAttachedEffect extends RequirementEffect {
if (attachmentType.equals(AttachmentType.AURA)) {
this.staticText = "Enchanted creature attacks each turn if able";
} else {
this.staticText = "Equiped creature attacks each turn if able";
}
this.staticText = "Equipped creature attacks each turn if able";
}
}
public AttacksIfAbleAttachedEffect(final AttacksIfAbleAttachedEffect effect) {

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,7 +20,7 @@
* 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.
@ -47,8 +47,8 @@ public class BlocksIfAbleAttachedEffect extends RequirementEffect {
if (attachmentType.equals(AttachmentType.AURA)) {
this.staticText = "Enchanted creature blocks each turn if able";
} else {
this.staticText = "Equiped creature blocks each turn if able";
}
this.staticText = "Equipped creature blocks each turn if able";
}
}
public BlocksIfAbleAttachedEffect(final BlocksIfAbleAttachedEffect effect) {

View file

@ -47,8 +47,8 @@ public class CantAttackAttachedEffect extends RestrictionEffect {
if (attachmentType.equals(AttachmentType.AURA)) {
this.staticText = "Enchanted creature can't attack";
} else {
this.staticText = "Equiped creature can't attack";
}
this.staticText = "Equipped creature can't attack";
}
}
public CantAttackAttachedEffect(final CantAttackAttachedEffect effect) {

View file

@ -45,7 +45,7 @@ public class CantAttackBlockAttachedEffect extends RestrictionEffect {
if (attachmentType.equals(AttachmentType.AURA)) {
this.staticText = "Enchanted creature can't attack or block";
} else {
this.staticText = "Equiped creature can't attack or block";
this.staticText = "Equipped creature can't attack or block";
}
}
@ -67,7 +67,7 @@ public class CantAttackBlockAttachedEffect extends RestrictionEffect {
public boolean canAttack(Game game) {
return false;
}
@Override
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,7 +20,7 @@
* 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.
@ -38,7 +38,7 @@ import mage.game.permanent.Permanent;
/**
*
*
* @author LevelX2
*/
@ -49,8 +49,8 @@ public class CantAttackControllerAttachedEffect extends RestrictionEffect {
if (attachmentType.equals(AttachmentType.AURA)) {
this.staticText = "Enchanted creature can't attack you or a planeswalker you control";
} else {
this.staticText = "Equiped creature can't attack you or a planeswalker you control";
}
this.staticText = "Equipped creature can't attack you or a planeswalker you control";
}
}
public CantAttackControllerAttachedEffect(final CantAttackControllerAttachedEffect effect) {
@ -71,7 +71,7 @@ public class CantAttackControllerAttachedEffect extends RestrictionEffect {
return plainswalker == null || !plainswalker.getControllerId().equals(source.getControllerId());
}
@Override
public CantAttackControllerAttachedEffect copy() {
return new CantAttackControllerAttachedEffect(this);

View file

@ -40,17 +40,17 @@ import mage.game.permanent.Permanent;
*/
public class CantBlockAttachedEffect extends RestrictionEffect {
public CantBlockAttachedEffect(AttachmentType attachmentType) {
public CantBlockAttachedEffect(AttachmentType attachmentType) {
this(attachmentType, Duration.WhileOnBattlefield);
}
public CantBlockAttachedEffect(AttachmentType attachmentType, Duration duration) {
public CantBlockAttachedEffect(AttachmentType attachmentType, Duration duration) {
super(duration);
StringBuilder sb = new StringBuilder();
if (attachmentType.equals(AttachmentType.AURA)) {
sb.append("Enchanted creature can't block");
} else {
sb.append("Equiped creature can't block");
sb.append("Equipped creature can't block");
}
if (!duration.toString().isEmpty()) {
sb.append(" ").append(duration.toString());

View file

@ -25,9 +25,9 @@
* 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 java.util.*;
import mage.constants.Duration;
import mage.constants.Layer;
@ -38,57 +38,57 @@ import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author magenoxx_at_googlemail.com
*/
public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
private String rule;
private boolean withSource;
private boolean withSecondTarget;
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
private Map<UUID, UUID> lockedControllers = new HashMap<>();
public ExchangeControlTargetEffect(Duration duration, String rule) {
this(duration, rule, false);
}
public ExchangeControlTargetEffect(Duration duration, String rule, boolean withSource) {
this(duration, rule, withSource, false);
}
public ExchangeControlTargetEffect(Duration duration, String rule, boolean withSource, boolean withSecondTarget) {
super(duration, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
this.withSource = withSource;
this.withSecondTarget = withSecondTarget;
this.rule = rule;
}
public ExchangeControlTargetEffect(final ExchangeControlTargetEffect effect) {
super(effect);
this.rule = effect.rule;
this.withSource = effect.withSource;
this.withSecondTarget = effect.withSecondTarget;
this.lockedControllers = effect.lockedControllers;
this.zoneChangeCounter = effect.zoneChangeCounter;
this.lockedControllers = new HashMap<UUID, UUID>(effect.lockedControllers);
this.zoneChangeCounter = new HashMap<UUID, Integer>(effect.zoneChangeCounter);
}
@Override
public ExchangeControlTargetEffect copy() {
return new ExchangeControlTargetEffect(this);
}
@Override
public boolean isInactive(Ability source, Game game) {
return isDiscarded();
}
@Override
public void init(Ability source, Game game) {
Permanent permanent1 = null;
Permanent permanent2 = null;
if (withSource) {
permanent1 = game.getPermanent(targetPointer.getFirst(game, source));
permanent2 = game.getPermanent(source.getSourceId());
@ -115,13 +115,13 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
this.lockedControllers.put(permanent1.getId(), permanent2.getControllerId());
this.zoneChangeCounter.put(permanent1.getId(), permanent1.getZoneChangeCounter(game));
this.lockedControllers.put(permanent2.getId(), permanent1.getControllerId());
this.zoneChangeCounter.put(permanent2.getId(), permanent2.getZoneChangeCounter(game));
this.zoneChangeCounter.put(permanent2.getId(), permanent2.getZoneChangeCounter(game));
} else {
// discard if there are less than 2 permanents
discard();
}
}
@Override
public boolean apply(Game game, Ability source) {
Set<UUID> toDelete = new HashSet<>();
@ -137,7 +137,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
}
if (!toDelete.isEmpty()) {
for(UUID uuid: toDelete) {
zoneChangeCounter.remove(uuid);
zoneChangeCounter.remove(uuid);
}
if (zoneChangeCounter.isEmpty()) {
discard();
@ -146,7 +146,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
}
return true;
}
@Override
public String getText(Mode mode) {
return this.rule;