Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new GenericManaCost(2));
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
// {2}: Prevent all combat damage that would be dealt to
Effect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, true);
effect.setText("Prevent all combat damage that would be dealt to");
// and dealt by target creature you control this turn.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}"));
effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true);
effect.setText("and dealt by target creature you control this turn.");
ability.addEffect(effect);
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}