people keep asking me if I'm refactoring ConditionalInterveningIfTriggeredAbility, and I haven't really had an answer. but now yeah, I'm thinking I'm refactoring ConditionalInterveningIfTriggeredAbility

This commit is contained in:
theelk801 2025-06-11 16:27:35 -04:00
parent 0f93ecdb6b
commit cdcda710c8
53 changed files with 533 additions and 658 deletions

View file

@ -19,6 +19,6 @@ public enum DrewTwoOrMoreCardsCondition implements Condition {
@Override
public String toString() {
return "you've drawn two or more cards this turn";
return "you've drawn more than one card this turn";
}
}

View file

@ -1,5 +1,3 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
@ -7,21 +5,22 @@ import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* Checks if a Permanent is monstrous
*
* @author LevelX2
*/
public enum MonstrousCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
return permanent.isMonstrous();
}
return false;
return permanent != null && permanent.isMonstrous();
}
@Override
public String toString() {
return "{this} is monstrous";
}
}

View file

@ -27,4 +27,9 @@ public enum RevealedOrControlledDragonCondition implements Condition {
= game.getState().getWatcher(DragonOnTheBattlefieldWhileSpellWasCastWatcher.class);
return watcher != null && watcher.checkCondition(source, game);
}
@Override
public String toString() {
return "you revealed a Dragon card or controlled a Dragon as you cast this spell";
}
}

View file

@ -35,10 +35,9 @@ public class CastFromHandForFreeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
return CardUtil.castSpellWithAttributesForFree(controller, source, game, new CardsImpl(controller.getHand()), filter);
return controller != null && CardUtil.castSpellWithAttributesForFree(
controller, source, game, new CardsImpl(controller.getHand()), filter
);
}
@Override