mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
[DSK] Implement Unable to Scream (#13234)
* Introduced LoseAllAbilitiesAttachedEffect * Added unit tests for Unable to Scream
This commit is contained in:
parent
02599fbaa4
commit
0bcf5f9e03
4 changed files with 301 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author markort147
|
||||
*/
|
||||
public class LoseAllAbilitiesAttachedEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected AttachmentType attachmentType;
|
||||
|
||||
public LoseAllAbilitiesAttachedEffect(AttachmentType attachmentType) {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility);
|
||||
this.attachmentType = attachmentType;
|
||||
setText();
|
||||
}
|
||||
|
||||
protected LoseAllAbilitiesAttachedEffect(final LoseAllAbilitiesAttachedEffect effect) {
|
||||
super(effect);
|
||||
this.attachmentType = effect.attachmentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoseAllAbilitiesAttachedEffect copy() {
|
||||
return new LoseAllAbilitiesAttachedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
Permanent creature = game.getPermanent(equipment.getAttachedTo());
|
||||
if (creature != null) {
|
||||
creature.removeAllAbilities(source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
staticText = attachmentType.verb() + " creature loses all abilities";
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue