mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Split cards - added spliced effects support for fused spells, no more double splice pays (#6493, #6549);
This commit is contained in:
parent
b38ac2f575
commit
a75d08283f
5 changed files with 144 additions and 5 deletions
|
|
@ -24,6 +24,7 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
import mage.watchers.Watcher;
|
||||
|
|
@ -352,8 +353,15 @@ public abstract class AbilityImpl implements Ability {
|
|||
return false;
|
||||
}
|
||||
|
||||
// fused spell contains 3 abilities (fused, left, right)
|
||||
// fused cost added to fused ability, so no need cost modification for other parts
|
||||
boolean needCostModification = true;
|
||||
if (CardUtil.isFusedPartAbility(this, game)) {
|
||||
needCostModification = false;
|
||||
}
|
||||
|
||||
//20101001 - 601.2e
|
||||
if (sourceObject != null) {
|
||||
if (needCostModification && sourceObject != null) {
|
||||
sourceObject.adjustCosts(this, game); // still needed
|
||||
game.getContinuousEffects().costModification(this, game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import mage.MageObject;
|
|||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.MageSingleton;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.StaticAbility;
|
||||
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect;
|
||||
import mage.abilities.effects.common.continuous.CommanderReplacementEffect;
|
||||
|
|
@ -24,6 +23,7 @@ import mage.game.stack.Spell;
|
|||
import mage.players.ManaPoolItem;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -229,7 +229,7 @@ public class ContinuousEffects implements Serializable {
|
|||
* "actual" meaning it becomes turned on that is defined by
|
||||
* Ability.#isInUseableZone(Game, boolean) method in
|
||||
* #getLayeredEffects(Game).
|
||||
*
|
||||
* <p>
|
||||
* It must be called with different timestamp group name (otherwise sort order will be changed for add/remove effects, see Urborg and Bloodmoon test)
|
||||
*
|
||||
* @param layerEffects
|
||||
|
|
@ -703,10 +703,17 @@ public class ContinuousEffects implements Serializable {
|
|||
* @param game
|
||||
*/
|
||||
public void applySpliceEffects(Ability abilityToModify, Game game) {
|
||||
if (((SpellAbility) abilityToModify).getSpellAbilityType() == SpellAbilityType.SPLICE) {
|
||||
// on a spliced ability of a spell can't be spliced again
|
||||
// add effects from splice card to spell ability on activate/cast
|
||||
|
||||
// splice spell - spell can't be spliced again
|
||||
if (CardUtil.isSpliceAbility(abilityToModify, game)) {
|
||||
return;
|
||||
}
|
||||
// fused spell - can be spliced only to main fused ability, not to parts
|
||||
if (CardUtil.isFusedPartAbility(abilityToModify, game)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<SpliceCardEffect> spliceEffects = getApplicableSpliceCardEffects(game, abilityToModify.getControllerId());
|
||||
// get the applyable splice abilities
|
||||
List<Ability> spliceAbilities = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@ import mage.cards.Card;
|
|||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.EmptyNames;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.CardState;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.util.functions.CopyTokenFunction;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
|
@ -767,4 +769,26 @@ public final class CardUtil {
|
|||
|
||||
return signedP + "/" + signedT;
|
||||
}
|
||||
|
||||
public static boolean isSpliceAbility(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
return ((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLICE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isFusedPartAbility(Ability ability, Game game) {
|
||||
// TODO: is works fine with copies of spells on stack?
|
||||
if (ability instanceof SpellAbility) {
|
||||
Spell mainSpell = game.getSpell(ability.getId());
|
||||
if (mainSpell == null) {
|
||||
return true;
|
||||
} else {
|
||||
SpellAbility mainSpellAbility = mainSpell.getSpellAbility();
|
||||
return mainSpellAbility.getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED
|
||||
&& !ability.equals(mainSpellAbility);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue