Merge pull request #5036 from NoahGleason/searing-rays

Implement Searing Rays
This commit is contained in:
Oleg Agafonov 2018-06-20 03:14:05 +04:00 committed by GitHub
commit 9145e1ffb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author noahg
*/
public final class SearingRays extends CardImpl {
public SearingRays(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}");
// Choose a color. Searing Rays deals damage to each player equal to the number of creatures of that color that player controls.
this.getSpellAbility().addEffect(new SearingRaysEffect());
}
public SearingRays(final SearingRays card) {
super(card);
}
@Override
public SearingRays copy() {
return new SearingRays(this);
}
}
class SearingRaysEffect extends OneShotEffect {
public SearingRaysEffect() {
super(Outcome.Damage);
this.staticText = "Choose a color. {this} deals damage to each player equal to the number of creatures of that color that player controls";
}
public SearingRaysEffect(final SearingRaysEffect effect) {
super(effect);
}
@Override
public SearingRaysEffect copy() {
return new SearingRaysEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
ChoiceColor choice = new ChoiceColor();
if (controller != null && controller.choose(outcome, choice, game) && choice.getColor() != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent(choice.getColor().getDescription()+" creatures");
filter.add(new ColorPredicate(choice.getColor()));
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
int amount = game.getBattlefield().countAll(filter , playerId, game);
if (amount > 0) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.damage(amount, source.getSourceId(), game, false, true);
}
}
}
return true;
}
return false;
}
}

View file

@ -256,6 +256,7 @@ public final class Invasion extends ExpansionSet {
cards.add(new SetCardInfo("Scavenged Weaponry", 123, Rarity.COMMON, mage.cards.s.ScavengedWeaponry.class));
cards.add(new SetCardInfo("Scorching Lava", 164, Rarity.COMMON, mage.cards.s.ScorchingLava.class));
cards.add(new SetCardInfo("Scouting Trek", 210, Rarity.UNCOMMON, mage.cards.s.ScoutingTrek.class));
cards.add(new SetCardInfo("Searing Rays", 165, Rarity.UNCOMMON, mage.cards.s.SearingRays.class));
cards.add(new SetCardInfo("Seashell Cameo", 311, Rarity.UNCOMMON, mage.cards.s.SeashellCameo.class));
cards.add(new SetCardInfo("Seer's Vision", 270, Rarity.UNCOMMON, mage.cards.s.SeersVision.class));
cards.add(new SetCardInfo("Serpentine Kavu", 211, Rarity.COMMON, mage.cards.s.SerpentineKavu.class));