-
Notifications
You must be signed in to change notification settings - Fork 787
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
86 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package mage.cards.r; | ||
|
||
import mage.abilities.Ability; | ||
import mage.abilities.effects.OneShotEffect; | ||
import mage.cards.CardImpl; | ||
import mage.cards.CardSetInfo; | ||
import mage.constants.CardType; | ||
import mage.constants.Outcome; | ||
import mage.filter.StaticFilters; | ||
import mage.game.Game; | ||
import mage.game.permanent.Permanent; | ||
import mage.game.permanent.token.CentaurToken; | ||
import mage.game.permanent.token.Token; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
/** | ||
* @author TheElk801 | ||
*/ | ||
public final class RampageOfTheClans extends CardImpl { | ||
|
||
public RampageOfTheClans(UUID ownerId, CardSetInfo setInfo) { | ||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}"); | ||
|
||
// Destroy all artifacts and enchantments. For each permanent destroyed this way, its controller creates a 3/3 green Centaur creature token. | ||
this.getSpellAbility().addEffect(new RampageOfTheClansEffect()); | ||
} | ||
|
||
private RampageOfTheClans(final RampageOfTheClans card) { | ||
super(card); | ||
} | ||
|
||
@Override | ||
public RampageOfTheClans copy() { | ||
return new RampageOfTheClans(this); | ||
} | ||
} | ||
|
||
class RampageOfTheClansEffect extends OneShotEffect { | ||
|
||
RampageOfTheClansEffect() { | ||
super(Outcome.Benefit); | ||
staticText = "Destroy all artifacts and enchantments. " + | ||
"For each permanent destroyed this way, " + | ||
"its controller creates a 3/3 green Centaur creature token."; | ||
} | ||
|
||
private RampageOfTheClansEffect(final RampageOfTheClansEffect effect) { | ||
super(effect); | ||
} | ||
|
||
@Override | ||
public RampageOfTheClansEffect copy() { | ||
return new RampageOfTheClansEffect(this); | ||
} | ||
|
||
@Override | ||
public boolean apply(Game game, Ability source) { | ||
Map<UUID, Integer> playersWithPermanents = new HashMap<>(); | ||
for (Permanent p : game.getBattlefield().getActivePermanents( | ||
StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, | ||
source.getControllerId(), source.getSourceId(), game | ||
)) { | ||
UUID controllerId = p.getControllerId(); | ||
if (p.destroy(source.getSourceId(), game, false)) { | ||
playersWithPermanents.put(controllerId, playersWithPermanents.getOrDefault(controllerId, 0) + 1); | ||
} | ||
} | ||
Token token = new CentaurToken(); | ||
for (UUID playerId : playersWithPermanents.keySet()) { | ||
token.putOntoBattlefield(playersWithPermanents.get(playerId), game, source.getSourceId(), playerId); | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters