foul-magics/Mage/src/main/java/mage/abilities/keyword/DayboundAbility.java

60 lines
1.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package mage.abilities.keyword;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.hint.common.DayNightHint;
import mage.constants.*;
import mage.game.Game;
/**
* @author TheElk801
*/
public class DayboundAbility extends StaticAbility {
public DayboundAbility() {
super(Zone.BATTLEFIELD, new DayboundEffect());
this.addHint(DayNightHint.instance);
this.addSubAbility(new TransformAbility());
}
private DayboundAbility(final DayboundAbility ability) {
super(ability);
}
@Override
public String getRule() {
return "daybound <i>(If a player casts no spells during their own turn, it becomes night next turn.)</i>";
}
@Override
public DayboundAbility copy() {
return new DayboundAbility(this);
}
}
class DayboundEffect extends ContinuousEffectImpl {
DayboundEffect() {
super(Duration.WhileOnBattlefield, Layer.PlayerEffects, SubLayer.NA, Outcome.Benefit);
}
private DayboundEffect(final DayboundEffect effect) {
super(effect);
}
@Override
public DayboundEffect copy() {
return new DayboundEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
if (!game.hasDayNight()) {
// 702.145d
// Any time a player controls a permanent with daybound, if its neither day nor night, it becomes day.
game.setDaytime(true);
}
return true;
}
}