Fixed Rebound

This commit is contained in:
magenoxx 2012-06-25 10:10:07 +04:00
parent 0c4217adf1
commit 6b57822f40
3 changed files with 40 additions and 42 deletions

View file

@ -160,11 +160,11 @@ public class CardView extends SimpleCardView {
}
if (this.rarity == null && card instanceof StackAbility) {
StackAbility stackAbility = (StackAbility)card;
if (stackAbility.getZone().equals(Constants.Zone.COMMAND)) {
this.rarity = Rarity.NA;
this.expansionSetCode = stackAbility.getExpansionSetCode();
this.rules = new ArrayList<String>();
this.rules.add(stackAbility.getRule());
if (stackAbility.getZone().equals(Constants.Zone.COMMAND)) {
this.expansionSetCode = stackAbility.getExpansionSetCode();
}
}
}

View file

@ -28,7 +28,6 @@
package mage.abilities.keyword;
import java.util.UUID;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Zone;
@ -46,8 +45,11 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import java.util.UUID;
/**
* This ability has no effect by default and will always return false on the call
* to apply. This is because of how the {@link ReboundEffect} works. It will
@ -66,8 +68,8 @@ import mage.players.Player;
* ability follows the rules for paying alternative costs in rules 601.2b and 601.2e-g.
* <p/>
* 702.85c Multiple instances of rebound on the same spell are redundant.
* @author maurer.it_at_gmail.com
*
* @author maurer.it_at_gmail.com, noxx
*/
public class ReboundAbility extends TriggeredAbilityImpl<ReboundAbility> {
//20101001 - 702.85
@ -89,8 +91,7 @@ public class ReboundAbility extends TriggeredAbilityImpl<ReboundAbility> {
//Something hit the stack from the hand, see if its a spell with this ability.
if (event.getType() == EventType.ZONE_CHANGE &&
((ZoneChangeEvent) event).getFromZone() == Zone.HAND &&
((ZoneChangeEvent)event).getToZone() == Zone.STACK )
{
((ZoneChangeEvent) event).getToZone() == Zone.STACK) {
Card card = (Card) game.getObject(event.getTargetId());
if (card.getAbilities().contains(this)) {
@ -144,14 +145,13 @@ class ReboundEffect extends OneShotEffect<ReboundEffect> {
Spell sourceSpell = (Spell) game.getObject(source.getId());
if (sourceSpell != null && sourceSpell.isCopiedSpell()) {
return false;
}
else {
Card sourceCard = (Card)game.getObject(source.getSourceId());
ReboundEffectCastFromExileDelayedTrigger trigger = new ReboundEffectCastFromExileDelayedTrigger(sourceCard.getId(), sourceCard.getId());
} else {
StackObject sourceCard = (StackObject) game.getObject(source.getSourceId());
ReboundEffectCastFromExileDelayedTrigger trigger = new ReboundEffectCastFromExileDelayedTrigger(sourceCard.getSourceId(), sourceCard.getSourceId());
trigger.setControllerId(source.getControllerId());
game.addDelayedTriggeredAbility(trigger);
game.getContinuousEffects().addEffect(new ReboundCastFromHandReplacementEffect(sourceCard.getId()), source);
game.getContinuousEffects().addEffect(new ReboundCastFromHandReplacementEffect(source.getSourceId()), source);
return true;
}
}
@ -201,12 +201,11 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl<Rebound
Spell sourceSpell = (Spell) game.getObject(source.getId());
if (sourceSpell != null && sourceSpell.isCopiedSpell()) {
return false;
}
else {
} else {
Card sourceCard = (Card) game.getObject(source.getSourceId());
Player player = game.getPlayer(sourceCard.getOwnerId());
sourceCard.moveToExile(source.getSourceId(), player.getName() + " Rebound Exile", source.getId(), game);
sourceCard.moveToExile(this.cardId, player.getName() + " Rebound Exile", source.getId(), game);
this.used = true;
return true;
@ -218,8 +217,7 @@ class ReboundCastFromHandReplacementEffect extends ReplacementEffectImpl<Rebound
if (event.getType() == EventType.ZONE_CHANGE &&
((ZoneChangeEvent) event).getFromZone() == Zone.STACK &&
((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD &&
source.getSourceId() == this.cardId )
{
source.getSourceId() == this.cardId) {
return true;
}
return false;