mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 04:12:14 -08:00
Added Fierce Empath, Hydra Omnivore, Tribute to the Wild, Coalition Relic and Animar, Soul of Elements.
This commit is contained in:
parent
d511199566
commit
ed3caf7ded
12 changed files with 860 additions and 13 deletions
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class BeginningOfPreCombatMainTriggeredAbility extends TriggeredAbilityImpl<BeginningOfPreCombatMainTriggeredAbility> {
|
||||
|
||||
private TargetController targetController;
|
||||
private boolean setTargetPointer;
|
||||
|
||||
public BeginningOfPreCombatMainTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
|
||||
this(Zone.BATTLEFIELD, effect, targetController, isOptional, false);
|
||||
}
|
||||
|
||||
public BeginningOfPreCombatMainTriggeredAbility(Zone zone, Effect effect, TargetController targetController, boolean isOptional, boolean setTargetPointer) {
|
||||
super(zone, effect, isOptional);
|
||||
this.targetController = targetController;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public BeginningOfPreCombatMainTriggeredAbility(final BeginningOfPreCombatMainTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.targetController = ability.targetController;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeginningOfPreCombatMainTriggeredAbility copy() {
|
||||
return new BeginningOfPreCombatMainTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.PRECOMBAT_MAIN_PHASE_PRE) {
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours && setTargetPointer) {
|
||||
if (getTargets().size() == 0) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return yours;
|
||||
case OPPONENT:
|
||||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ANY:
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
return "At the beginning of your precombat main phase, " + generateZoneString() + getEffects().getText(modes.getMode());
|
||||
case OPPONENT:
|
||||
return "At the beginning of each opponent's precombat main phase, " + generateZoneString() + getEffects().getText(modes.getMode());
|
||||
case ANY:
|
||||
return "At the beginning of each precombat main phase, " + generateZoneString() + getEffects().getText(modes.getMode());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String generateZoneString() {
|
||||
switch (getZone()) {
|
||||
case GRAVEYARD:
|
||||
return "if {this} is in your graveyard, ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -40,23 +40,23 @@ import mage.game.permanent.Permanent;
|
|||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class AtTheBeginOfPreCombatMainPhaseTriggeredAbility extends DelayedTriggeredAbility<AtTheBeginOfPreCombatMainPhaseTriggeredAbility> {
|
||||
public class AtTheBeginOfPreCombatMainDelayedTriggeredAbility extends DelayedTriggeredAbility<AtTheBeginOfPreCombatMainDelayedTriggeredAbility> {
|
||||
|
||||
private TargetController targetController;
|
||||
|
||||
public AtTheBeginOfPreCombatMainPhaseTriggeredAbility(Effect effect, TargetController targetController) {
|
||||
public AtTheBeginOfPreCombatMainDelayedTriggeredAbility(Effect effect, TargetController targetController) {
|
||||
super(effect);
|
||||
this.targetController = targetController;
|
||||
}
|
||||
|
||||
public AtTheBeginOfPreCombatMainPhaseTriggeredAbility(AtTheBeginOfPreCombatMainPhaseTriggeredAbility ability) {
|
||||
public AtTheBeginOfPreCombatMainDelayedTriggeredAbility(AtTheBeginOfPreCombatMainDelayedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.targetController = ability.targetController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AtTheBeginOfPreCombatMainPhaseTriggeredAbility copy() {
|
||||
return new AtTheBeginOfPreCombatMainPhaseTriggeredAbility(this);
|
||||
public AtTheBeginOfPreCombatMainDelayedTriggeredAbility copy() {
|
||||
return new AtTheBeginOfPreCombatMainDelayedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -31,6 +31,8 @@ import mage.abilities.TriggeredAbilityImpl;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagePlayerEvent;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
|
|
@ -39,16 +41,24 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*/
|
||||
public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl<DealsDamageToOpponentTriggeredAbility> {
|
||||
|
||||
boolean onlyCombat;
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
}
|
||||
this(effect, false, false);
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional, boolean onlyCombat) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.onlyCombat = onlyCombat;
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.onlyCombat = ability.onlyCombat;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -60,8 +70,15 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl<
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)
|
||||
&& game.getOpponents(this.getControllerId()).contains(event.getTargetId())) {
|
||||
if (onlyCombat && event instanceof DamagedPlayerEvent) {
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||
if (!damageEvent.isCombatDamage()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -70,6 +87,11 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl<
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} deals damage to an opponent, " + super.getRule();
|
||||
StringBuilder sb = new StringBuilder("Whenever {this} deals ");
|
||||
if (onlyCombat) {
|
||||
sb.append("combat ");
|
||||
}
|
||||
sb.append("damage to an opponent, ").append(super.getRule());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,9 @@ public class SacrificeOpponentsEffect extends OneShotEffect<SacrificeOpponentsEf
|
|||
sb.append(amount.toString());
|
||||
} else {
|
||||
if (amount.toString().equals("1")) {
|
||||
sb.append("a");
|
||||
if (!filter.getMessage().startsWith("a ") && !filter.getMessage().startsWith("an ")) {
|
||||
sb.append("a");
|
||||
}
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(amount.toString()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue