Dross Golem

This card is the perfect example for the implementation of the affinity ability.

Let's start by looking at this card code :

<?xml version="1.0"?>
<card xmlns="http://sourceforge.net/projects/firemox"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://sourceforge.net/projects/firemox ../../validator.xsd"
 name="Dross Golem">
 <rules-author-comment></rules-author-comment>
 <init>
  <registers>
   <register index="colorless" value="5" />
   <register index="power" value="3" />
   <register index="toughness" value="2" />
  </registers>
  <colors></colors>
  <idcards>creature artifact</idcards>
  <properties>fear golem</properties>
 </init>
 <abilities>
  <ability ref="cast-spell">
   <actions>
    <action ref="affinity">
     <counter-test>
      <has-idcard idcard="swamp" />
     </counter-test>
    </action>
   </actions>
  </ability>
 </abilities>
</card>