Search in sources :

Example 1 with ConditionHint

use of mage.abilities.hint.ConditionHint 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

Ability (mage.abilities.Ability)1 SignatureSpellCastOnlyWithOathbreakerEffect (mage.abilities.common.SignatureSpellCastOnlyWithOathbreakerEffect)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 OathbreakerOnBattlefieldCondition (mage.abilities.condition.common.OathbreakerOnBattlefieldCondition)1 InfoEffect (mage.abilities.effects.common.InfoEffect)1 CommanderReplacementEffect (mage.abilities.effects.common.continuous.CommanderReplacementEffect)1 CommanderCostModification (mage.abilities.effects.common.cost.CommanderCostModification)1 ConditionHint (mage.abilities.hint.ConditionHint)1