Package mage.game.permanent

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


    public boolean apply(Game game, Ability source) {
        int amount = (new GetXValue()).calculate(game, source, this) * 3;

        Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
        if (permanent != null) {
            permanent.damage(amount, source.getSourceId(), game, false, true);
            return true;
        }

        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null) {
View Full Code Here


            int damage = card.getManaCost().convertedManaCost();
            // assign damage to target
            for (UUID targetId: targetPointer.getTargets(game, source)) {
                Permanent targetedCreature = game.getPermanent(targetId);
                if (targetedCreature != null) {
                    targetedCreature.damage(damage, source.getSourceId(), game, false, true);
                }
                else {
                    Player targetedPlayer = game.getPlayer(targetId);
                    if (targetedPlayer != null) {
                        targetedPlayer.damage(damage, source.getSourceId(), game, false, true);
View Full Code Here

    public boolean apply(Game game, Ability source) {
        int amount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
        Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
        if(amount > 0) {  
            if (permanent != null) {
                permanent.damage(amount, source.getSourceId(), game, false, true);
                return true;
            }
        }
        return false;
    }
View Full Code Here

                        targetPlayer.damage(toPrevent, source.getSourceId(), game, false, true);
                        game.informPlayers(new StringBuilder("Acolyte's Reward ").append("deals ").append(toPrevent).append(" damage to ").append(targetPlayer.getName()).toString());
                    } else {
                        Permanent targetDamageCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
                        if (targetDamageCreature != null) {
                            targetDamageCreature.damage(toPrevent, source.getSourceId(), game, false, true);
                            game.informPlayers(new StringBuilder("Acolyte's Reward ").append("deals ").append(toPrevent).append(" damage to ").append(targetDamageCreature.getName()).toString());
                        }
                    }
                }
            }
View Full Code Here

        Permanent permanent = game.getPermanent(source.getFirstTarget());
        if (sourcePermanent == null) {
            sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
        }
        if (sourcePermanent != null && permanent != null) {
            permanent.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true);
            return true;
        }
        Player player = game.getPlayer(source.getFirstTarget());
        if (sourcePermanent != null && player != null) {
            player.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true);
View Full Code Here

                return true;
            }
        } else {
            Permanent targetPermanent = game.getPermanent(event.getTargetId());
            if (targetPermanent != null) {
                targetPermanent.damage(damageEvent.getAmount()*2, damageEvent.getSourceId(), game, damageEvent.isCombatDamage(), damageEvent.isPreventable(), event.getAppliedEffects());
                return true;
            }
        }
        return false;
    }
View Full Code Here

            Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
            if (permanent != null ) {
                if (permanent.getToughness().getValue() < amount) {
                    lifetogain = permanent.getToughness().getValue();
                }
                permanent.damage(amount, source.getSourceId(), game, false, true);
            } else {
                Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
                if (player != null) {
                    if (player.getLife() < amount) {
                        lifetogain = player.getLife();
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
        if (permanent != null) {
            permanent.damage(3, source.getSourceId(), game, false, true);
            if (permanent.getCardType().contains(CardType.ENCHANTMENT)) {
                Player targetController = game.getPlayer(permanent.getControllerId());
                if (targetController != null) {
                    targetController.damage(3, source.getSourceId(), 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) {
            int damage = permanent.getPower().getValue();
            permanent.damage(3, source.getSourceId(), game, false, true);
            if (damage > 0) {
                Permanent garruk = game.getPermanent(source.getSourceId());
                if (garruk != null) {
                    garruk.damage(damage, permanent.getId(), game, false, true);
                }
View Full Code Here

            int damage = permanent.getPower().getValue();
            permanent.damage(3, source.getSourceId(), game, false, true);
            if (damage > 0) {
                Permanent garruk = game.getPermanent(source.getSourceId());
                if (garruk != null) {
                    garruk.damage(damage, permanent.getId(), game, false, true);
                }
            }
            return true;
        }
        return false;
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.