Search in sources :

Example 1 with EquipAbility

use of mage.abilities.keyword.EquipAbility in project mage by magefree.

the class FulgentDistractionEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    for (UUID target : targetPointer.getTargets(game, source)) {
        Permanent creature = game.getPermanent(target);
        List<UUID> copiedAttachments = new ArrayList<>(creature.getAttachments());
        for (UUID equipmentId : copiedAttachments) {
            Permanent equipment = game.getPermanent(equipmentId);
            boolean isEquipment = false;
            for (Ability ability : equipment.getAbilities()) {
                if (ability instanceof EquipAbility) {
                    isEquipment = true;
                }
            }
            if (isEquipment) {
                creature.removeAttachment(equipmentId, source, game);
            }
        }
        creature.tap(source, game);
    }
    return true;
}
Also used : EquipAbility(mage.abilities.keyword.EquipAbility) Ability(mage.abilities.Ability) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) ArrayList(java.util.ArrayList) UUID(java.util.UUID) EquipAbility(mage.abilities.keyword.EquipAbility)

Example 2 with EquipAbility

use of mage.abilities.keyword.EquipAbility in project mage by magefree.

the class ArterialAlchemyEffect method apply.

@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
    for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
        switch(layer) {
            case TypeChangingEffects_4:
                permanent.addSubType(game, SubType.EQUIPMENT);
                break;
            case AbilityAddingRemovingEffects_6:
                permanent.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(2, 0)), source.getSourceId(), game);
                permanent.addAbility(new EquipAbility(2), source.getSourceId(), game);
                break;
        }
    }
    return true;
}
Also used : FilterPermanent(mage.filter.FilterPermanent) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) BoostEquippedEffect(mage.abilities.effects.common.continuous.BoostEquippedEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EquipAbility(mage.abilities.keyword.EquipAbility)

Aggregations

EquipAbility (mage.abilities.keyword.EquipAbility)2 Permanent (mage.game.permanent.Permanent)2 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 Ability (mage.abilities.Ability)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 BoostEquippedEffect (mage.abilities.effects.common.continuous.BoostEquippedEffect)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1