* Oppressive Rays - Fixed that it did not work for blocking of enchanted creature.

This commit is contained in:
LevelX2 2014-04-27 16:02:44 +02:00
parent 6b1fe53fac
commit bf260cd9c6

View file

@ -111,10 +111,16 @@ class OppressiveRaysEffect extends ReplacementEffectImpl<OppressiveRaysEffect> {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
ManaCostsImpl attackTax = new ManaCostsImpl("{3}");
if (attackTax.canPay(source.getSourceId(), event.getPlayerId(), game)
&& player.chooseUse(Outcome.Neutral, "Pay {3} to attack?", game)) {
if (attackTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) {
String chooseText;
if (event.getType().equals(GameEvent.EventType.DECLARE_ATTACKER)) {
chooseText = "Pay {3} to attack?";
} else {
chooseText = "Pay {3} to block?";
}
ManaCostsImpl attackBlockTax = new ManaCostsImpl("{3}");
if (attackBlockTax.canPay(source.getSourceId(), event.getPlayerId(), game)
&& player.chooseUse(Outcome.Neutral, chooseText, game)) {
if (attackBlockTax.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) {
return false;
}
}
@ -129,6 +135,10 @@ class OppressiveRaysEffect extends ReplacementEffectImpl<OppressiveRaysEffect> {
Permanent attacker = game.getPermanent(event.getSourceId());
return attacker != null && attacker.getAttachments().contains(source.getSourceId());
}
if (event.getType().equals(GameEvent.EventType.DECLARE_BLOCKER)) {
Permanent blocker = game.getPermanent(event.getSourceId());
return blocker != null && blocker.getAttachments().contains(source.getSourceId());
}
return false;
}