mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
[TDM] Focus the Mind and Sage of the Skies (#13524)
* [TDM] Implement Focus the Mind * [TDM] Implement Sage of the Skies * Extracted cast another spell this turn condition from Rally the Monastery * Add condition to Rally the Monastery and Slick Sequence
This commit is contained in:
parent
0848382dcd
commit
e552a54e6f
6 changed files with 152 additions and 116 deletions
|
|
@ -0,0 +1,44 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.watchers.common.SpellsCastWatcher;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author balazskristof, Jmlundeen
|
||||
*/
|
||||
public enum CastAnotherSpellThisTurnCondition implements Condition {
|
||||
instance;
|
||||
private final Hint hint = new ConditionHint(
|
||||
this, "You've cast another spell this turn"
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
|
||||
if (watcher == null) {
|
||||
return false;
|
||||
}
|
||||
List<Spell> spells = watcher.getSpellsCastThisTurn(source.getControllerId());
|
||||
return spells != null && spells
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(spell -> !spell.getSourceId().equals(source.getSourceId()) || spell.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter());
|
||||
}
|
||||
|
||||
public Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "you've cast another spell this turn";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue