Debt of Loyalty
Posted: 10 Jul 2016, 18:22
Hi, I'm trying to implement Debt of Loyalty
I thought the best way to implement its effect would be to subclass RegenerateTargetEffect. The regeneration still works in my subclass but the take control part doesn't seem to be functional. Is there something obvious that I'm missing?
I thought the best way to implement its effect would be to subclass RegenerateTargetEffect. The regeneration still works in my subclass but the take control part doesn't seem to be functional. Is there something obvious that I'm missing?
- Code: Select all
class DebtOfLoyaltyEffect extends RegenerateTargetEffect {
public DebtOfLoyaltyEffect ( ) {
super();
this.staticText = "Regenerate target creature. You gain control of that creature if it regenerates this way.";
}
public DebtOfLoyaltyEffect(final DebtOfLoyaltyEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (super.apply(game, source) && permanent != null) {
GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
effect.setTargetPointer(targetPointer);
game.addEffect(effect, source);
return true;
}
return false;
}
}
- More Code | Open