mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
[RIX] Added 6 cards.
This commit is contained in:
parent
5af1355083
commit
66acc1c1e8
12 changed files with 508 additions and 25 deletions
|
|
@ -33,6 +33,7 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
|
|
@ -43,14 +44,20 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
|
|||
|
||||
protected boolean setTargetPointer;
|
||||
protected String text;
|
||||
protected boolean onlyOpponents;
|
||||
|
||||
public DealsCombatDamageToAPlayerTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
}
|
||||
|
||||
public DealsCombatDamageToAPlayerTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer) {
|
||||
this(effect, optional, setTargetPointer, false);
|
||||
}
|
||||
|
||||
public DealsCombatDamageToAPlayerTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer, boolean onlyOpponents) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
this.onlyOpponents = onlyOpponents;
|
||||
}
|
||||
|
||||
public DealsCombatDamageToAPlayerTriggeredAbility(Effect effect, boolean optional, String text, boolean setTargetPointer) {
|
||||
|
|
@ -63,6 +70,7 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
|
|||
super(ability);
|
||||
this.text = ability.text;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
this.onlyOpponents = ability.onlyOpponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -79,6 +87,12 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(getSourceId())
|
||||
&& ((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
if (onlyOpponents) {
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (controller == null || !controller.hasOpponent(event.getPlayerId(), game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getAllEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
|
|
@ -93,7 +107,7 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
|
|||
@Override
|
||||
public String getRule() {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return "Whenever {this} deals combat damage to a player, " + super.getRule();
|
||||
return "Whenever {this} deals combat damage to " + (onlyOpponents ? "an opponent, " : "a player, ") + super.getRule();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,16 +24,15 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.abilities.effects;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.target.targetpointer.TargetPointer;
|
||||
|
||||
|
|
@ -44,18 +43,31 @@ import mage.target.targetpointer.TargetPointer;
|
|||
public interface Effect extends Serializable {
|
||||
|
||||
UUID getId();
|
||||
|
||||
void newId();
|
||||
|
||||
String getText(Mode mode);
|
||||
|
||||
Effect setText(String staticText);
|
||||
|
||||
boolean apply(Game game, Ability source);
|
||||
|
||||
Outcome getOutcome();
|
||||
|
||||
void setOutcome(Outcome outcome);
|
||||
|
||||
EffectType getEffectType();
|
||||
void setTargetPointer(TargetPointer targetPointer);
|
||||
|
||||
Effect setTargetPointer(TargetPointer targetPointer);
|
||||
|
||||
TargetPointer getTargetPointer();
|
||||
|
||||
void setValue(String key, Object value);
|
||||
|
||||
Object getValue(String key);
|
||||
|
||||
void setApplyEffectsAfter();
|
||||
|
||||
boolean applyEffectsAfter();
|
||||
|
||||
Effect copy();
|
||||
|
|
|
|||
|
|
@ -24,20 +24,18 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.abilities.effects;
|
||||
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.MageSingleton;
|
||||
import mage.abilities.Mode;
|
||||
import mage.target.targetpointer.FirstTargetPointer;
|
||||
import mage.target.targetpointer.TargetPointer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.MageSingleton;
|
||||
import mage.abilities.Mode;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.targetpointer.FirstTargetPointer;
|
||||
import mage.target.targetpointer.TargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -106,8 +104,9 @@ public abstract class EffectImpl implements Effect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTargetPointer(TargetPointer targetPointer) {
|
||||
public Effect setTargetPointer(TargetPointer targetPointer) {
|
||||
this.targetPointer = targetPointer;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -141,8 +140,8 @@ public abstract class EffectImpl implements Effect {
|
|||
}
|
||||
|
||||
/**
|
||||
* If set, the game.applyEffects() method will be called to apply the effects before the
|
||||
* next effect (of the same ability) will resolve.
|
||||
* If set, the game.applyEffects() method will be called to apply the
|
||||
* effects before the next effect (of the same ability) will resolve.
|
||||
*/
|
||||
@Override
|
||||
public void setApplyEffectsAfter() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue