* Regeneration abilities - added card hint about activated and used regeneration;

This commit is contained in:
Oleg Agafonov 2020-08-01 21:29:08 +04:00
parent 4ba7c18d43
commit c7595ca476
15 changed files with 244 additions and 87 deletions

View file

@ -1,8 +1,5 @@
package mage.abilities.effects.common;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.AttachmentType;
@ -12,6 +9,9 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.Locale;
import java.util.UUID;
/**
* @author jeff
*/
@ -37,13 +37,29 @@ public class RegenerateAttachedEffect extends ReplacementEffectImpl {
return false;
}
Permanent equipped = game.getPermanent(permanent.getAttachedTo());
if (equipped != null && equipped.regenerate(this.getId(), game)) {
if (equipped != null && equipped.regenerate(source, game)) {
this.used = true;
return true;
}
return false;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
return;
}
Permanent equipped = game.getPermanent(permanent.getAttachedTo());
if (equipped == null) {
return;
}
RegenerateSourceEffect.initRegenerationInfoWhileAttached(game, source, equipped.getId());
}
@Override
public RegenerateAttachedEffect copy() {
return new RegenerateAttachedEffect(this);