It is currently 02 May 2024, 01:06
   
Text Size

Implementing Annihilator from Eldrazi...

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Implementing Annihilator from Eldrazi...

Postby slapshot5 » 21 Apr 2010, 17:58

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.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Implementing Annihilator from Eldrazi...

Postby DennisBergkamp » 21 Apr 2010, 19:36

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.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 56 guests


Who is online

In total there are 56 users online :: 0 registered, 0 hidden and 56 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 56 guests

Login Form