forked from External/mage
[BLB] Implement Ruthless Negotiation
This commit is contained in:
parent
25f27fe7f4
commit
b92c22d602
9 changed files with 136 additions and 225 deletions
|
|
@ -0,0 +1,32 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum CastFromGraveyardSourceCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return Optional
|
||||
.ofNullable(source)
|
||||
.map(Ability::getSourceId)
|
||||
.map(game::getSpell)
|
||||
.map(Spell::getFromZone)
|
||||
.map(Zone.GRAVEYARD::match)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "this spell was cast from a graveyard";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue