[M21] Siege Striker - fixed optional effect and null checks;

This commit is contained in:
Oleg Agafonov 2020-06-14 05:03:53 +04:00
parent b5f45f395f
commit 3ac1f924b3
4 changed files with 29 additions and 28 deletions

View file

@ -1,6 +1,5 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -16,11 +15,13 @@ import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class GuildSummit extends CardImpl {
@ -82,9 +83,10 @@ class GuildSummitEffect extends OneShotEffect {
Player you = game.getPlayer(source.getControllerId());
TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
for (UUID creature : target.getTargets()) {
for (UUID creatureId : target.getTargets()) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
game.getPermanent(creature).tap(game);
creature.tap(game);
tappedAmount++;
}
}

View file

@ -1,7 +1,5 @@
package mage.cards.j;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -9,24 +7,26 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class JaddiLifestrider extends CardImpl {
public JaddiLifestrider(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(2);
@ -47,9 +47,9 @@ public final class JaddiLifestrider extends CardImpl {
}
class JaddiLifestriderEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("untapped creatures you control");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filter.add(Predicates.not(TappedPredicate.instance));
@ -70,9 +70,10 @@ class JaddiLifestriderEffect extends OneShotEffect {
Player you = game.getPlayer(source.getControllerId());
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
for (UUID creature : target.getTargets()) {
for (UUID creatureId : target.getTargets()) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
game.getPermanent(creature).tap(game);
creature.tap(game);
tappedAmount++;
}
}

View file

@ -1,6 +1,5 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
@ -9,23 +8,20 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SoldierLifelinkToken;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class LedevChampion extends CardImpl {
@ -86,9 +82,10 @@ class LedevChampionEffect extends OneShotEffect {
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getControllerId(), game)
&& target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
for (UUID creature : target.getTargets()) {
for (UUID creatureId : target.getTargets()) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
game.getPermanent(creature).tap(game);
creature.tap(game);
tappedAmount++;
}
}

View file

@ -13,12 +13,12 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author mikalinn777
*/
public final class SiegeStriker extends CardImpl {
@ -36,7 +36,7 @@ public final class SiegeStriker extends CardImpl {
// Whenever Siege Striker attacks, you may tap any number of untapped creatures you control. Siege Striker gets +1/+1 until end of turn for each creature tapped this way.
this.addAbility(new AttacksTriggeredAbility(
new SiegeStrikerEffect(), false
new SiegeStrikerEffect(), true
));
}
@ -63,7 +63,7 @@ class SiegeStrikerEffect extends OneShotEffect {
public SiegeStrikerEffect() {
super(Outcome.GainLife);
staticText = "you may tap any number of untapped creatures you control. "
+ "{this} gets +1/+1 until end of turn for each creature tapped this way.";
+ "{this} gets +1/+1 until end of turn for each creature tapped this way";
}
public SiegeStrikerEffect(SiegeStrikerEffect effect) {
@ -76,9 +76,10 @@ class SiegeStrikerEffect extends OneShotEffect {
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getControllerId(), game)
&& target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
for (UUID creature : target.getTargets()) {
for (UUID creatureId : target.getTargets()) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
game.getPermanent(creature).tap(game);
creature.tap(game);
tappedAmount++;
}
}