mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
[WOC] Implement Timber Paladin (#11025)
* updated condition to allow different comparisons and to allow filtering for auras * implemented Timber Paladin * fixed text
This commit is contained in:
parent
7a93681112
commit
6532ca9f66
3 changed files with 92 additions and 5 deletions
|
|
@ -2,8 +2,11 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -14,13 +17,21 @@ import mage.game.permanent.Permanent;
|
|||
public class EnchantedSourceCondition implements Condition {
|
||||
|
||||
private int numberOfEnchantments;
|
||||
private ComparisonType comparisonType;
|
||||
private boolean aurasOnly;
|
||||
|
||||
public EnchantedSourceCondition() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
public EnchantedSourceCondition(int numberOfEnchantments) {
|
||||
this(numberOfEnchantments, ComparisonType.OR_GREATER, false);
|
||||
}
|
||||
|
||||
public EnchantedSourceCondition(int numberOfEnchantments, ComparisonType comparisonType, boolean aurasOnly) {
|
||||
this.numberOfEnchantments = numberOfEnchantments;
|
||||
this.comparisonType = comparisonType;
|
||||
this.aurasOnly = aurasOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -30,14 +41,12 @@ public class EnchantedSourceCondition implements Condition {
|
|||
if (permanent != null) {
|
||||
for (UUID uuid : permanent.getAttachments()) {
|
||||
Permanent attached = game.getBattlefield().getPermanent(uuid);
|
||||
if (attached != null && attached.isEnchantment(game)) {
|
||||
if (++numberOfFoundEnchantments >= numberOfEnchantments) {
|
||||
return true;
|
||||
}
|
||||
if (attached != null && attached.isEnchantment(game) && (!aurasOnly || attached.hasSubtype(SubType.AURA, game))) {
|
||||
numberOfFoundEnchantments += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (numberOfFoundEnchantments >= numberOfEnchantments);
|
||||
return ComparisonType.compare(numberOfFoundEnchantments, comparisonType, numberOfEnchantments);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue