forked from External/mage
* Arachnuns Web - Fixed condition handling. Some renaming.
This commit is contained in:
parent
105ef6e571
commit
1b2636d0cd
26 changed files with 95 additions and 113 deletions
|
|
@ -34,17 +34,16 @@ import mage.filter.FilterPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
||||
/**
|
||||
* Describes condition when equipped permanent has superType
|
||||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class EquippedMatchesFilterCondition implements Condition {
|
||||
public class AttachedToMatchesFilterCondition implements Condition {
|
||||
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public EquippedMatchesFilterCondition(FilterPermanent filter) {
|
||||
public AttachedToMatchesFilterCondition(FilterPermanent filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +56,7 @@ public class EquippedMatchesFilterCondition implements Condition {
|
|||
attachedTo = (Permanent) game.getLastKnownInformation(permanent.getAttachedTo(), Zone.BATTLEFIELD);
|
||||
}
|
||||
if (attachedTo != null) {
|
||||
if (filter.match(attachedTo, attachedTo.getId(),attachedTo.getControllerId(), game)) {
|
||||
if (filter.match(attachedTo, attachedTo.getId(), attachedTo.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -65,4 +64,10 @@ public class EquippedMatchesFilterCondition implements Condition {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return filter.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -40,13 +39,11 @@ import mage.game.permanent.Permanent;
|
|||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
|
||||
|
||||
public class EnchantedCreatureSubtypeCondition implements Condition {
|
||||
|
||||
private final FilterPermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
public EnchantedCreatureSubtypeCondition(String string){
|
||||
public EnchantedCreatureSubtypeCondition(String string) {
|
||||
filter.add(new SubtypePredicate(string));
|
||||
}
|
||||
|
||||
|
|
@ -56,11 +53,17 @@ public class EnchantedCreatureSubtypeCondition implements Condition {
|
|||
if (enchantment != null) {
|
||||
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (creature != null) {
|
||||
if(filter.match(creature, source.getSourceId(), enchantment.getControllerId(), game)){
|
||||
if (filter.match(creature, source.getSourceId(), enchantment.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return filter.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue