mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 23:12:10 -08:00
Equipped condition. [SOM] Sunspear Shikari.
This commit is contained in:
parent
0a0f9deb26
commit
84a152fea3
2 changed files with 122 additions and 0 deletions
39
Mage/src/mage/abilities/condition/common/Equipped.java
Normal file
39
Mage/src/mage/abilities/condition/common/Equipped.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Describes condition when creature is equipped.
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class Equipped implements Condition {
|
||||
|
||||
private static Equipped fInstance = new Equipped();
|
||||
|
||||
public static Condition getInstance() {
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
for (UUID uuid : permanent.getAttachments()) {
|
||||
Permanent attached = game.getBattlefield().getPermanent(uuid);
|
||||
if (attached.getSubtype().contains("Equipment")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue