// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Skullmane Baku.
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// {1}, Tap, Remove X ki counters from Quillmane Baku: Return target creature with converted mana cost X or less to its owner's hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new QuillmaneBakuReturnEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.KI.createInstance(1)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}