Merge pull request #44 from magefree/master

merge
This commit is contained in:
theelk801 2017-08-27 11:08:13 -04:00 committed by GitHub
commit ad893aee31
13 changed files with 505 additions and 375 deletions

View file

@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable<MageVersion> {
public final static int MAGE_VERSION_MAJOR = 1;
public final static int MAGE_VERSION_MINOR = 4;
public final static int MAGE_VERSION_PATCH = 26;
public final static String MAGE_VERSION_MINOR_PATCH = "V1";
public final static String MAGE_VERSION_MINOR_PATCH = "V2";
public final static String MAGE_VERSION_INFO = "";
private final int major;

View file

@ -86,7 +86,6 @@ public enum ChatManager {
if (chatId != null) {
ChatSession chatSession = chatSessions.get(chatId);
if (chatSession != null) {
synchronized (chatSession) {
if (chatSessions.containsKey(chatId)) {
final Lock w = lock.writeLock();
w.lock();
@ -102,7 +101,6 @@ public enum ChatManager {
}
}
}
}
public void broadcast(UUID chatId, String userName, String message, MessageColor color, boolean withTime) {
this.broadcast(chatId, userName, message, color, withTime, MessageType.TALK);

View file

@ -386,6 +386,8 @@ public class User {
if (controller.isPresent()) {
ccSideboard(entry.getValue(), entry.getKey(), controller.get().getRemainingTime(), controller.get().getOptions().isLimited());
} else {
// Table is missing after connection was lost during sideboard.
// Means other players were removed or conceded the game?
logger.error("sideboarding id not found : " + entry.getKey());
}
}

View file

@ -48,9 +48,9 @@ import mage.game.permanent.Permanent;
*
* @author TheElk801
*/
public class BloodforgedWarAxe extends CardImpl {
public class BloodforgedBattleAxe extends CardImpl {
public BloodforgedWarAxe(UUID ownerId, CardSetInfo setInfo) {
public BloodforgedBattleAxe(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
this.subtype.add("Equipment");
@ -59,36 +59,36 @@ public class BloodforgedWarAxe extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 0)));
// Whenever equipped creature deals combat damage to a player, create a token that's a copy of Bloodforged War Axe.
this.addAbility(new BloodforgedWarAxeAbility());
this.addAbility(new BloodforgedBattleAxeAbility());
// Equip 2
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
}
public BloodforgedWarAxe(final BloodforgedWarAxe card) {
public BloodforgedBattleAxe(final BloodforgedBattleAxe card) {
super(card);
}
@Override
public BloodforgedWarAxe copy() {
return new BloodforgedWarAxe(this);
public BloodforgedBattleAxe copy() {
return new BloodforgedBattleAxe(this);
}
}
class BloodforgedWarAxeAbility extends TriggeredAbilityImpl {
class BloodforgedBattleAxeAbility extends TriggeredAbilityImpl {
public BloodforgedWarAxeAbility() {
public BloodforgedBattleAxeAbility() {
super(Zone.BATTLEFIELD, new PutTokenOntoBattlefieldCopySourceEffect());
}
public BloodforgedWarAxeAbility(final BloodforgedWarAxeAbility ability) {
public BloodforgedBattleAxeAbility(final BloodforgedBattleAxeAbility ability) {
super(ability);
}
@Override
public BloodforgedWarAxeAbility copy() {
return new BloodforgedWarAxeAbility(this);
public BloodforgedBattleAxeAbility copy() {
return new BloodforgedBattleAxeAbility(this);
}
@Override

View file

@ -46,7 +46,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -74,7 +73,7 @@ public class DragonTempest extends CardImpl {
new DragonTempestDamageEffect(),
new FilterCreaturePermanent(SubType.DRAGON, "a Dragon"),
false,
SetTargetPointer.PERMANENT,
SetTargetPointer.NONE,
""
);
ability.addTarget(new TargetCreatureOrPlayer());
@ -118,15 +117,16 @@ class DragonTempestDamageEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent damageSource = (Permanent) getValue("permanentEnteringBattlefield");
int amount = game.getBattlefield().countAll(dragonFilter, controller.getId(), game);
if (amount > 0) {
Permanent targetCreature = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game);
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
targetCreature.damage(amount, getTargetPointer().getFirst(game, source), game, false, true);
targetCreature.damage(amount, damageSource.getId(), game, false, true);
} else {
Player player = game.getPlayer(source.getTargets().getFirstTarget());
if (player != null) {
player.damage(amount, getTargetPointer().getFirst(game, source), game, false, true);
player.damage(amount, damageSource.getId(), game, false, true);
}
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.common.FatefulHourCondition;
import mage.abilities.effects.OneShotEffect;
@ -56,9 +57,7 @@ public class FaithsShield extends CardImpl {
public FaithsShield(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}");
// Target permanent you control gains protection from the color of your choice until end of turn.
// Fateful hour - If you have 5 or less life, instead you and each permanent you control gain protection from the color of your choice until end of turn.
this.getSpellAbility().addEffect(new FaithsShieldEffect());
this.getSpellAbility().addTarget(new TargetControlledPermanent());
@ -89,7 +88,8 @@ class FaithsShieldEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) {
if (FatefulHourCondition.instance.apply(game, source)) {
ChoiceColor choice = new ChoiceColor();
while (!choice.isChosen()) {
@ -98,18 +98,20 @@ class FaithsShieldEffect extends OneShotEffect {
return false;
}
}
if (choice.getColor() != null) {
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(choice.getColor()));
filter.setMessage(choice.getChoice());
Ability ability = new ProtectionAbility(filter);
game.addEffect(new GainAbilityControlledEffect(ability, Duration.EndOfTurn), source);
game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
}
else {
game.addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn), source);
}
return true;
}
} else {
game.addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn), source);
return true;
}
}
return false;

View file

@ -0,0 +1,125 @@
/*
* 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.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilityControllerEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class SehtsTiger extends CardImpl {
public SehtsTiger(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.subtype.add(SubType.CAT);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Flash
this.addAbility(FlashAbility.getInstance());
// When Seht's Tiger enters the battlefield, you gain protection from the color of your choice until end of turn.
// (You can't be targeted, dealt damage, or enchanted by anything of the chosen color.)
this.addAbility(new EntersBattlefieldTriggeredAbility(new SehtsTigerEffect(), false));
}
public SehtsTiger(final SehtsTiger card) {
super(card);
}
@Override
public SehtsTiger copy() {
return new SehtsTiger(this);
}
}
class SehtsTigerEffect extends OneShotEffect {
public SehtsTigerEffect() {
super(Outcome.Protect);
staticText = "you gain protection from the color of your choice until end of turn <i>(You can't be targeted, dealt damage, or enchanted by anything of the chosen color.)</i>";
}
public SehtsTigerEffect(final SehtsTigerEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller != null && mageObject != null) {
ChoiceColor choice = new ChoiceColor();
while (!choice.isChosen()) {
controller.choose(Outcome.Protect, choice, game);
if (!controller.canRespond()) {
return false;
}
}
if (choice.getColor() != null) {
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(choice.getColor()));
filter.setMessage(choice.getChoice());
Ability ability = new ProtectionAbility(filter);
game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
return true;
}
}
return false;
}
@Override
public SehtsTigerEffect copy() {
return new SehtsTigerEffect(this);
}
}

View file

@ -112,7 +112,7 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
public StarfieldOfNyxEffect() {
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
staticText = "Each other non-Aura enchantment is a creature in addition to its other types and has base power and toughness each equal to its converted mana cost";
staticText = "Each other non-Aura enchantment you control is a creature in addition to its other types and has base power and toughness each equal to its converted mana cost";
}
public StarfieldOfNyxEffect(final StarfieldOfNyxEffect effect) {

View file

@ -49,7 +49,7 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Arahbo, Roar of the World", 35, Rarity.MYTHIC, mage.cards.a.ArahboRoarOfTheWorld.class));
cards.add(new SetCardInfo("Balan, Wandering Knight", 2, Rarity.RARE, mage.cards.b.BalanWanderingKnight.class));
cards.add(new SetCardInfo("Bloodforged War Axe", 50, Rarity.RARE, mage.cards.b.BloodforgedWarAxe.class));
cards.add(new SetCardInfo("Bloodforged Battle-Axe", 50, Rarity.RARE, mage.cards.b.BloodforgedBattleAxe.class));
cards.add(new SetCardInfo("Bloodline Necromancer", 14, Rarity.UNCOMMON, mage.cards.b.BloodlineNecromancer.class));
cards.add(new SetCardInfo("Bloodsworn Steward", 22, Rarity.RARE, mage.cards.b.BloodswornSteward.class));
cards.add(new SetCardInfo("Boneyard Scourge", 15, Rarity.RARE, mage.cards.b.BoneyardScourge.class));

View file

@ -183,6 +183,7 @@ public class FutureSight extends ExpansionSet {
cards.add(new SetCardInfo("Scourge of Kher Ridges", 107, Rarity.RARE, mage.cards.s.ScourgeOfKherRidges.class));
cards.add(new SetCardInfo("Scout's Warning", 16, Rarity.RARE, mage.cards.s.ScoutsWarning.class));
cards.add(new SetCardInfo("Second Wind", 57, Rarity.UNCOMMON, mage.cards.s.SecondWind.class));
cards.add(new SetCardInfo("Seht's Tiger", 31, Rarity.RARE, mage.cards.s.SehtsTiger.class));
cards.add(new SetCardInfo("Shapeshifter's Marrow", 58, Rarity.RARE, mage.cards.s.ShapeshiftersMarrow.class));
cards.add(new SetCardInfo("Shimian Specter", 76, Rarity.RARE, mage.cards.s.ShimianSpecter.class));
cards.add(new SetCardInfo("Skirk Ridge Exhumer", 77, Rarity.UNCOMMON, mage.cards.s.SkirkRidgeExhumer.class));

View file

@ -105,6 +105,9 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
for (Effect effect : this.getEffects()) {
effect.setValue("permanentEnteringBattlefield", permanent);
}
if (setTargetPointer != SetTargetPointer.NONE) {
for (Effect effect : this.getEffects()) {
switch (setTargetPointer) {

View file

@ -58,8 +58,7 @@ public enum CardRepository {
// raise this if db structure was changed
private static final long CARD_DB_VERSION = 51;
// raise this if new cards were added to the server
private static final long CARD_CONTENT_VERSION = 87;
private final TreeSet<String> landTypes = new TreeSet<>();
private static final long CARD_CONTENT_VERSION = 89;
private Dao<CardInfo, Object> cardDao;
private Set<String> classNames;