mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Fixed Urborg's functionality, also fixed Scarwood Hag not removing forestwalk properly (#4088)
This commit is contained in:
parent
71336a916d
commit
1453fa46a7
2 changed files with 58 additions and 5 deletions
|
|
@ -27,7 +27,9 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.Iterator;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.MageSingleton;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
|
|
@ -69,8 +71,17 @@ public class LoseAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
while (permanent.getAbilities().contains(ability)) {
|
||||
permanent.getAbilities().remove(ability);
|
||||
if (ability instanceof MageSingleton) {
|
||||
while (permanent.getAbilities().contains(ability)) {
|
||||
permanent.getAbilities().remove(ability);
|
||||
}
|
||||
} else {
|
||||
for (Iterator<Ability> iter = permanent.getAbilities().iterator(); iter.hasNext();) {
|
||||
Ability ab = iter.next();
|
||||
if (ab.getClass().equals(ability.getClass())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue