mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 12:19:59 -08:00
* fix potential bug where the copy constructor of the continuous effect of ThrummingStone did not copy its object parameters
* unignore the thrumming stone test
This commit is contained in:
parent
005554fcfc
commit
cac6a03e7f
2 changed files with 89 additions and 86 deletions
|
|
@ -27,14 +27,18 @@
|
|||
*/
|
||||
package mage.sets.coldsnap;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.RippleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -42,79 +46,80 @@ import mage.game.stack.Spell;
|
|||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author klayhamn
|
||||
*/
|
||||
public class ThrummingStone extends CardImpl {
|
||||
|
||||
//applies to all spells
|
||||
private static final FilterSpell anySpellFilter = new FilterSpell("Spells you cast");
|
||||
//applies to all spells
|
||||
private static final FilterSpell anySpellFilter = new FilterSpell("Spells you cast");
|
||||
|
||||
public ThrummingStone(UUID ownerId) {
|
||||
super(ownerId, 142, "Thrumming Stone", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||
this.expansionSetCode = "CSP";
|
||||
this.supertype.add("Legendary");
|
||||
public ThrummingStone(UUID ownerId) {
|
||||
super(ownerId, 142, "Thrumming Stone", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||
this.expansionSetCode = "CSP";
|
||||
this.supertype.add("Legendary");
|
||||
|
||||
// spells you cast have Ripple 4
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ThrummingStoneGainAbilitySpellsEffect(new RippleAbility(4), anySpellFilter)));
|
||||
}
|
||||
// spells you cast have Ripple 4
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ThrummingStoneGainAbilitySpellsEffect(new RippleAbility(4), anySpellFilter)));
|
||||
}
|
||||
|
||||
public ThrummingStone(final ThrummingStone card) {
|
||||
super(card);
|
||||
}
|
||||
public ThrummingStone(final ThrummingStone card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrummingStone copy() {
|
||||
return new ThrummingStone(this);
|
||||
}
|
||||
@Override
|
||||
public ThrummingStone copy() {
|
||||
return new ThrummingStone(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ThrummingStoneGainAbilitySpellsEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final Ability ability;
|
||||
private final FilterSpell filter;
|
||||
private final Ability ability;
|
||||
private final FilterSpell filter;
|
||||
|
||||
|
||||
public ThrummingStoneGainAbilitySpellsEffect(Ability ability, FilterSpell filter) {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
this.ability = ability;
|
||||
this.filter = filter;
|
||||
staticText = filter.getMessage() + " have " + ability.getRule();
|
||||
}
|
||||
public ThrummingStoneGainAbilitySpellsEffect(Ability ability, FilterSpell filter) {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
this.ability = ability;
|
||||
this.filter = filter;
|
||||
staticText = filter.getMessage() + " have " + ability.getRule();
|
||||
}
|
||||
|
||||
public ThrummingStoneGainAbilitySpellsEffect(final ThrummingStoneGainAbilitySpellsEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability;
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
public ThrummingStoneGainAbilitySpellsEffect(final ThrummingStoneGainAbilitySpellsEffect effect) {
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
this.filter = effect.filter.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrummingStoneGainAbilitySpellsEffect copy() {
|
||||
return new ThrummingStoneGainAbilitySpellsEffect(this);
|
||||
}
|
||||
@Override
|
||||
public ThrummingStoneGainAbilitySpellsEffect copy() {
|
||||
return new ThrummingStoneGainAbilitySpellsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
// only spells cast, so no copies of spells
|
||||
if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) {
|
||||
Spell spell = (Spell) stackObject;
|
||||
if (filter.match(spell, game)) {
|
||||
if (!spell.getAbilities().contains(ability)) {
|
||||
game.getState().addOtherAbility(spell.getCard(), ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
// only spells cast, so no copies of spells
|
||||
if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) {
|
||||
Spell spell = (Spell) stackObject;
|
||||
if (filter.match(spell, game)) {
|
||||
if (!spell.getAbilities().contains(ability)) {
|
||||
game.getState().addOtherAbility(spell.getCard(), ability);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue