mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 21:42:07 -08:00
[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:
parent
3c8ad2a664
commit
9165cab00a
8 changed files with 108 additions and 156 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue