mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Implemented Marble Priest
This commit is contained in:
parent
955ec5064c
commit
3dcfa773e0
3 changed files with 89 additions and 4 deletions
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
|
||||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Duration;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -15,23 +15,33 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class MustBeBlockedByAllSourceEffect extends RequirementEffect {
|
||||
|
||||
private final FilterCreaturePermanent filter;
|
||||
|
||||
public MustBeBlockedByAllSourceEffect() {
|
||||
this(Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
public MustBeBlockedByAllSourceEffect(Duration duration) {
|
||||
this(duration, StaticFilters.FILTER_PERMANENT_CREATURES);
|
||||
}
|
||||
|
||||
public MustBeBlockedByAllSourceEffect(Duration duration, FilterCreaturePermanent filter) {
|
||||
super(duration);
|
||||
staticText = "All creatures able to block {this} do so";
|
||||
this.filter = filter;
|
||||
staticText = "All " + filter.getMessage() + " able to block {this} do so";
|
||||
}
|
||||
|
||||
public MustBeBlockedByAllSourceEffect(final MustBeBlockedByAllSourceEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
Permanent sourceCreature = game.getPermanent(source.getSourceId());
|
||||
if (sourceCreature != null && sourceCreature.isAttacking()) {
|
||||
if (sourceCreature != null
|
||||
&& sourceCreature.isAttacking()
|
||||
&& filter.match(permanent, game)) {
|
||||
return permanent.canBlock(source.getSourceId(), game);
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue