Package mage.abilities

Examples of mage.abilities.Ability


  @Override
  public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    DamageEvent damageEvent = (DamageEvent)event;
    Permanent permanent = game.getPermanent(redirectTarget.getFirstTarget());
    Ability damageSource = getSource(damageEvent.getSourceId(), game);
    if (permanent != null) {
      permanent.damage(damageEvent.getAmount(), damageSource.getId(), game, damageEvent.isPreventable(), damageEvent.isCombatDamage());
      return true;
    }
    Player player = game.getPlayer(redirectTarget.getFirstTarget());
    if (player != null) {
      player.damage(damageEvent.getAmount(), damageSource.getId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
      return true;
    }
    return false;
  }
View Full Code Here


    return sb.toString();
  }

  @Override
  public void addAbility(Ability ability) {
    Ability copy = ability.copy();
    copy.setControllerId(controllerId);
    copy.setSourceId(objectId);
    abilities.add(copy);
  }
View Full Code Here

    if (card != null) {
      if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getId(), playerId))) {
        game.bookmarkState();
        removeFromHand(card, game);
        card.moveToZone(Zone.STACK, ability.getId(), game, false);
        Ability spellAbility = game.getStack().getSpell(ability.getId()).getSpellAbility();
        if (spellAbility.activate(game, noMana)) {
          for (KickerAbility kicker: card.getAbilities().getKickerAbilities()) {
            kicker.activate(game, false);
          }
          game.fireEvent(GameEvent.getEvent(GameEvent.EventType.SPELL_CAST, spellAbility.getId(), playerId));
          game.fireInformEvent(name + " casts " + card.getName());
          game.removeLastBookmark();
          return true;
        }
        game.restoreState();
View Full Code Here

    return options;
  }

  private void addTargetOptions(List<Ability> options, Ability option, int targetNum, Game game) {
    for (UUID targetId: option.getTargets().getUnchosen().get(targetNum).possibleTargets(option.getSourceId(), playerId, game)) {
      Ability newOption = option.copy();
      newOption.getTargets().get(targetNum).addTarget(targetId, option, game);
      if (targetNum < option.getTargets().size() - 1) {
        addTargetOptions(options, newOption, targetNum + 1, game);
      }
      else {
        if (option.getChoices().size() > 0)
View Full Code Here

    }
  }

  private void addChoiceOptions(List<Ability> options, Ability option, int choiceNum, Game game) {
    for (String choice: option.getChoices().get(choiceNum).getChoices()) {
      Ability newOption = option.copy();
      newOption.getChoices().get(choiceNum).setChoice(choice);
      if (choiceNum < option.getChoices().size() - 1) {
        addChoiceOptions(options, newOption, choiceNum + 1, game);
      }
      else {
        if (option.getCosts().getTargets().size() > 0)
View Full Code Here

    }
  }

  private void addCostTargetOptions(List<Ability> options, Ability option, int targetNum, Game game) {
    for (UUID targetId: option.getCosts().getTargets().get(targetNum).possibleTargets(option.getSourceId(), playerId, game)) {
      Ability newOption = option.copy();
      newOption.getCosts().getTargets().get(targetNum).addTarget(targetId, option, game);
      if (targetNum < option.getCosts().getTargets().size() - 1) {
        addCostTargetOptions(options, newOption, targetNum + 1, game);
      }
      else {
        options.add(newOption);
View Full Code Here

  }

  @Override
  public void addEffect(ContinuousEffect continuousEffect, Ability source) {
    ContinuousEffect newEffect = (ContinuousEffect)continuousEffect.copy();
    Ability newAbility = source.copy();
    newEffect.newId();
    newEffect.setTimestamp();
    newEffect.init(newAbility, this);
    state.addEffect(newEffect, newAbility);
  }
View Full Code Here

        this.subtype.add("Vampire");
        this.subtype.add("Rogue");
        this.color.setBlack(true);
        this.power = new MageInt(2);
        this.toughness = new MageInt(2);
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl(""));
        ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
        this.addAbility(ability);
    }
View Full Code Here

    this.color.setWhite(true);
    this.power = new MageInt(7);
    this.toughness = new MageInt(7);

    this.addAbility(FlyingAbility.getInstance());
    Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new VengefulArchonEffect(), new ManaCostsImpl("{X}"));
    ability.addTarget(new TargetPlayer());
    this.addAbility(ability);
  }
View Full Code Here

    this.subtype.add("Aura");

    TargetPermanent auraTarget = new TargetCreaturePermanent();
    this.getSpellAbility().addTarget(auraTarget);
    this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
    Ability ability = new EnchantAbility(auraTarget.getTargetName());
    this.addAbility(ability);
    this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ArmoredAscensionEffect()));

  }
View Full Code Here

TOP

Related Classes of mage.abilities.Ability

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.