[KHM] Implemented Draugr's Helm (#7393)

* [KHM] Implemented Draugr's Helm

* Implemented CreateTokenAttachSourceEffect and refactored existing cards to use it
This commit is contained in:
Daniel Bomar 2021-01-15 08:07:25 -06:00 committed by GitHub
parent 3c8ad2a664
commit 9165cab00a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 108 additions and 156 deletions

View file

@ -0,0 +1,39 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
/**
*
* @author weirddan455
*/
public class CreateTokenAttachSourceEffect extends CreateTokenEffect {
public CreateTokenAttachSourceEffect(Token token) {
super(token);
setText();
staticText = staticText.concat(", then attach {this} to it");
}
private CreateTokenAttachSourceEffect(final CreateTokenAttachSourceEffect effect) {
super(effect);
}
@Override
public CreateTokenAttachSourceEffect copy() {
return new CreateTokenAttachSourceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
super.apply(game, source);
Permanent token = game.getPermanent(this.getLastAddedTokenId());
if (token != null) {
token.addAttachment(source.getSourceId(), source, game);
return true;
}
return false;
}
}

View file

@ -111,7 +111,7 @@ public class CreateTokenEffect extends OneShotEffect {
}
}
private void setText() {
void setText() {
StringBuilder sb = new StringBuilder("create ");
if (amount.toString().equals("1")) {
sb.append("a ");