It is currently 16 Apr 2021, 02:42
   
Text Size

Megrim

Moderators: timmermac, friarsol, Blacksmith, KrazyTheFox, Agetian, 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: No registered users and 15 guests


Who is online

In total there are 15 users online :: 0 registered, 0 hidden and 15 guests (based on users active over the past 10 minutes)
Most users ever online was 1371 on 09 Feb 2020, 16:22

Users browsing this forum: No registered users and 15 guests

Login Form