forked from External/mage
- Adds Room + Room half card types - Adds Room unlock ability - Adds Room special functionality (locking halves, unlocking, changing names, changing mana values) - Adjusts name predicate handling for Room name handling (Rooms have between 0 and 2 names on the battlefield depending on their state. They have 1 name on the stack as a normal split card does). Allows cards to match these names properly - Adds Room game events (Unlock, Fully Unlock) and unlock triggers - Updates Split card constructor to allow a single type line as with Rooms - Adds empty name constant for fully unlocked rooms - Updates Permanent to include the door unlock states (that all permanents have) that are relevant when a permanent is or becomes a Room. - Updates ZonesHandler to properly move Room card parts onto and off of the battlefield. - Updated Eerie ability to function properly with Rooms - Implemented Bottomless Pool // Locker Room - Implemented Surgical Suite // Hospital Room - Added Room card tests
43 lines
No EOL
1.3 KiB
Java
43 lines
No EOL
1.3 KiB
Java
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;
|
|
|
|
/**
|
|
* Triggered ability for "when you unlock this door" effects
|
|
*
|
|
* @author oscscull
|
|
*/
|
|
public class UnlockThisDoorTriggeredAbility extends TriggeredAbilityImpl {
|
|
|
|
private final boolean isLeftHalf;
|
|
|
|
public UnlockThisDoorTriggeredAbility(Effect effect, boolean optional, boolean isLeftHalf) {
|
|
super(Zone.BATTLEFIELD, effect, optional);
|
|
this.isLeftHalf = isLeftHalf;
|
|
this.setTriggerPhrase("When you unlock this door, ");
|
|
}
|
|
|
|
private UnlockThisDoorTriggeredAbility(final UnlockThisDoorTriggeredAbility ability) {
|
|
super(ability);
|
|
this.isLeftHalf = ability.isLeftHalf;
|
|
}
|
|
|
|
@Override
|
|
public boolean checkEventType(GameEvent event, Game game) {
|
|
return event.getType() == GameEvent.EventType.DOOR_UNLOCKED;
|
|
}
|
|
|
|
@Override
|
|
public boolean checkTrigger(GameEvent event, Game game) {
|
|
return event.getTargetId().equals(getSourceId()) && event.getFlag() == isLeftHalf;
|
|
}
|
|
|
|
@Override
|
|
public UnlockThisDoorTriggeredAbility copy() {
|
|
return new UnlockThisDoorTriggeredAbility(this);
|
|
}
|
|
} |