Examples of copy()


Examples of mage.MageObject.copy()

        }*/
        Map<UUID, MageObject> lkiMap = lki.get(zone);
        if (lkiMap != null) {
            MageObject object = lkiMap.get(objectId);
            if (object != null) {
                return object.copy();
            }
            for (MageObject mageObject:lkiMap.values()) {
                if (mageObject instanceof Spell) {
                    if (((Spell)mageObject).getCard().getId().equals(objectId)) {
                        return mageObject;
View Full Code Here

Examples of mage.abilities.costs.Cost.copy()

                splicedAbility.setSourceId(abilityToModify.getSourceId());
                spell.addSpellAbility(splicedAbility);
                for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) {
                    Cost cost = (Cost) it.next();
                    if (cost instanceof ManaCostsImpl) {
                        spell.getSpellAbility().getManaCostsToPay().add((ManaCostsImpl) cost.copy());
                    } else {
                        spell.getSpellAbility().getCosts().add(cost.copy());
                    }
                }
            }
View Full Code Here

Examples of mage.abilities.effects.ContinuousEffect.copy()

        if (controller != null && creature != null) {
            ContinuousEffect effect = new BoostTargetEffect(2,2,Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(creature.getId()));
            game.addEffect(effect, source);
            if (ClashEffect.getInstance().apply(game, source)) {
                game.addEffect(effect.copy(), source);
                effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
                effect.setTargetPointer(new FixedTarget(creature.getId()));
                game.addEffect(effect.copy(), source);
            }
            return true;
View Full Code Here

Examples of mage.abilities.effects.common.continious.BoostTargetEffect.copy()

        if (controller != null && creature != null) {
            ContinuousEffect effect = new BoostTargetEffect(2,2,Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(creature.getId()));
            game.addEffect(effect, source);
            if (ClashEffect.getInstance().apply(game, source)) {
                game.addEffect(effect.copy(), source);
                effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
                effect.setTargetPointer(new FixedTarget(creature.getId()));
                game.addEffect(effect.copy(), source);
            }
            return true;
View Full Code Here

Examples of mage.cards.Card.copy()

                for (UUID targetId: targets.get(0).getTargets()) {
                    Card card = player.getHand().get(targetId, game);
                    if (card == null) {
                        return false;
                    }
                    this.cards.add(card.copy());
                    paid |= player.discard(card, ability, game);
                }
            }
        }
        return paid;
View Full Code Here

Examples of mage.counters.Counter.copy()

        int amount = source.getManaCostsToPay().getX() + 1;
        Counter counter = CounterType.P1P1.createInstance(amount);
        for (UUID uuid : targetPointer.getTargets(game, source)) {
            Permanent permanent = game.getPermanent(uuid);
            if (permanent != null) {
                permanent.addCounters(counter.copy(), game);
                affectedTargets ++;
            }
        }
        return affectedTargets > 0;
    }
View Full Code Here

Examples of mage.game.ExileZone.copy()

    @Override
    public boolean apply(Game game, Ability source) {
        ExileZone exile = game.getExile().getExileZone(exileId);
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null && exile != null) {
            exile = exile.copy();
            for (UUID cardId : exile) {
                Card card = game.getCard(cardId);
                Player owner = game.getPlayer(card.getOwnerId());
                if (owner != null) {
                    switch (zone) {
View Full Code Here

Examples of mage.game.permanent.Permanent.copy()

    if (targets.choose(Outcome.Sacrifice, controllerId, game)) {
      for (UUID targetId: targets.get(0).getTargets()) {
        Permanent permanent = game.getPermanent(targetId);
        if (permanent == null)
          return false;
        permanents.add(permanent.copy());
        paid |= permanent.sacrifice(sourceId, game);
      }
    }
    return paid;
  }
View Full Code Here

Examples of mage.game.stack.StackObject.copy()

      if (effect != null && ability.getControllerId().equals(playerId)) {
        Target target = effect.getTarget();
        if (!target.doneChosing()) {
          for (UUID targetId: target.possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
            Game sim = game.copy();
            StackAbility newAbility = (StackAbility) ability.copy();
            SearchEffect newEffect = getSearchEffect((StackAbility) newAbility);
            newEffect.getTarget().addTarget(targetId, newAbility, sim);
            sim.getStack().push(newAbility);
            SimulationNode newNode = new SimulationNode(sim, depth, ability.getControllerId());
            node.children.add(newNode);
View Full Code Here

Examples of mekanism.api.gas.GasStack.copy()

  public void writeToNBT(NBTTagCompound nbtRoot) {
    super.writeToNBT(nbtRoot);
    GasStack gt = getGasType();
    if(GasUtil.isGasValid(gt)) {
      updateTank();
      gt = gt.copy();
      gt.amount = tank.getStored();
      nbtRoot.setTag("tank", gt.write(new NBTTagCompound()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.