Search in sources :

Example 11 with InfoEffect

use of mage.abilities.effects.common.InfoEffect in project mage by magefree.

the class OathbreakerFreeForAll method initCommanderEffects.

@Override
public void initCommanderEffects(Card commander, Player player, Ability commanderAbility) {
    // all commander effects must be independent from sourceId or controllerId (it's limitation of current commander effects)
    boolean isSignatureSpell = this.playerSignatureSpells.getOrDefault(player.getId(), new HashSet<>()).contains(commander.getId());
    // basic commmander restrict (oathbreaker may ask to move, signature force to move)
    commanderAbility.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, isSignatureSpell, getCommanderTypeName(commander)));
    commanderAbility.addEffect(new CommanderCostModification(commander));
    // signature spell restrict (spell can be casted on player's commander on battlefield)
    if (isSignatureSpell) {
        OathbreakerOnBattlefieldCondition condition = new OathbreakerOnBattlefieldCondition(this, player.getId(), commander.getId(), this.playerOathbreakers.getOrDefault(player.getId(), new HashSet<>()));
        commanderAbility.addEffect(new SignatureSpellCastOnlyWithOathbreakerEffect(condition, commander.getId()));
        // hint must be added to card, not global ability
        Ability ability = new SimpleStaticAbility(new InfoEffect("Signature spell hint"));
        ability.addHint(new ConditionHint(condition, "Oathbreaker on battlefield (" + condition.getCompatibleNames() + ")"));
        ability.setRuleVisible(false);
        commander.addAbility(ability);
    }
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) OathbreakerOnBattlefieldCondition(mage.abilities.condition.common.OathbreakerOnBattlefieldCondition) CommanderReplacementEffect(mage.abilities.effects.common.continuous.CommanderReplacementEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) SignatureSpellCastOnlyWithOathbreakerEffect(mage.abilities.common.SignatureSpellCastOnlyWithOathbreakerEffect) ConditionHint(mage.abilities.hint.ConditionHint) CommanderCostModification(mage.abilities.effects.common.cost.CommanderCostModification) InfoEffect(mage.abilities.effects.common.InfoEffect)

Aggregations

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)11 InfoEffect (mage.abilities.effects.common.InfoEffect)11 Ability (mage.abilities.Ability)7 Player (mage.players.Player)6 UUID (java.util.UUID)4 Card (mage.cards.Card)4 CardInfo (mage.cards.repository.CardInfo)3 TurnMod (mage.game.turn.TurnMod)3 HashSet (java.util.HashSet)2 MageObject (mage.MageObject)2 CommanderReplacementEffect (mage.abilities.effects.common.continuous.CommanderReplacementEffect)2 CommanderCostModification (mage.abilities.effects.common.cost.CommanderCostModification)2 FilterCard (mage.filter.FilterCard)2 CommanderInfoWatcher (mage.watchers.common.CommanderInfoWatcher)2 File (java.io.File)1 Constructor (java.lang.reflect.Constructor)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 java.util (java.util)1 TimeUnit (java.util.concurrent.TimeUnit)1