mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
[SOI] Added Skulk Ability.
This commit is contained in:
parent
8afbfb57c7
commit
6321e39bcd
3 changed files with 74 additions and 13 deletions
|
|
@ -45,10 +45,10 @@ import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
*/
|
*/
|
||||||
public class GoldmeadowDodger extends CardImpl {
|
public class GoldmeadowDodger extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with power 4 or greater");
|
private static final FilterCreaturePermanent FILTER = new FilterCreaturePermanent("creatures with power 4 or greater");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 3));
|
FILTER.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GoldmeadowDodger(UUID ownerId) {
|
public GoldmeadowDodger(UUID ownerId) {
|
||||||
|
|
@ -60,7 +60,7 @@ public class GoldmeadowDodger extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// Goldmeadow Dodger can't be blocked by creatures with power 4 or greater.
|
// Goldmeadow Dodger can't be blocked by creatures with power 4 or greater.
|
||||||
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
|
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(FILTER, Duration.WhileOnBattlefield)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GoldmeadowDodger(final GoldmeadowDodger card) {
|
public GoldmeadowDodger(final GoldmeadowDodger card) {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ import mage.game.permanent.Permanent;
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CantBeBlockedByCreaturesSourceEffect extends RestrictionEffect {
|
public class CantBeBlockedByCreaturesSourceEffect extends RestrictionEffect {
|
||||||
|
|
||||||
private final FilterCreaturePermanent filter;
|
private final FilterCreaturePermanent filter;
|
||||||
|
|
@ -57,18 +56,12 @@ public class CantBeBlockedByCreaturesSourceEffect extends RestrictionEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
if (permanent.getId().equals(source.getSourceId())) {
|
return permanent.getId().equals(source.getSourceId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
if (filter.match(blocker, source.getSourceId(), source.getControllerId(), game)) {
|
return !filter.match(blocker, source.getSourceId(), source.getControllerId(), game);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
68
Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java
Normal file
68
Mage/src/main/java/mage/abilities/keyword/SkulkAbility.java
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package mage.abilities.keyword;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.StaticAbility;
|
||||||
|
import mage.abilities.effects.RestrictionEffect;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class SkulkAbility extends StaticAbility {
|
||||||
|
|
||||||
|
public SkulkAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new SkulkEffect(Duration.WhileOnBattlefield));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkulkAbility(final SkulkAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Ability copy() {
|
||||||
|
return new SkulkAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Skulk <i>(This creature can't be blocked by creatures with greater power.)</i>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class SkulkEffect extends RestrictionEffect {
|
||||||
|
|
||||||
|
public SkulkEffect(Duration duration) {
|
||||||
|
super(duration);
|
||||||
|
staticText = "Skulk <i>(This creature can't be blocked by creatures with greater power.)</i>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public SkulkEffect(final SkulkEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||||
|
return !permanent.getControllerId().equals(source.getControllerId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||||
|
return blocker.getId().equals(source.getSourceId())
|
||||||
|
&& blocker.getPower().getValue() >= attacker.getPower().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SkulkEffect copy() {
|
||||||
|
return new SkulkEffect(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue