mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
- First part of fix #6660
This commit is contained in:
parent
8edbe544c8
commit
3c653d8b19
3 changed files with 54 additions and 4 deletions
|
@ -20,6 +20,8 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
|
||||
import static mage.filter.StaticFilters.FILTER_ATTACKING_CREATURES;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author arcox
|
||||
|
@ -30,7 +32,8 @@ public final class ChokingVines extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{G}");
|
||||
|
||||
// Cast only during the declare blockers step.
|
||||
this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(null, PhaseStep.DECLARE_BLOCKERS, null, "Cast this spell only during the declare blockers step"));
|
||||
this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(null,
|
||||
PhaseStep.DECLARE_BLOCKERS, null, "Cast this spell only during the declare blockers step"));
|
||||
|
||||
// X target attacking creatures become blocked. Choking Vines deals 1 damage to each of those creatures.
|
||||
this.getSpellAbility().addEffect(new ChokingVinesEffect());
|
||||
|
@ -85,7 +88,12 @@ class ChokingVinesEffect extends OneShotEffect {
|
|||
for (UUID id : target.getTargets()) {
|
||||
CombatGroup combatGroup = game.getCombat().findGroup(id);
|
||||
if (combatGroup != null) {
|
||||
combatGroup.setBlocked(true, game);
|
||||
combatGroup.setBlocked(true); // non-banded creatures
|
||||
combatGroup.setBlocked(true, game); // this only works for banded creatures and needs to be checked out
|
||||
Permanent attacker = game.getPermanent(id);
|
||||
if (attacker != null) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREATURE_BLOCKED, attacker.getId(), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public BecomesBlockedSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public BecomesBlockedSourceTriggeredAbility(final BecomesBlockedSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CREATURE_BLOCKED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getTargetId().equals(this.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} becomes blocked, " + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesBlockedSourceTriggeredAbility copy() {
|
||||
return new BecomesBlockedSourceTriggeredAbility(this);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -43,7 +42,7 @@ public class EnchantedCreatureBlockedTriggeredAbility extends TriggeredAbilityIm
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever enchanted creature becomes blocked by a creature, " + super.getRule();
|
||||
return "Whenever enchanted creature becomes blocked, " + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue