mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[STX] Implemented Show of Confidence
This commit is contained in:
parent
63ae80c711
commit
79b7d49e83
3 changed files with 94 additions and 8 deletions
90
Mage.Sets/src/mage/cards/s/ShowOfConfidence.java
Normal file
90
Mage.Sets/src/mage/cards/s/ShowOfConfidence.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.watchers.common.SpellsCastWatcher;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ShowOfConfidence extends CardImpl {
|
||||
|
||||
public ShowOfConfidence(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
|
||||
|
||||
// When you cast this spell, copy it for each other instant or sorcery spell you've cast this turn. You may choose new targets for the copies.
|
||||
this.addAbility(new CastSourceTriggeredAbility(new ShowOfConfidenceEffect()), new SpellsCastWatcher());
|
||||
|
||||
// Put a +1/+1 counter on target creature. It gains vigilance until end of turn.
|
||||
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()));
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(
|
||||
VigilanceAbility.getInstance(), Duration.EndOfTurn
|
||||
).setText("It gains vigilance until end of turn"));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
private ShowOfConfidence(final ShowOfConfidence card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShowOfConfidence copy() {
|
||||
return new ShowOfConfidence(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ShowOfConfidenceEffect extends OneShotEffect {
|
||||
|
||||
ShowOfConfidenceEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "copy it for each other instant or sorcery spell you've cast this turn. " +
|
||||
"You may choose new targets for the copies";
|
||||
}
|
||||
|
||||
private ShowOfConfidenceEffect(final ShowOfConfidenceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShowOfConfidenceEffect copy() {
|
||||
return new ShowOfConfidenceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = (Spell) getValue("spellCast");
|
||||
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
|
||||
if (spell == null || watcher == null) {
|
||||
return false;
|
||||
}
|
||||
int copies = watcher.getSpellsCastThisTurn(source.getControllerId())
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(MageObject::isInstantOrSorcery)
|
||||
.filter(s -> !s.getSourceId().equals(source.getSourceId())
|
||||
|| s.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter())
|
||||
.mapToInt(x -> 1)
|
||||
.sum();
|
||||
if (copies > 0) {
|
||||
spell.createCopyOnStack(game, source, source.getControllerId(), true, copies);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -232,6 +232,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Shadewing Laureate", 229, Rarity.UNCOMMON, mage.cards.s.ShadewingLaureate.class));
|
||||
cards.add(new SetCardInfo("Shaile, Dean of Radiance", 158, Rarity.RARE, mage.cards.s.ShaileDeanOfRadiance.class));
|
||||
cards.add(new SetCardInfo("Shineshadow Snarl", 272, Rarity.RARE, mage.cards.s.ShineshadowSnarl.class));
|
||||
cards.add(new SetCardInfo("Show of Confidence", 28, Rarity.UNCOMMON, mage.cards.s.ShowOfConfidence.class));
|
||||
cards.add(new SetCardInfo("Silverquill Apprentice", 231, Rarity.UNCOMMON, mage.cards.s.SilverquillApprentice.class));
|
||||
cards.add(new SetCardInfo("Silverquill Campus", 273, Rarity.COMMON, mage.cards.s.SilverquillCampus.class));
|
||||
cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class));
|
||||
|
|
|
@ -10,14 +10,9 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SpellsCastWatcher extends Watcher {
|
||||
|
@ -73,11 +68,11 @@ public class SpellsCastWatcher extends Watcher {
|
|||
}
|
||||
|
||||
public List<Spell> getSpellsCastThisTurn(UUID playerId) {
|
||||
return spellsCast.get(playerId);
|
||||
return spellsCast.computeIfAbsent(playerId, x -> new ArrayList<>());
|
||||
}
|
||||
|
||||
public List<Spell> getSpellsCastFromGraveyardThisTurn(UUID playerId) {
|
||||
return spellsCastFromGraveyard.get(playerId);
|
||||
return spellsCastFromGraveyard.computeIfAbsent(playerId, x -> new ArrayList<>());
|
||||
}
|
||||
|
||||
public int getNumberOfNonCreatureSpells() {
|
||||
|
|
Loading…
Reference in a new issue