mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
8 new cards
[SOK] Kashi-Tribe Elite / Matsu-Tribe Birdstalker [CHK] Kashi-Tribe Reaver / Kashi-Tribe Warriors / Matsu-Tribe Decoy / Orochi Ranger / Shisato Whispering Hunter / Sosuke, Son of Seshiro Framework SkipNextPlayerUntapStepEffect - new effect CardsInHandCondition - new condition DealsCombatDamageToACreatureTriggeredAbility - new ability BecomesCreatureSourceEffect - Fix to solve problems with creatures that unintended kept their subtypes (e.g. Skinshifter)) BeginningOfUpkeepTriggeredAbility - set also target pointer if targetController == YOU BoostTargetEffect - added lockedIn parameter to fix error for various cards (DragDown / ElderOfLaurels / MightOfAlara / MightOfTheMasses / StrengthOfCedars / BloodthirstyOgre) GainAbilityControlledEffect - imporoved text generation SkipNextUntapTargetEffect / TapTargetEffect - addded fixed target text support Minor changes AkkiLavarunner / CreakwoodGhoul / DearlyDeparted - includes ClockworkBeetle - fixed use of effect of other card KondasBanner - fixed potential null pointer exception and wrong name spelling YoseiTheMorningStar - uses now the new SkipNextPlayerUntapStepEffect
This commit is contained in:
parent
e05024351f
commit
5be4f1c291
29 changed files with 1094 additions and 85 deletions
|
|
@ -34,7 +34,13 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl<Begi
|
|||
if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) {
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
return event.getPlayerId().equals(this.controllerId);
|
||||
if (event.getPlayerId().equals(this.controllerId)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case OPPONENT:
|
||||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
|
|
@ -42,7 +48,7 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl<Begi
|
|||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case ANY:
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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.common;
|
||||
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedCreatureEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class DealsCombatDamageToACreatureTriggeredAbility extends TriggeredAbilityImpl<DealsCombatDamageToACreatureTriggeredAbility> {
|
||||
|
||||
private boolean setTargetPointer;
|
||||
|
||||
public DealsCombatDamageToACreatureTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
}
|
||||
|
||||
public DealsCombatDamageToACreatureTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public DealsCombatDamageToACreatureTriggeredAbility(final DealsCombatDamageToACreatureTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DealsCombatDamageToACreatureTriggeredAbility copy() {
|
||||
return new DealsCombatDamageToACreatureTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.DAMAGED_CREATURE) {
|
||||
if (event.getSourceId().equals(this.sourceId)
|
||||
&& ((DamagedCreatureEvent) event).isCombatDamage()) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} deals combat damage to a creature, " + super.getRule();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* Cards in controller hand condition. This condition can decorate other conditions
|
||||
* as well as be used standalone.
|
||||
*
|
||||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class CardsInHandCondition implements Condition {
|
||||
|
||||
public static enum CountType { MORE_THAN, FEWER_THAN, EQUAL_TO };
|
||||
private Condition condition;
|
||||
private CountType type;
|
||||
private int count;
|
||||
|
||||
public CardsInHandCondition() {
|
||||
this(CountType.EQUAL_TO, 0);
|
||||
}
|
||||
|
||||
public CardsInHandCondition (CountType type, int count ) {
|
||||
this.type = type;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public CardsInHandCondition (CountType type, int count, Condition conditionToDecorate ) {
|
||||
this(type, count);
|
||||
this.condition = conditionToDecorate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean conditionApplies = false;
|
||||
|
||||
switch ( this.type ) {
|
||||
case FEWER_THAN:
|
||||
conditionApplies = game.getPlayer(source.getControllerId()).getHand().size() < this.count;
|
||||
break;
|
||||
case MORE_THAN:
|
||||
conditionApplies = game.getPlayer(source.getControllerId()).getHand().size() > this.count;
|
||||
break;
|
||||
case EQUAL_TO:
|
||||
conditionApplies = game.getPlayer(source.getControllerId()).getHand().size() == this.count;
|
||||
break;
|
||||
}
|
||||
|
||||
//If a decorated condition exists, check it as well and apply them together.
|
||||
if ( this.condition != null ) {
|
||||
conditionApplies = conditionApplies && this.condition.apply(game, source);
|
||||
}
|
||||
|
||||
return conditionApplies;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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.common;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.PhaseStep;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class SkipNextPlayerUntapStepEffect extends OneShotEffect<SkipNextPlayerUntapStepEffect> {
|
||||
|
||||
public SkipNextPlayerUntapStepEffect() {
|
||||
super(Constants.Outcome.Detriment);
|
||||
}
|
||||
|
||||
public SkipNextPlayerUntapStepEffect(String text) {
|
||||
this();
|
||||
staticText = text;
|
||||
}
|
||||
|
||||
public SkipNextPlayerUntapStepEffect(SkipNextPlayerUntapStepEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (targetPointer != null) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(source));
|
||||
if (player != null) {
|
||||
game.getState().getTurnMods().add(new TurnMod(player.getId(), PhaseStep.UNTAP));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkipNextPlayerUntapStepEffect copy() {
|
||||
return new SkipNextPlayerUntapStepEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (staticText.length() > 0) {
|
||||
sb.append(staticText);
|
||||
}
|
||||
else {
|
||||
sb.append("target");
|
||||
}
|
||||
sb.append("player skips his or her next untap step");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,11 @@ public class SkipNextUntapTargetEffect extends ReplacementEffectImpl<SkipNextUnt
|
|||
super(Duration.OneUse, Outcome.Detriment);
|
||||
}
|
||||
|
||||
public SkipNextUntapTargetEffect(String text) {
|
||||
this();
|
||||
this.staticText = text;
|
||||
}
|
||||
|
||||
public SkipNextUntapTargetEffect(final SkipNextUntapTargetEffect effect) {
|
||||
super(effect);
|
||||
for (UUID uuid : effect.usedFor) {
|
||||
|
|
@ -109,6 +114,9 @@ public class SkipNextUntapTargetEffect extends ReplacementEffectImpl<SkipNextUnt
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText.length() > 0)
|
||||
return staticText + " doesn't untap during its controller's next untap step";
|
||||
else
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " doesn't untap during its controller's next untap step";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ public class TapTargetEffect extends OneShotEffect<TapTargetEffect> {
|
|||
super(Outcome.Tap);
|
||||
}
|
||||
|
||||
public TapTargetEffect(String text) {
|
||||
this();
|
||||
this.staticText = text;
|
||||
}
|
||||
|
||||
public TapTargetEffect(final TapTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
|
@ -71,12 +76,15 @@ public class TapTargetEffect extends OneShotEffect<TapTargetEffect> {
|
|||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (staticText.length() > 0)
|
||||
return "tap " + staticText;
|
||||
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() > 1)
|
||||
if (target.getMaxNumberOfTargets() == target.getNumberOfTargets())
|
||||
return "tap " + target.getNumberOfTargets() + " target " + mode.getTargets().get(0).getTargetName() + "s";
|
||||
else
|
||||
return "tap up to " + target.getMaxNumberOfTargets() + " target " + mode.getTargets().get(0).getTargetName() + "s";
|
||||
if (target.getMaxNumberOfTargets() == target.getNumberOfTargets())
|
||||
return "tap " + target.getNumberOfTargets() + " target " + target.getTargetName() + "s";
|
||||
else
|
||||
return "tap up to " + target.getMaxNumberOfTargets() + " target " + target.getTargetName() + "s";
|
||||
else
|
||||
return "tap target " + mode.getTargets().get(0).getTargetName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl<BecomesCre
|
|||
}
|
||||
}
|
||||
}
|
||||
if (type == null) {
|
||||
if (type == "" || type == null) {
|
||||
permanent.getSubtype().clear();
|
||||
}
|
||||
if (token.getSubtype().size() > 0) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
|
|||
|
||||
private DynamicValue power;
|
||||
private DynamicValue toughness;
|
||||
|
||||
// if true, all dynamic values should be calculated once
|
||||
protected boolean isLockedIn = false;
|
||||
|
||||
public BoostTargetEffect(int power, int toughness, Duration duration) {
|
||||
this(new StaticValue(power), new StaticValue(toughness), duration);
|
||||
}
|
||||
|
|
@ -59,18 +61,41 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
|
|||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
}
|
||||
/**
|
||||
* @param power power value to boost
|
||||
* @param toughness toughness value to boost
|
||||
* @param duration how long does the effecct apply
|
||||
* @param continuousCalculation true = power and toughness will be calculated continuously
|
||||
* false = power and toughness will be calculated once during resolution
|
||||
*/
|
||||
public BoostTargetEffect(DynamicValue power, DynamicValue toughness, Duration duration, boolean isLockedIn) {
|
||||
super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
|
||||
this.power = power;
|
||||
this.toughness = toughness;
|
||||
this.isLockedIn = isLockedIn;
|
||||
}
|
||||
|
||||
public BoostTargetEffect(final BoostTargetEffect effect) {
|
||||
super(effect);
|
||||
this.power = effect.power.clone();
|
||||
this.toughness = effect.toughness.clone();
|
||||
this.isLockedIn = effect.isLockedIn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoostTargetEffect copy() {
|
||||
return new BoostTargetEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (isLockedIn) {
|
||||
power = new StaticValue(power.calculate(game, source));
|
||||
toughness = new StaticValue(toughness.calculate(game, source));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
|
|
@ -115,4 +140,8 @@ public class BoostTargetEffect extends ContinuousEffectImpl<BoostTargetEffect> {
|
|||
sb.append(message);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void setLockedIn(boolean isLockedIn) {
|
||||
this.isLockedIn =isLockedIn;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import mage.Constants.Outcome;
|
|||
import mage.Constants.SubLayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -104,8 +105,12 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl<GainAbilit
|
|||
StringBuilder sb = new StringBuilder();
|
||||
if (excludeSource)
|
||||
sb.append("Other ");
|
||||
sb.append(filter.getMessage()).append(" you control gain ").append(ability.getRule());
|
||||
sb.append(" ").append(duration.toString());
|
||||
sb.append(filter.getMessage()).append(" you control ");
|
||||
if (duration.equals(Duration.WhileOnBattlefield))
|
||||
sb.append("have ");
|
||||
else
|
||||
sb.append("gain ");
|
||||
sb.append(ability.getRule()).append(" ").append(duration.toString());
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue