forked from External/mage
Redesigned handling of attack allowed check related to the complete attack.
This commit is contained in:
parent
359dc3f537
commit
4d01eb143a
15 changed files with 267 additions and 176 deletions
|
|
@ -69,6 +69,10 @@ public abstract class RestrictionEffect extends ContinuousEffectImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CanAttackOnlyAloneEffect extends RestrictionEffect {
|
||||
|
||||
public CanAttackOnlyAloneEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "{this} can only attack alone";
|
||||
}
|
||||
|
||||
public CanAttackOnlyAloneEffect(final CanAttackOnlyAloneEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CanAttackOnlyAloneEffect copy() {
|
||||
return new CanAttackOnlyAloneEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) {
|
||||
return numberOfAttackers == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return source.getSourceId().equals(permanent.getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CantAttackAloneEffect extends RestrictionEffect {
|
||||
|
||||
public CantAttackAloneEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "{this} can't attack alone";
|
||||
}
|
||||
|
||||
public CantAttackAloneEffect(final CantAttackAloneEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantAttackAloneEffect copy() {
|
||||
return new CantAttackAloneEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttackCheckAfter(int numberOfAttackers, Ability source, Game game) {
|
||||
return numberOfAttackers > 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return source.getSourceId().equals(permanent.getId());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue