Package mage

Examples of mage.ObjectColor


    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.MANA_ADDED && event.getPlayerId().equals(controllerId)) {
            Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
            if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
                ObjectColor color = (ObjectColor) game.getState().getValue(this.sourceId + "_color");
                if (color != null && event.getData().contains(color.toString())) {
                    return true;
                }
            }
        }
        return false;
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
            if (color.isBlack()) {
                player.getManaPool().addMana(Mana.BlackMana, game, source);
            } else if (color.isBlue()) {
                player.getManaPool().addMana(Mana.BlueMana, game, source);
            } else if (color.isRed()) {
                player.getManaPool().addMana(Mana.RedMana, game, source);
            } else if (color.isGreen()) {
                player.getManaPool().addMana(Mana.GreenMana, game, source);
            } else if (color.isWhite()) {
                player.getManaPool().addMana(Mana.WhiteMana, game, source);
            }
        }
        return true;
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
            switch(color.toString()) {
                case "W":
                    player.getManaPool().addMana(Mana.WhiteMana, game, source);
                    break;
                case "B":
                    player.getManaPool().addMana(Mana.BlackMana, game, source);
View Full Code Here

            Permanent permanent = game.getPermanent(source.getSourceId());
            if (permanent != null) {
                String color = (String) game.getState().getValue(permanent.getId() + "_color");
                if (color != null) {
                    protectionFilter = new FilterPermanent(color);
                    protectionFilter.add(new ColorPredicate(new ObjectColor(color)));
                }
            }
        }
        if (protectionFilter != null) {
            for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
View Full Code Here

    }

    @Override
    public boolean apply(Game game, Ability source) {
        FilterPermanent filter = new FilterPermanent();
        ObjectColor color = ((ChoiceColor) source.getChoices().get(0)).getColor();
        if (color != null) {
            filter.add(new ColorPredicate(color));

            for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
                permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
View Full Code Here

        this.toughness = new MageInt(2);

        // Flanking
        this.addAbility(new FlankingAbility());
        // {2}: Blazing Blade Askari becomes colorless until end of turn.
        this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SetCardColorSourceEffect(new ObjectColor(""), Duration.EndOfTurn), new ManaCostsImpl("{2}")));
    }
View Full Code Here

        if(enchantment != null){
            Permanent land = game.getPermanent(enchantment.getAttachedTo());
            if(land != null){
                Player player = game.getPlayer(land.getControllerId());
                if (player != null) {
                    ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
                    switch(color.toString()) {
                        case "W":
                            player.getManaPool().addMana(Mana.WhiteMana, game, source);
                            break;
                        case "B":
                            player.getManaPool().addMana(Mana.BlackMana, game, source);
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
        if (target != null) {
            ObjectColor color = target.getColor();
            target.destroy(source.getSourceId(), game, false);
            for (Permanent p : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
                if (p.getColor().shares(color)) {
                    p.destroy(source.getSourceId(), game, false);
                }
View Full Code Here

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        Permanent curseOfWizardry = game.getPermanent(getSourceId());
        if (curseOfWizardry != null) {
            ObjectColor chosenColor = (ObjectColor) game.getState().getValue(curseOfWizardry.getId() + "_color");
            if (chosenColor != null) {
                if (event.getType() == GameEvent.EventType.SPELL_CAST) {
                    Spell spell = game.getStack().getSpell(event.getTargetId());
                    if (spell != null && spell.getColor().shares(chosenColor)) {
                        this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        if (you != null) {
            Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source));
            if (spell != null) {
                ObjectColor color1 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color1"));
                ObjectColor color2 = new ObjectColor((String) game.getState().getValue(source.getSourceId() + "_color2"));
                int amount = 0;
                if (spell.getColor().contains(color1)) {
                    ++amount;
                }
                if (spell.getColor().contains(color2)) {
View Full Code Here

TOP

Related Classes of mage.ObjectColor

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.