mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 12:52:06 -08:00
[40K] Implemented Ravener
This commit is contained in:
parent
9b31c67312
commit
a742f5a7d1
4 changed files with 111 additions and 58 deletions
|
|
@ -0,0 +1,51 @@
|
|||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class MustAttackOpponentWithCreatureTargetEffect extends RequirementEffect {
|
||||
|
||||
public MustAttackOpponentWithCreatureTargetEffect() {
|
||||
super(Duration.EndOfTurn);
|
||||
staticText = "target creature attacks target opponent this turn if able";
|
||||
}
|
||||
|
||||
private MustAttackOpponentWithCreatureTargetEffect(final MustAttackOpponentWithCreatureTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MustAttackOpponentWithCreatureTargetEffect copy() {
|
||||
return new MustAttackOpponentWithCreatureTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return this.getTargetPointer().getTargets(game, source).contains(permanent.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustAttack(Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustBlock(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID mustAttackDefender(Ability source, Game game) {
|
||||
return Optional.ofNullable(source.getTargets().get(1)).map(Target::getFirstTarget).orElse(null);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue