Source:
<code>public RinAndSeriInseparable(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.DOG); this.subtype.add(SubType.CAT); this.power = new MageInt(4); this.toughness = new MageInt(4); this.addAbility(new SpellCastControllerTriggeredAbility( new CreateTokenEffect(new CatToken3()), dogSpellFilter, false )); this.addAbility(new SpellCastControllerTriggeredAbility( new CreateTokenEffect(new DogToken2()), catSpellFilter, false )); Effect damageEffect = new DamageTargetEffect(new DynamicValue() { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { return game.getBattlefield().count(dogPermanentFilter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); } @Override public DynamicValue copy() { return this; } @Override public String getMessage() { return "Dogs you control"; } }); damageEffect.setText("{source} deals damage to any target equal to the number of Dogs you control"); Effect lifeGainEffect = new GainLifeEffect(new DynamicValue() { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { return game.getBattlefield().count(catPermanentFilter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); } @Override public DynamicValue copy() { return this; } @Override public String getMessage() { return "Cats you control"; } }); lifeGainEffect.setText("You gain life equal to the number of Cats you control."); Ability ability = new SimpleActivatedAbility(damageEffect, new ManaCostsImpl("{R}{G}{W}")); ability.addTarget(new TargetAnyTarget()); <START> ability.addEffect(lifeGainEffect); <END> this.addAbility(ability); }</code><technical_language>Try xmage's standard order code: ability -> effect -> target (that's order in cases)</technical_language>

Target:
public RinAndSeriInseparable(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.DOG); this.subtype.add(SubType.CAT); this.power = new MageInt(4); this.toughness = new MageInt(4); this.addAbility(new SpellCastControllerTriggeredAbility( new CreateTokenEffect(new GreenCatToken()), dogSpellFilter, false )); this.addAbility(new SpellCastControllerTriggeredAbility( new CreateTokenEffect(new WhiteDogToken()), catSpellFilter, false )); DynamicValue dogCount = new PermanentsOnBattlefieldCount(dogPermanentFilter); Effect damageEffect = new DamageTargetEffect(dogCount); damageEffect.setText("{source} deals damage to any target equal to the number of Dogs you control"); DynamicValue catCount = new PermanentsOnBattlefieldCount(catPermanentFilter); Effect lifeGainEffect = new GainLifeEffect(catCount); lifeGainEffect.setText("You gain life equal to the number of Cats you control"); Ability ability = new SimpleActivatedAbility(damageEffect, new ManaCostsImpl("{R}{G}{W}")); ability.addEffect(lifeGainEffect); ability.addTarget(new TargetAnyTarget()); ability.addHint(new ValueHint("Dogs you control", dogCount)); ability.addHint(new ValueHint("Cats you control", catCount)); this.addAbility(ability); }