// When Illusions of Grandeur enters the battlefield, you gain 20 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(20)));
// When Illusions of Grandeur leaves the battlefield, you lose 20 life.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new LoseLifeSourceControllerEffect(20), false));
}