forked from External/mage
* Regeneration abilities - added card hint about activated and used regeneration;
This commit is contained in:
parent
4ba7c18d43
commit
c7595ca476
15 changed files with 244 additions and 87 deletions
|
|
@ -0,0 +1,33 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Source must be attached to permanent
|
||||
*
|
||||
* @author JayDi85
|
||||
*/
|
||||
public class AttachedToPermanentCondition implements Condition {
|
||||
|
||||
final UUID permanentId;
|
||||
|
||||
public AttachedToPermanentCondition(UUID permanentId) {
|
||||
this.permanentId = permanentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent attachment = game.getPermanent(source.getSourceId());
|
||||
Permanent permanent = game.getPermanent(this.permanentId);
|
||||
if (attachment != null && permanent != null) {
|
||||
return permanent.getAttachments().contains(attachment.getId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue