mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* Binding Beam - Fixed that creatures did not untap one time later that were not tapped in the next untap phase.
This commit is contained in:
parent
3a12ec9389
commit
5fb2afc5f3
1 changed files with 20 additions and 13 deletions
|
|
@ -102,9 +102,7 @@ class BlindingBeamEffect extends OneShotEffect<BlindingBeamEffect> {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
for (Permanent creature: game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game)) {
|
game.addEffect(new BlindingBeamEffect2(player.getId()), source);
|
||||||
game.addEffect(new BlindingBeamEffect2(creature.getId()), source);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -119,16 +117,18 @@ class BlindingBeamEffect extends OneShotEffect<BlindingBeamEffect> {
|
||||||
|
|
||||||
class BlindingBeamEffect2 extends ReplacementEffectImpl<BlindingBeamEffect2> {
|
class BlindingBeamEffect2 extends ReplacementEffectImpl<BlindingBeamEffect2> {
|
||||||
|
|
||||||
protected UUID creatureId;
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
|
|
||||||
public BlindingBeamEffect2(UUID creatureId) {
|
private UUID targetPlayerId;
|
||||||
super(Duration.OneUse, Outcome.Detriment);
|
|
||||||
this.creatureId = creatureId;
|
public BlindingBeamEffect2(UUID targetPlayerId) {
|
||||||
|
super(Duration.Custom, Outcome.Detriment);
|
||||||
|
this.targetPlayerId = targetPlayerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlindingBeamEffect2(final BlindingBeamEffect2 effect) {
|
public BlindingBeamEffect2(final BlindingBeamEffect2 effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
creatureId = effect.creatureId;
|
this.targetPlayerId = effect.targetPlayerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -143,16 +143,23 @@ class BlindingBeamEffect2 extends ReplacementEffectImpl<BlindingBeamEffect2> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
used = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP &&
|
// replace untap event of creatures of target player
|
||||||
event.getType() == EventType.UNTAP &&
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP) {
|
||||||
event.getTargetId().equals(creatureId)) {
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
return true;
|
if (permanent != null && permanent.getControllerId().equals(targetPlayerId) && filter.match(permanent, game)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// discard effect at end of next untap step of target player
|
||||||
|
if (event.getType().equals(EventType.UNTAP_STEP_POST)) {
|
||||||
|
if (targetPlayerId.equals(event.getPlayerId())) {
|
||||||
|
discard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue