foul-magics/Mage/src/main/java/mage/abilities/abilityword/EerieAbility.java
oscscull f7be842008
feature: implement Rooms (#13786)
- 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
2025-10-16 01:36:31 -04:00

62 lines
1.8 KiB
Java

package mage.abilities.abilityword;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.AbilityWord;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public class EerieAbility extends TriggeredAbilityImpl {
public EerieAbility(Effect effect) {
this(effect, false);
}
public EerieAbility(Effect effect, boolean optional) {
this(Zone.BATTLEFIELD, effect, optional);
}
public EerieAbility(Zone zone, Effect effect, boolean optional) {
super(zone, effect, optional);
setAbilityWord(AbilityWord.EERIE);
setTriggerPhrase("Whenever an enchantment you control enters and whenever you fully unlock a Room, ");
}
protected EerieAbility(final EerieAbility ability) {
super(ability);
}
@Override
public EerieAbility copy() {
return new EerieAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|| event.getType() == GameEvent.EventType.ROOM_FULLY_UNLOCKED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
if (!isControlledBy(event.getPlayerId())) {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
return permanent != null && permanent.isEnchantment(game);
}
if (event.getType() == GameEvent.EventType.ROOM_FULLY_UNLOCKED) {
return isControlledBy(event.getPlayerId());
}
return false;
}
}