mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[ECL] Implement Dose of Dawnglow
This commit is contained in:
parent
0ef4695e29
commit
acc180d1d4
11 changed files with 143 additions and 52 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -10,23 +9,22 @@ import mage.game.Game;
|
|||
*/
|
||||
public enum IsMainPhaseCondition implements Condition {
|
||||
|
||||
YOUR(true),
|
||||
ANY(false);
|
||||
YOURS(true),
|
||||
NOT_YOURS(false);
|
||||
|
||||
private final boolean yourMainPhaseOnly;
|
||||
private final boolean yours;
|
||||
|
||||
IsMainPhaseCondition(boolean yourMainPhaseOnly) {
|
||||
this.yourMainPhaseOnly = yourMainPhaseOnly;
|
||||
IsMainPhaseCondition(boolean yours) {
|
||||
this.yours = yours;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game.getTurnPhaseType().isMain() &&
|
||||
(!yourMainPhaseOnly || game.getActivePlayerId().equals(source.getControllerId()));
|
||||
return game.getTurnPhaseType().isMain() && yours == game.isActivePlayer(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "it's" + (yourMainPhaseOnly ? " your " : " ") + "main phase";
|
||||
return "it" + (yours ? "'s" : " isn't") + " your main phase";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
package mage.abilities.effects.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class BlightControllerEffect extends OneShotEffect {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public BlightControllerEffect(int amount) {
|
||||
super(Outcome.Detriment);
|
||||
this.amount = amount;
|
||||
staticText = "blight " + amount;
|
||||
}
|
||||
|
||||
private BlightControllerEffect(final BlightControllerEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlightControllerEffect copy() {
|
||||
return new BlightControllerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
return doBlight(player, amount, game, source) != null;
|
||||
}
|
||||
|
||||
public static Permanent doBlight(Player player, int amount, Game game, Ability source) {
|
||||
if (player == null || amount < 1 || !game.getBattlefield().contains(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, player.getId(), source, game, 1
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
TargetPermanent target = new TargetControlledCreaturePermanent();
|
||||
target.withNotTarget(true);
|
||||
target.withChooseHint("to put a -1/-1 counter on");
|
||||
player.choose(Outcome.UnboostCreature, target, source, game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.M1M1.createInstance(amount), source, game);
|
||||
}
|
||||
return permanent;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue