mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed a bug of abilityWord, improved set target of DealsDamageToAPlayerAllTriggeredAbility.
This commit is contained in:
parent
1b7646bee6
commit
6d81f1a0d1
7 changed files with 22 additions and 7 deletions
|
@ -35,6 +35,7 @@ import mage.abilities.effects.common.CreateTokenTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class BroodSliver extends CardImpl {
|
|||
effect.setText("its controller may put a 1/1 colorless Sliver creature token onto the battlefield");
|
||||
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(effect,
|
||||
new FilterCreaturePermanent("Sliver", "a Sliver"),
|
||||
true, true, true));
|
||||
true, SetTargetPointer.PLAYER, true));
|
||||
}
|
||||
|
||||
public BroodSliver(final BroodSliver card) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.abilities.effects.common.DrawCardTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
@ -57,7 +58,7 @@ public class SynapseSliver extends CardImpl {
|
|||
effect.setText("its controller may draw a card");
|
||||
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(effect,
|
||||
new FilterCreaturePermanent("Sliver", "a Sliver"),
|
||||
true, true, true));
|
||||
true, SetTargetPointer.PLAYER, true));
|
||||
}
|
||||
|
||||
public SynapseSliver(final SynapseSliver card) {
|
||||
|
|
|
@ -126,6 +126,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible;
|
||||
this.costModificationActive = ability.costModificationActive;
|
||||
this.worksFaceDown = ability.worksFaceDown;
|
||||
this.abilityWord = ability.abilityWord;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.abilities.common;
|
|||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -46,10 +47,10 @@ import mage.target.targetpointer.FixedTarget;
|
|||
|
||||
public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImpl {
|
||||
private final FilterPermanent filter;
|
||||
private final boolean setTargetPointer;
|
||||
private final SetTargetPointer setTargetPointer;
|
||||
private final boolean onlyCombat;
|
||||
|
||||
public DealsDamageToAPlayerAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, boolean setTargetPointer, boolean onlyCombat) {
|
||||
public DealsDamageToAPlayerAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyCombat) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
this.filter = filter;
|
||||
|
@ -74,10 +75,18 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
&& (!onlyCombat || ((DamagedPlayerEvent) event).isCombatDamage())) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) {
|
||||
if (setTargetPointer) {
|
||||
if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setValue("damage", event.getAmount());
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
switch(setTargetPointer) {
|
||||
case PLAYER:
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
break;
|
||||
case PERMANENT:
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class SimpleActivatedAbility extends ActivatedAbilityImpl {
|
|||
super(zone, effect, cost);
|
||||
}
|
||||
|
||||
public SimpleActivatedAbility(Zone zone, Effect effect, Costs costs) {
|
||||
public SimpleActivatedAbility(Zone zone, Effect effect, Costs<Cost> costs) {
|
||||
super(zone, effect, costs);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,6 +139,8 @@ public class AddCountersTargetEffect extends OneShotEffect {
|
|||
sb.append("target ");
|
||||
}
|
||||
sb.append(targetName);
|
||||
} else {
|
||||
sb.append("it");
|
||||
}
|
||||
if (amount.getMessage().length() > 0) {
|
||||
sb.append(" for each ").append(amount.getMessage());
|
||||
|
|
|
@ -35,6 +35,7 @@ package mage.constants;
|
|||
public enum AbilityWord {
|
||||
BLOODRUSH("Bloodrush"),
|
||||
CONSTELLATION("Constellation"),
|
||||
FEROCIOUS("Ferocious"),
|
||||
HELLBENT("Hellbent"),
|
||||
HEROIC("Heroic"),
|
||||
LANDFALL("Landfall"),
|
||||
|
|
Loading…
Reference in a new issue