It is currently 19 Apr 2024, 21:47
   
Text Size

Megrim

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

Megrim

Postby jpb » 30 Sep 2008, 19:32

Here is Megrim. Replace the current discard method with this in GameAction.java

Code: Select all
  public void discard(Card c)
  {
   //check for megrim
   discard_megrim(c);
    moveToGraveyard(c);
  }
 
  public void discard_megrim(Card c)
  {
    //Whenever an opponent discards a card, Megrim deals 2 damage to that player.
   //when a card is discarded, deal 2 damage to that player for each Megrim in play controlled by the opponent.
   final String owner = c.getOwner();
   final String opponent = AllZone.GameAction.getOpponent(owner);
    PlayerZone opponentZone = AllZone.getZone(Constant.Zone.Play,opponent);
   CardList opponentList = new CardList(opponentZone.getCards());
   
   //remove 2 life for each Megrim the opponent controls.
   for(int i=0;i<opponentList.size();i++){
     Card tmpCard = opponentList.get(i);
     if(tmpCard.getName().equals("Megrim")){
      AllZone.GameAction.getPlayerLife(owner).subtractLife(2);
     }
   }
  }
Add this to cards.txt

Code: Select all
Megrim
2 B
Enchantment
Whenever an opponent discards a card, Megrim deals 2 damage to that player.
The computer can play this, however it may play discard spells costing 2B, like Coercion, before playing Megrim, which is not the best strategy. You will need the url to get the card image.
jpb
 
Posts: 132
Joined: 05 Sep 2008, 13:12
Has thanked: 0 time
Been thanked: 0 time

Re: Megrim

Postby DennisBergkamp » 01 Oct 2008, 17:23

Very cool, I love Megrim :)
Nice to see how some of the more static cards are programmed, by the way.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time


Return to Forge

Who is online

Users browsing this forum: Google [Bot] and 168 guests


Who is online

In total there are 169 users online :: 1 registered, 0 hidden and 168 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: Google [Bot] and 168 guests

Login Form