示例#1
0
  public HarmonicSliver(UUID ownerId) {
    super(
        ownerId,
        240,
        "Harmonic Sliver",
        Rarity.UNCOMMON,
        new CardType[] {CardType.CREATURE},
        "{1}{G}{W}");
    this.expansionSetCode = "TSP";
    this.subtype.add("Sliver");

    this.power = new MageInt(1);
    this.toughness = new MageInt(1);

    // All Slivers have "When this permanent enters the battlefield, destroy target artifact or
    // enchantment."
    TriggeredAbility ability =
        new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false);
    TargetPermanent target = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent());
    ability.addTarget(target);
    this.addAbility(
        new SimpleStaticAbility(
            Zone.BATTLEFIELD,
            new GainAbilityAllEffect(
                ability,
                Duration.WhileOnBattlefield,
                filterSliver,
                "All Slivers have \"When this permanent enters the battlefield, destroy target artifact or enchantment.\"")));
  }
示例#2
0
 public List<TriggeredAbility> getTriggered(UUID controllerId) {
   List<TriggeredAbility> triggereds = new ArrayList<TriggeredAbility>();
   for (TriggeredAbility ability : triggered) {
     if (ability.getControllerId().equals(controllerId)) {
       triggereds.add(ability);
     }
   }
   return triggereds;
 }
示例#3
0
 @Override
 public boolean triggerAbility(TriggeredAbility source, Game game) {
   if (source != null && source.canChooseTarget(game)) {
     Ability ability;
     List<Ability> options = getPlayableOptions(source, game);
     if (options.isEmpty()) {
       ability = source;
     } else {
       if (options.size() == 1) ability = options.get(0);
       else ability = options.get(rnd.nextInt(options.size()));
     }
     if (ability.isUsesStack()) {
       game.getStack().push(new StackAbility(ability, playerId));
       if (ability.activate(game, false)) {
         actionCount++;
         return true;
       }
     } else {
       if (ability.activate(game, false)) {
         ability.resolve(game);
         actionCount++;
         return true;
       }
     }
   }
   return false;
 }
示例#4
0
  public BleakCovenVampires(UUID ownerId, CardSetInfo setInfo) {
    super(ownerId, setInfo, new CardType[] {CardType.CREATURE}, "{3}{B}{B}");
    this.subtype.add("Vampire");
    this.subtype.add("Warrior");

    this.power = new MageInt(4);
    this.toughness = new MageInt(3);

    TriggeredAbility ability =
        new EntersBattlefieldTriggeredAbility(new LoseLifeTargetEffect(4), false);
    ability.addEffect(new GainLifeEffect(4));
    Target target = new TargetPlayer();
    ability.addTarget(target);

    this.addAbility(
        new ConditionalTriggeredAbility(ability, MetalcraftCondition.getInstance(), effectText));
  }
示例#5
0
 public GameState(final GameState state) {
   this.players = state.players.copy();
   this.playerList = state.playerList.copy();
   this.activePlayerId = state.activePlayerId;
   this.priorityPlayerId = state.priorityPlayerId;
   this.turn = state.turn.copy();
   this.stack = state.stack.copy();
   this.command = state.command.copy();
   this.exile = state.exile.copy();
   this.revealed = state.revealed.copy();
   this.lookedAt.putAll(state.lookedAt);
   this.battlefield = state.battlefield.copy();
   this.turnNum = state.turnNum;
   this.extraTurn = state.extraTurn;
   this.legendaryRuleActive = state.legendaryRuleActive;
   this.gameOver = state.gameOver;
   this.effects = state.effects.copy();
   for (TriggeredAbility trigger : state.triggered) {
     this.triggered.add(trigger.copy());
   }
   this.triggers = state.triggers.copy();
   this.delayed = state.delayed.copy();
   this.specialActions = state.specialActions.copy();
   this.combat = state.combat.copy();
   this.turnMods = state.turnMods.copy();
   this.watchers = state.watchers.copy();
   for (Map.Entry<String, Object> entry : state.values.entrySet()) {
     if (entry.getValue()
         instanceof
         Boolean) { // AI changed values of Boolean for cards like Wall of Roots TODO: copy other
       // types than Boolean
       this.values.put(entry.getKey(), Boolean.valueOf(((Boolean) entry.getValue()).toString()));
     } else {
       this.values.put(entry.getKey(), entry.getValue());
     }
   }
   this.zones.putAll(state.zones);
   for (Map.Entry<UUID, Abilities<ActivatedAbility>> entry : state.otherAbilities.entrySet()) {
     otherAbilities.put(entry.getKey(), entry.getValue().copy());
   }
   this.paused = state.paused;
 }
示例#6
0
  public Showstopper(UUID ownerId) {
    super(
        ownerId,
        102,
        "Showstopper",
        Rarity.UNCOMMON,
        new CardType[] {CardType.INSTANT},
        "{1}{B}{R}");
    this.expansionSetCode = "DGM";
    this.color.setBlack(true);
    this.color.setRed(true);

    // Until end of turn, creatures you control gain "When this creature dies, it deals 2 damage to
    // target creature an opponent controls."
    TriggeredAbility ability = new DiesTriggeredAbility(new DamageTargetEffect(2), false);
    Target target = new TargetCreaturePermanent(filter2);
    ability.addTarget(target);
    Effect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, filter);
    effect.setText(
        "Until end of turn, creatures you control gain \"When this creature dies, it deals 2 damage to target creature an opponent controls.\" ");
    this.getSpellAbility().addEffect(effect);
  }
示例#7
0
  public TriumphOfCruelty(UUID ownerId) {
    super(
        ownerId,
        122,
        "Triumph of Cruelty",
        Rarity.UNCOMMON,
        new CardType[] {CardType.ENCHANTMENT},
        "{2}{B}");
    this.expansionSetCode = "AVR";

    this.color.setBlack(true);

    // At the beginning of your upkeep, target opponent discards a card if you control the creature
    // with the greatest power or tied for the greatest power.
    TriggeredAbility ability =
        new BeginningOfUpkeepTriggeredAbility(
            new DiscardTargetEffect(1), Constants.TargetController.YOU, false);
    Target target = new TargetOpponent();
    target.setRequired(true);
    ability.addTarget(target);
    this.addAbility(
        new ConditionalTriggeredAbility(
            ability, ControlsBiggestOrTiedCreatureCondition.getInstance(), ruleText));
  }
示例#8
0
 @Override
 public boolean triggerAbility(TriggeredAbility source, Game game) {
   Ability ability = source.copy();
   List<Ability> options = getPlayableOptions(ability, game);
   if (options.isEmpty()) {
     if (logger.isDebugEnabled()) logger.debug("simulating -- triggered ability:" + ability);
     game.getStack().push(new StackAbility(ability, playerId));
     ability.activate(game, false);
     game.applyEffects();
     game.getPlayers().resetPassed();
   } else {
     SimulationNode parent = (SimulationNode) game.getCustomData();
     if (parent.getDepth() == maxDepth) return true;
     logger.debug(
         indent(parent.getDepth())
             + "simulating -- triggered ability - adding children:"
             + options.size());
     for (Ability option : options) {
       addAbilityNode(parent, option, game);
     }
   }
   return true;
 }