simplified various cards to use isInstantOrSorcery method

This commit is contained in:
Evan Kranzler 2021-03-22 20:01:20 -04:00
parent df866f858e
commit 2a42bec1f2
38 changed files with 46 additions and 43 deletions

View file

@ -46,7 +46,7 @@ public class PreventDamageByTargetEffect extends PreventionEffectImpl {
if (!this.used && super.applies(event, source, game)) {
MageObject mageObject = game.getObject(event.getSourceId());
if (mageObject != null
&& (mageObject.isInstant() || mageObject.isSorcery())) {
&& mageObject.isInstantOrSorcery()) {
for (Target target : source.getTargets()) {
if (target instanceof TargetSpell) {
if (((TargetSpell) target).getSourceIds().contains(event.getSourceId())) {

View file

@ -23,7 +23,7 @@ public class SupportEffect extends AddCountersTargetEffect {
super(CounterType.P1P1.createInstance(0), StaticValue.get(1));
this.amountSupportTargets = StaticValue.get(amount);
this.otherPermanent = otherPermanent;
if (card.isInstant() || card.isSorcery()) {
if (card.isInstantOrSorcery()) {
card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount, new FilterCreaturePermanent("target creatures"), false));
}
staticText = setText();

View file

@ -99,7 +99,7 @@ public class ProtectionAbility extends StaticAbility {
// object is still a card and not a spell yet. So return only if the source object can't be a spell
// otherwise the following FilterObject check will be applied
if (source instanceof StackObject
|| (!source.isInstant() && !source.isSorcery())) {
|| !source.isInstantOrSorcery()) {
return true;
}
}
@ -107,7 +107,7 @@ public class ProtectionAbility extends StaticAbility {
// Emrakul, the Aeons Torn
if (filter instanceof FilterStackObject) {
if (filter.match(source, game)) {
return (!source.isInstantOrSorcery());
return !source.isInstantOrSorcery();
}
}

View file

@ -25,7 +25,7 @@ public class SupportAbility extends EntersBattlefieldTriggeredAbility {
*/
public SupportAbility(Card card, int amount, boolean otherPermanent) {
super(new SupportEffect(card, amount, otherPermanent));
if (!card.isInstant() && !card.isSorcery()) {
if (!card.isInstantOrSorcery()) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures");
if (card.isCreature()) {
filter.add(AnotherPredicate.instance);

View file

@ -44,7 +44,7 @@ class InstantOrSorceryCastManaCondition extends ManaCondition implements Conditi
public boolean apply(Game game, Ability source) {
if (source instanceof SpellAbility) {
MageObject object = game.getObject(source.getSourceId());
return object != null && (object.isInstant() || object.isSorcery());
return object != null && object.isInstantOrSorcery();
}
return false;
}

View file

@ -110,7 +110,7 @@ public final class RateCard {
}
private static int isRemoval(Card card) {
if (card.isEnchantment() || card.isInstant() || card.isSorcery()) {
if (card.isEnchantment() || card.isInstantOrSorcery()) {
for (Ability ability : card.getAbilities()) {
for (Effect effect : ability.getEffects()) {

View file

@ -207,7 +207,7 @@ public class Spell extends StackObjImpl implements Card {
turnController.controlPlayersTurn(game, controller.getId());
}
}
if (this.isInstant() || this.isSorcery()) {
if (this.isInstantOrSorcery()) {
int index = 0;
result = false;
boolean legalParts = false;