Page 1 of 1

Implementing Annihilator from Eldrazi...

PostPosted: 21 Apr 2010, 17:58
by slapshot5
Has anyone given thought to implementing Annihilator from Rise of the Eldrazi?

The basics are pretty simple.

cards.txt can look something like this:
Code: Select all
Ulamog's Crusher
8
Creature Eldrazi
no text
8/8
This card attacks each turn if able.
Annihilator:2
And add something like this to the end of CardFactory_Creatures.java:
Code: Select all
if(hasKeyword(card, "Annihilator") != -1) {
           int n = hasKeyword(card, "Annihilator");
           if(n != -1) {
                String parse = card.getKeyword().get(n).toString();
                card.removeIntrinsicKeyword(parse);
               
                String l[] = parse.split(":");
                final int annihilator = Integer.parseInt(l[1]);
                card.setAnnihilator(annihilator);
            }
        }//annihilator
Along with some basic functions in Card.java:
Code: Select all
public boolean hasAnnihilator();
public void setAnnihilator();
public int getAnnihilator();
CardDetailPanel.java:
Code: Select all
        if(!faceDown && card.hasAnnihilator()) {
           area.append("Annihilator "+card.getAnnihilator());
        }
But, I don't know the Combat/Input code well enough to be able to ask for Input of X targets to sacrifice after attackers are declared. The correct spot seems to be around the beginning of Input_Attack.selectButtonOK(). (Then, you need to take into account the Planeswalker attack yet too; and also the AI attack...)

Anyone given this any thought?

-slapshot5

PS - I think some tweaks will be necessary in order to add Eldrazi Conscription, which gives Annihilator. Or maybe that can all be done in the Enchant/Unenchant code. I haven't thought about that yet.

Re: Implementing Annihilator from Eldrazi...

PostPosted: 21 Apr 2010, 19:36
by DennisBergkamp
I've been thinking about this too... probably the best way of doing this is to skip the check at the end of CardFactory_Creatures, and to just check and execute the Annihilator ability as the attack triggers happen for each creature that's attacking and has "Annihilator {number}". This would also make cards like Eldrazi Conscription easier, because you could "dynamically" assign the keyword. Currently attack triggers happen in CombatUtil.java in the checkDeclareAttackers() method, this is where the check and parse would happen, and an "Annihilator ability" would be executed for each attacking creature that has annihilator. (EDIT: you won't have to take into account Planeswalker attackers, since all attackers including Pw attackers get checked in checkDeclareAttackers(), right after attackers are declared, right before blockers are declared)

The input stuff might be a bit tricky though, and like you said, I'm not sure 100% either if they will stack correctly. We might have to resort to selecting permanents to sacrifice through one of those "AllZone.Display.getChoiceOptional" lists, but I don't know. I guess the answer is to just try and see if it works.