Search in sources :

Example 16 with RestrictionEffect

use of mage.abilities.effects.RestrictionEffect in project mage by magefree.

the class TraceUtil method traceCombat.

private static void traceCombat(Game game, Permanent attacker, Permanent blocker) {
    String prefix = "> ";
    log.error(prefix + "Tracing game state...");
    if (blocker != null) {
        log.error(prefix + blocker.getLogName() + " could block " + attacker.getLogName());
    }
    log.error(prefix);
    log.error(prefix + "Attacker abilities: ");
    for (Ability ability : attacker.getAbilities()) {
        log.error(prefix + "     " + ability.toString() + ", id=" + ability.getId());
    }
    if (blocker != null) {
        log.error(prefix + "Blocker abilities: ");
        for (Ability ability : blocker.getAbilities()) {
            log.error(prefix + "     " + ability.toString() + ", id=" + ability.getId());
        }
    }
    log.error(prefix);
    log.error(prefix + "Flying ability id: " + FlyingAbility.getInstance().getId());
    log.error(prefix + "Reach ability id: " + ReachAbility.getInstance().getId());
    log.error(prefix + "Intimidate ability id: " + IntimidateAbility.getInstance().getId());
    log.error(prefix);
    log.error(prefix + "Restriction effects:");
    log.error(prefix + "  Applied to ATTACKER:");
    Map<RestrictionEffect, Set<Ability>> attackerResEffects = game.getContinuousEffects().getApplicableRestrictionEffects(attacker, game);
    for (Map.Entry<RestrictionEffect, Set<Ability>> entry : attackerResEffects.entrySet()) {
        log.error(prefix + "    " + entry.getKey());
        log.error(prefix + "        id=" + entry.getKey().getId());
        for (Ability ability : entry.getValue()) {
            log.error(prefix + "        ability=" + ability);
        }
    }
    log.error(prefix + "  Applied to BLOCKER:");
    if (blocker != null) {
        Map<RestrictionEffect, Set<Ability>> blockerResEffects = game.getContinuousEffects().getApplicableRestrictionEffects(blocker, game);
        for (Map.Entry<RestrictionEffect, Set<Ability>> entry : blockerResEffects.entrySet()) {
            log.error(prefix + "    " + entry.getKey());
            log.error(prefix + "        id=" + entry.getKey().getId());
            for (Ability ability : entry.getValue()) {
                log.error(prefix + "        ability=" + ability);
            }
        }
    }
    ContinuousEffectsList<RestrictionEffect> restrictionEffects = (ContinuousEffectsList<RestrictionEffect>) game.getContinuousEffects().getRestrictionEffects();
    log.error(prefix);
    log.error(prefix + "  List of all restriction effects:");
    for (RestrictionEffect effect : restrictionEffects) {
        log.error(prefix + "    " + effect);
        log.error(prefix + "        id=" + effect.getId());
    }
    log.error(prefix);
    log.error(prefix + "  Trace Attacker:");
    traceForPermanent(game, attacker, prefix, restrictionEffects);
    if (blocker != null) {
        log.error(prefix);
        log.error(prefix + "  Trace Blocker:");
        traceForPermanent(game, blocker, prefix, restrictionEffects);
    }
    log.error(prefix);
}
Also used : CantBeBlockedSourceAbility(mage.abilities.keyword.CantBeBlockedSourceAbility) StaticAbility(mage.abilities.StaticAbility) ReachAbility(mage.abilities.keyword.ReachAbility) TriggeredAbility(mage.abilities.TriggeredAbility) FlyingAbility(mage.abilities.keyword.FlyingAbility) Ability(mage.abilities.Ability) IntimidateAbility(mage.abilities.keyword.IntimidateAbility) ContinuousEffectsList(mage.abilities.effects.ContinuousEffectsList) RestrictionEffect(mage.abilities.effects.RestrictionEffect)

Aggregations

RestrictionEffect (mage.abilities.effects.RestrictionEffect)16 Permanent (mage.game.permanent.Permanent)11 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)8 Ability (mage.abilities.Ability)7 Player (mage.players.Player)7 MageObject (mage.MageObject)5 FixedTarget (mage.target.targetpointer.FixedTarget)5 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)4 ArrayList (java.util.ArrayList)3 UUID (java.util.UUID)3 RequirementEffect (mage.abilities.effects.RequirementEffect)3 BandingAbility (mage.abilities.keyword.BandingAbility)3 BandsWithOtherAbility (mage.abilities.keyword.BandsWithOtherAbility)3 FlyingAbility (mage.abilities.keyword.FlyingAbility)3 VigilanceAbility (mage.abilities.keyword.VigilanceAbility)3 JohanVigilanceAbility (mage.abilities.keyword.special.JohanVigilanceAbility)3 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)3 SpellAbility (mage.abilities.SpellAbility)2 StaticAbility (mage.abilities.StaticAbility)2 TriggeredAbility (mage.abilities.TriggeredAbility)2