[DSK] Implement Unable to Scream (#13234)

* Introduced LoseAllAbilitiesAttachedEffect

* Added unit tests for Unable to Scream
This commit is contained in:
Marco Romano 2025-01-19 21:09:57 +00:00 committed by GitHub
parent 02599fbaa4
commit 0bcf5f9e03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 301 additions and 0 deletions

View file

@ -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";
}
}