mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Watchdof + Briar Patch - Fixed abug that an ability could have no controller.
This commit is contained in:
parent
6857b7db29
commit
1c8f11e849
2 changed files with 10 additions and 12 deletions
|
|
@ -52,7 +52,7 @@ public class BriarPatch extends CardImpl {
|
||||||
Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn);
|
Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn);
|
||||||
effect.setText("it gets -1/-0");
|
effect.setText("it gets -1/-0");
|
||||||
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.BATTLEFIELD, effect, false, SetTargetPointer.PERMANENT);
|
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.BATTLEFIELD, effect, false, SetTargetPointer.PERMANENT);
|
||||||
this.getAbilities().add(ability);
|
addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BriarPatch(final BriarPatch card) {
|
public BriarPatch(final BriarPatch card) {
|
||||||
|
|
|
||||||
|
|
@ -52,16 +52,16 @@ import mage.game.permanent.Permanent;
|
||||||
public class Watchdog extends CardImpl {
|
public class Watchdog extends CardImpl {
|
||||||
|
|
||||||
public Watchdog(UUID ownerId, CardSetInfo setInfo) {
|
public Watchdog(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}");
|
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
|
||||||
this.subtype.add("Hound");
|
this.subtype.add("Hound");
|
||||||
this.power = new MageInt(1);
|
this.power = new MageInt(1);
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// Watchdog blocks each turn if able.
|
// Watchdog blocks each turn if able.
|
||||||
this.getAbilities().add(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlocksIfAbleSourceEffect(Duration.WhileOnBattlefield)));
|
addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlocksIfAbleSourceEffect(Duration.WhileOnBattlefield)));
|
||||||
// As long as Watchdog is untapped, all creatures attacking you get -1/-0.
|
// As long as Watchdog is untapped, all creatures attacking you get -1/-0.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
|
addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
|
||||||
new BoostAllEffect(-1, 0, Duration.WhileOnBattlefield, new WatchdogFilter(), false), new InvertCondition(SourceTappedCondition.instance),"As long as {this} is untapped, all creatures attacking you get -1/-0")));
|
new BoostAllEffect(-1, 0, Duration.WhileOnBattlefield, new WatchdogFilter(), false), new InvertCondition(SourceTappedCondition.instance), "As long as {this} is untapped, all creatures attacking you get -1/-0")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Watchdog(final Watchdog card) {
|
public Watchdog(final Watchdog card) {
|
||||||
|
|
@ -74,14 +74,12 @@ public class Watchdog extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class WatchdogFilter extends FilterAttackingCreature {
|
class WatchdogFilter extends FilterAttackingCreature {
|
||||||
|
|
||||||
public WatchdogFilter() {
|
public WatchdogFilter() {
|
||||||
super("creatures attacking you");
|
super("creatures attacking you");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public WatchdogFilter(final WatchdogFilter filter) {
|
public WatchdogFilter(final WatchdogFilter filter) {
|
||||||
super(filter);
|
super(filter);
|
||||||
}
|
}
|
||||||
|
|
@ -93,15 +91,15 @@ class WatchdogFilter extends FilterAttackingCreature {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
||||||
if(!super.match(permanent, sourceId, playerId, game)) {
|
if (!super.match(permanent, sourceId, playerId, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(CombatGroup group : game.getCombat().getGroups()) {
|
for (CombatGroup group : game.getCombat().getGroups()) {
|
||||||
for(UUID attacker : group.getAttackers()) {
|
for (UUID attacker : group.getAttackers()) {
|
||||||
if(attacker.equals(permanent.getId())) {
|
if (attacker.equals(permanent.getId())) {
|
||||||
UUID defenderId = group.getDefenderId();
|
UUID defenderId = group.getDefenderId();
|
||||||
if(defenderId.equals(playerId)) {
|
if (defenderId.equals(playerId)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue