forked from External/mage
* [WOE] Implement Embereth Veteran * add SBA for role tokens * [WOE] Implement Cursed Courtier * [WOE] Implement Conceited Witch * [WOE] Implement Besotted Knight * [WOE] Implement Syr Armont, the Redeemer * [WOE] Implement Living Lectern * add role test * [WOE] Implement Lord Skitter's Blessing * [WOE] Implement Faunsbane Troll * [WOE] Implement Twisted Fealty * [WOC] Implement Ellivere of the Wild Court * [WOE] Implement Monstrous Rage * [WOE] Implement Spellbook Vendor * add verify skips * extra fix
50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
package mage.abilities.effects.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.Mode;
|
|
import mage.abilities.effects.OneShotEffect;
|
|
import mage.constants.Outcome;
|
|
import mage.constants.RoleType;
|
|
import mage.game.Game;
|
|
import mage.game.permanent.Permanent;
|
|
|
|
/**
|
|
* @author TheElk801
|
|
*/
|
|
public class CreateRoleAttachedSourceEffect extends OneShotEffect {
|
|
|
|
private final RoleType roleType;
|
|
|
|
public CreateRoleAttachedSourceEffect(RoleType roleType) {
|
|
super(Outcome.Benefit);
|
|
this.roleType = roleType;
|
|
}
|
|
|
|
private CreateRoleAttachedSourceEffect(final CreateRoleAttachedSourceEffect effect) {
|
|
super(effect);
|
|
this.roleType = effect.roleType;
|
|
}
|
|
|
|
@Override
|
|
public CreateRoleAttachedSourceEffect copy() {
|
|
return new CreateRoleAttachedSourceEffect(this);
|
|
}
|
|
|
|
@Override
|
|
public boolean apply(Game game, Ability source) {
|
|
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
|
if (permanent == null) {
|
|
return false;
|
|
}
|
|
roleType.createToken(permanent, game, source);
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String getText(Mode mode) {
|
|
if (staticText != null && !staticText.isEmpty()) {
|
|
return staticText;
|
|
}
|
|
return "create a " + roleType.getName() + " Role token attached to it";
|
|
}
|
|
}
|