Package mage.game.permanent

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


                if (manaCosts.pay(source, game, source.getSourceId(), controller.getId(), false)) {
                    int amount = creature.getPower().getValue();
                    UUID target = source.getTargets().getFirstTarget();
                    Permanent targetCreature = game.getPermanent(target);
                    if (targetCreature != null) {
                        targetCreature.damage(amount, creature.getId(), game, false, true);
                    } else {
                        Player player = game.getPlayer(target);
                        if (player != null) {
                            player.damage(amount, creature.getId(), game, false, true);
                        }
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
        if (permanent != null && sourceId != null) {
            permanent.damage(2, sourceId, game, false, true);
            return true;
        }
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null && sourceId != null) {
            player.damage(2, sourceId, game, false, true);
View Full Code Here

        if (sourceCreature != null && targetCreature != null
                && sourceCreature.getCardType().contains(CardType.CREATURE)
                && targetCreature.getCardType().contains(CardType.CREATURE)) {
            targetCreature.damage(sourceCreature.getPower().getValue(), sourceCreature.getId(), game, false, true);
            if (sourceOnBattlefield) {
                sourceCreature.damage(targetCreature.getPower().getValue(), targetCreature.getId(), game, false, true);
            }
            return true;
        }
        return false;
    }
View Full Code Here

                targetId = targets.get(rnd.nextInt(targets.size()));
                amount = rnd.nextInt(damage + 1);
            }
            Permanent permanent = game.getPermanent(targetId);
            if (permanent != null) {
                permanent.damage(amount, sourceId, game, false, true);
                remainingDamage -= amount;
            }
            else {
                Player player = game.getPlayer(targetId);
                if (player != null) {
View Full Code Here

                Permanent creature2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());
                // 20110930 - 701.10
                if (creature1 != null && creature2 != null) {
                    if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) {
                        creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, false, true);
                        creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true);
                        return true;
                    }
                }
            }
            game.informPlayers(card.getName() + " has been fizzled.");
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (permanent != null) {
            permanent.damage(amount, source.getSourceId(), game, false, true);
            return true;
        }
        return false;
    }
   
View Full Code Here

                defender.markDamage(amount, attacker.getId(), game, true, true);
            }
        }
        else {
            Player defender = game.getPlayer(defenderId);
            defender.damage(amount, attacker.getId(), game, true, true);
        }
    }

    public boolean canBlock(Permanent blocker, Game game) {
        // player can't block if another player is attacked
View Full Code Here

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

        if (player != null) {
            player.damage(1, source.getSourceId(), game, false, true);
        }
        Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
        if (creature != null) {
            creature.damage(1, source.getSourceId(), game, false, true);
            ContinuousEffect effect = new CantBlockTargetEffect(Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(creature.getId()));
            game.addEffect(effect, source);
        }
        return true;
View Full Code Here

        if (source.getTargets().size() > 1) {
            for (Target target : source.getTargets()) {
                for (UUID targetId : target.getTargets()) {
                    Permanent permanent = game.getPermanent(targetId);
                    if (permanent != null) {
                        permanent.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable);
                    }
                    Player player = game.getPlayer(targetId);
                    if (player != null) {
                        player.damage(amount.calculate(game, source, this), source.getSourceId(), game, false, preventable);
                    }
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.