mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 22:42:03 -08:00
[DTK] Added 23 green cards. Some other fixes. Added handling of Fight events.
This commit is contained in:
parent
b959b07fc1
commit
beaa80f16e
58 changed files with 2426 additions and 126 deletions
|
|
@ -34,7 +34,6 @@ import mage.constants.Zone;
|
|||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
|
|
@ -53,12 +52,15 @@ public class TurnedFaceUpAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
public TurnedFaceUpAllTriggeredAbility(Effect effect, FilterPermanent filter, boolean setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
this(Zone.BATTLEFIELD, effect, filter, setTargetPointer, false);
|
||||
}
|
||||
|
||||
public TurnedFaceUpAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean setTargetPointer, boolean optional) {
|
||||
super(zone, effect, optional);
|
||||
// has to be set so the ability triggers if card itself is turn faced up
|
||||
this.setWorksFaceDown(true);
|
||||
this.filter = filter;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
|
||||
}
|
||||
|
||||
public TurnedFaceUpAllTriggeredAbility(final TurnedFaceUpAllTriggeredAbility ability) {
|
||||
|
|
@ -105,7 +107,7 @@ public class TurnedFaceUpAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When " + filter.getMessage() + " is turned face up, " + super.getRule();
|
||||
return "Whenever " + filter.getMessage() + " is turned face up, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect {
|
|||
}
|
||||
|
||||
public AddManaOfAnyColorEffect(final int amount) {
|
||||
super(new Mana(0,0,0,0,0,0,1));
|
||||
super(new Mana(0,0,0,0,0,0, amount));
|
||||
this.amount = amount;
|
||||
this.staticText = new StringBuilder("add ")
|
||||
.append(CardUtil.numberToText(amount))
|
||||
|
|
|
|||
|
|
@ -57,13 +57,10 @@ public class FightTargetSourceEffect extends OneShotEffect {
|
|||
// only if target is legal the effect will be applied
|
||||
if (source.getTargets().get(0).isLegal(source, game)) {
|
||||
Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget());
|
||||
|
||||
// 20110930 - 701.10
|
||||
if (creature1 != null && sourcePermanent != null) {
|
||||
if (creature1.getCardType().contains(CardType.CREATURE) && sourcePermanent.getCardType().contains(CardType.CREATURE)) {
|
||||
creature1.damage(sourcePermanent.getPower().getValue(), sourcePermanent.getId(), game, false, true);
|
||||
sourcePermanent.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true);
|
||||
return true;
|
||||
return sourcePermanent.fight(creature1, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ public class FightTargetsEffect extends OneShotEffect {
|
|||
// 20110930 - 701.10
|
||||
if (creature1 != null && creature2 != null) {
|
||||
if (creature1.getCardType().contains(CardType.CREATURE) && creature2.getCardType().contains(CardType.CREATURE)) {
|
||||
creature1.damage(creature2.getPower().getValue(), creature2.getId(), game, false, true);
|
||||
creature2.damage(creature1.getPower().getValue(), creature1.getId(), game, false, true);
|
||||
return true;
|
||||
return creature1.fight(creature2, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ import mage.game.Game;
|
|||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CanAttackAsThoughtItDidntHaveDefenderEffect extends AsThoughEffectImpl {
|
||||
public class CanAttackAsThoughtItDidntHaveDefenderSourceEffect extends AsThoughEffectImpl {
|
||||
|
||||
public CanAttackAsThoughtItDidntHaveDefenderEffect(Duration duration) {
|
||||
public CanAttackAsThoughtItDidntHaveDefenderSourceEffect(Duration duration) {
|
||||
super(AsThoughEffectType.ATTACK, duration, Outcome.Benefit);
|
||||
staticText = "{this} can attack as though it didn't have defender";
|
||||
}
|
||||
|
||||
public CanAttackAsThoughtItDidntHaveDefenderEffect(final CanAttackAsThoughtItDidntHaveDefenderEffect effect) {
|
||||
public CanAttackAsThoughtItDidntHaveDefenderSourceEffect(final CanAttackAsThoughtItDidntHaveDefenderSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
|
@ -57,13 +57,13 @@ public class CanAttackAsThoughtItDidntHaveDefenderEffect extends AsThoughEffectI
|
|||
}
|
||||
|
||||
@Override
|
||||
public CanAttackAsThoughtItDidntHaveDefenderEffect copy() {
|
||||
return new CanAttackAsThoughtItDidntHaveDefenderEffect(this);
|
||||
public CanAttackAsThoughtItDidntHaveDefenderSourceEffect copy() {
|
||||
return new CanAttackAsThoughtItDidntHaveDefenderSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return sourceId.equals(source.getSourceId());
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return objectId.equals(source.getSourceId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* 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.combat;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CanAttackAsThoughtItDidntHaveDefenderTargetEffect extends AsThoughEffectImpl {
|
||||
|
||||
public CanAttackAsThoughtItDidntHaveDefenderTargetEffect(Duration duration) {
|
||||
super(AsThoughEffectType.ATTACK, duration, Outcome.Benefit);
|
||||
}
|
||||
|
||||
public CanAttackAsThoughtItDidntHaveDefenderTargetEffect(final CanAttackAsThoughtItDidntHaveDefenderTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CanAttackAsThoughtItDidntHaveDefenderTargetEffect copy() {
|
||||
return new CanAttackAsThoughtItDidntHaveDefenderTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return this.getTargetPointer().getTargets(game, source).contains(objectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
if (!mode.getTargets().isEmpty()) {
|
||||
if (this.duration == Duration.EndOfTurn) {
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " can attack this turn as though it didn't have defender";
|
||||
} else {
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " can attack as though it didn't have defender";
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedOperationException("No target defined");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -61,6 +61,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
private static FilterCreatureForCombatBlock filterBlockers = new FilterCreatureForCombatBlock();
|
||||
// There are effects that let creatures assigns combat damage equal to its toughness rather than its power
|
||||
private boolean useToughnessForDamage;
|
||||
private List<FilterCreaturePermanent> useToughnessForDamageFilters = new ArrayList<>();
|
||||
|
||||
protected List<CombatGroup> groups = new ArrayList<>();
|
||||
protected Map<UUID, CombatGroup> blockingGroups = new HashMap<>();
|
||||
|
|
@ -130,16 +131,28 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
return blockers;
|
||||
}
|
||||
|
||||
public boolean useToughnessForDamage() {
|
||||
return useToughnessForDamage;
|
||||
public boolean useToughnessForDamage(Permanent permanent, Game game) {
|
||||
if (useToughnessForDamage) {
|
||||
for(FilterCreaturePermanent filter: useToughnessForDamageFilters) {
|
||||
if (filter.match(permanent, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUseToughnessForDamage(boolean useToughnessForDamage) {
|
||||
this.useToughnessForDamage = useToughnessForDamage;
|
||||
}
|
||||
|
||||
public void addUseToughnessForDamageFilter(FilterCreaturePermanent filter) {
|
||||
this.useToughnessForDamageFilters.add(filter);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.useToughnessForDamage = false;
|
||||
this.useToughnessForDamageFilters.clear();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
* @return
|
||||
*/
|
||||
private int getDamageValueFromPermanent(Permanent permanent, Game game) {
|
||||
if (game.getCombat().useToughnessForDamage()) {
|
||||
if (game.getCombat().useToughnessForDamage(permanent, game)) {
|
||||
return permanent.getToughness().getValue();
|
||||
} else {
|
||||
return permanent.getPower().getValue();
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ public class GameEvent {
|
|||
DAMAGE_PLANESWALKER, DAMAGED_PLANESWALKER,
|
||||
DESTROY_PERMANENT, DESTROYED_PERMANENT,
|
||||
SACRIFICE_PERMANENT, SACRIFICED_PERMANENT,
|
||||
FIGHTED_PERMANENT,
|
||||
EXPLOIDED_CREATURE,
|
||||
ATTACH, ATTACHED,
|
||||
UNATTACH, UNATTACHED,
|
||||
|
|
|
|||
|
|
@ -119,6 +119,8 @@ public interface Permanent extends Card, Controllable {
|
|||
boolean destroy(UUID sourceId, Game game, boolean noRegen);
|
||||
boolean sacrifice(UUID sourceId, Game game);
|
||||
boolean regenerate(UUID sourceId, Game game);
|
||||
boolean fight(Permanent fightTarget, Ability source, Game game);
|
||||
|
||||
void entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent);
|
||||
String getValue();
|
||||
|
||||
|
|
|
|||
|
|
@ -1297,5 +1297,12 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
this.secondSideCard = card;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean fight(Permanent fightTarget, Ability source, Game game) {
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, fightTarget.getId(), getId(), source.getControllerId()));
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, getId(), fightTarget.getId(), source.getControllerId()));
|
||||
damage(fightTarget.getPower().getValue(), fightTarget.getId(), game, false, true);
|
||||
fightTarget.damage(getPower().getValue(), getId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue