mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 21:42:07 -08:00
34 lines
772 B
Java
34 lines
772 B
Java
|
|
package mage.util.functions;
|
|
|
|
import java.util.UUID;
|
|
import mage.MageObject;
|
|
import mage.abilities.Ability;
|
|
import mage.game.Game;
|
|
import mage.game.permanent.Permanent;
|
|
|
|
/**
|
|
*
|
|
* @author LevelX2
|
|
*/
|
|
public class AbilityApplier extends ApplyToPermanent {
|
|
|
|
private final Ability ability;
|
|
|
|
public AbilityApplier(Ability ability) {
|
|
this.ability = ability;
|
|
}
|
|
|
|
@Override
|
|
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
|
permanent.addAbility(ability, source.getSourceId(), game);
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
|
mageObject.getAbilities().add(ability);
|
|
return true;
|
|
}
|
|
|
|
}
|