* Fixed that casting Fervent Strike didn't give double strike to targeted creature with Kwende, Pride of Femeref onto battlefield (fixes #4813).

This commit is contained in:
LevelX2 2018-04-20 20:09:25 +02:00
parent c648ddd6e5
commit e4f09a5358
7 changed files with 29 additions and 17 deletions

View file

@ -30,15 +30,17 @@ package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
@ -68,10 +70,10 @@ public class KwendePrideOfFemeref extends CardImpl {
this.addAbility(DoubleStrikeAbility.getInstance());
// Creatures you control with first strike have double strike.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new GainAbilityAllEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield, filter, false)
.setText("Creatures you control with first strike have double strike")
));
ContinuousEffect effect = new GainAbilityAllEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield, filter, false);
effect.setText("Creatures you control with first strike have double strike");
effect.setDependedToType(DependencyType.AddingAbility); // effects that add first strike need to be executed first
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}
public KwendePrideOfFemeref(final KwendePrideOfFemeref card) {

View file

@ -38,6 +38,7 @@ import mage.abilities.Mode;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -80,6 +81,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
this.ability.newId();
this.filter = filter;
this.excludeSource = excludeSource;
this.addDependencyType(DependencyType.AddingAbility);
}
public GainAbilityAllEffect(final GainAbilityAllEffect effect) {

View file

@ -30,6 +30,7 @@ package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.AttachmentType;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -75,6 +76,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
} else {
this.staticText = rule;
}
this.addDependencyType(DependencyType.AddingAbility);
}
public GainAbilityAttachedEffect(final GainAbilityAttachedEffect 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,12 +20,11 @@
* 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 java.util.HashMap;
@ -36,6 +35,7 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.CompoundAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -79,6 +79,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
this.ability = ability;
this.filter = filter;
this.excludeSource = excludeSource;
this.addDependencyType(DependencyType.AddingAbility);
setText();
}
@ -87,6 +88,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
this.ability = effect.ability.copy();
this.filter = effect.filter.copy();
this.excludeSource = effect.excludeSource;
}
@Override
@ -113,7 +115,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
Permanent perm = it.next().getPermanentOrLKIBattlefield(game); //LKI is neccessary for "dies triggered abilities" to work given to permanets (e.g. Showstopper)
if (perm != null) {
for (Ability abilityToAdd : ability) {
perm.addAbility(abilityToAdd, source.getSourceId(), game, false);
perm.addAbility(abilityToAdd, source.getSourceId(), game, false);
}
} else {
it.remove();
@ -133,7 +135,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
// still as long as the prev. permanent is known to the LKI (e.g. Mikaeus, the Unhallowed) so gained dies triggered ability will trigger
HashMap<UUID, MageObject> LKIBattlefield = game.getLKI().get(Zone.BATTLEFIELD);
if (LKIBattlefield != null) {
for (MageObject mageObject: LKIBattlefield.values()) {
for (MageObject mageObject : LKIBattlefield.values()) {
Permanent perm = (Permanent) mageObject;
if (!(excludeSource && perm.getId().equals(source.getSourceId()))) {
if (filter.match(perm, source.getSourceId(), source.getControllerId(), game)) {
@ -168,13 +170,12 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
if (gainedAbility.startsWith("Whenever ") || gainedAbility.startsWith("{T}")) {
gainedAbility = '"' + gainedAbility + '"';
}
}
else {
} else {
sb.append("gain ");
}
sb.append(gainedAbility);
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
sb.append(' ').append(duration.toString());
sb.append(' ').append(duration.toString());
}
staticText = sb.toString();
}

View file

@ -31,6 +31,7 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -75,6 +76,7 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl implements Sou
if (noStaticText) {
staticText = null;
}
this.addDependencyType(DependencyType.AddingAbility);
}
public GainAbilitySourceEffect(final GainAbilitySourceEffect effect) {

View file

@ -33,6 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -75,6 +76,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
this.ability = ability;
staticText = rule;
this.onCard = onCard;
this.addDependencyType(DependencyType.AddingAbility);
}
public GainAbilityTargetEffect(final GainAbilityTargetEffect effect) {

View file

@ -42,6 +42,7 @@ public enum DependencyType {
AuraAddingRemoving,
ArtifactAddingRemoving,
AddingAbility,
BecomeForest,
BecomeIsland,
BecomeMountain,