mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge origin/master
This commit is contained in:
commit
1f1f8544e3
4 changed files with 26 additions and 35 deletions
|
@ -34,6 +34,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.OnEventTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -66,7 +67,6 @@ public class CallToTheKindred extends CardImpl {
|
|||
this.expansionSetCode = "DKA";
|
||||
this.subtype.add("Aura");
|
||||
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
|
@ -106,10 +106,10 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
|
||||
if (player == null || enchantment.getAttachedTo() == null) {
|
||||
if (enchantment == null || controller == null || enchantment.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -119,18 +119,14 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), 5);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
}
|
||||
}
|
||||
player.lookAtCards("Call to the Kindred", cards, game);
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 5));
|
||||
controller.lookAtCards(enchantment.getIdName(), cards, game);
|
||||
|
||||
FilterCreatureCard filter = new FilterCreatureCard();
|
||||
|
||||
if (!creature.getAbilities().contains(ChangelingAbility.getInstance())) {
|
||||
StringBuilder sb = new StringBuilder("creature card with at least one subtype from: ");
|
||||
ArrayList<Predicate<MageObject>> subtypes = new ArrayList<Predicate<MageObject>>();
|
||||
ArrayList<Predicate<MageObject>> subtypes = new ArrayList<>();
|
||||
for (String subtype : creature.getSubtype()) {
|
||||
subtypes.add(new SubtypePredicate(subtype));
|
||||
sb.append(subtype).append(", ");
|
||||
|
@ -138,19 +134,22 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
filter.add(Predicates.or(subtypes));
|
||||
sb.delete(sb.length() - 2, sb.length());
|
||||
filter.setMessage(sb.toString());
|
||||
} else {
|
||||
filter.setMessage("creature card that shares a creature type with enchanted creature");
|
||||
}
|
||||
|
||||
if (cards.count(filter, game) > 0 && player.chooseUse(Outcome.DrawCard, "Do you wish to put a creature card onto the battlefield?", source, game)) {
|
||||
if (cards.count(filter, game) > 0 && controller.chooseUse(Outcome.DrawCard, "Do you wish to put a creature card onto the battlefield?", source, game)) {
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, filter);
|
||||
|
||||
if (player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
|
||||
if (controller.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
cards.remove(card);
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.putCardsOnBottomOfLibrary(cards, game, source, true);
|
||||
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ public class CursedScroll extends CardImpl {
|
|||
super(ownerId, 271, "Cursed Scroll", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
// {3}, {tap}: Name a card. Reveal a card at random from your hand. If it's the named card, Cursed Scroll deals 2 damage to target creature or player.
|
||||
// {3}, {T}: Name a card. Reveal a card at random from your hand. If it's the named card, Cursed Scroll deals 2 damage to target creature or player.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NameACardEffect(NameACardEffect.TypeOfName.ALL), new ManaCostsImpl("{3}"));
|
||||
ability.addEffect(new CursedScrollEffect());
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
|
|
@ -81,15 +81,6 @@ public class Deck implements Serializable {
|
|||
Collections.sort(sbCardNames);
|
||||
String deckString = deckCardNames.toString() + sbCardNames.toString();
|
||||
deck.setDeckHashCode(DeckUtil.fixedHash(deckString));
|
||||
// try{
|
||||
// MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
// messageDigest.update(deckString.getBytes());
|
||||
// String encryptedString = new String(messageDigest.digest());
|
||||
// deck.setDeckHashCode(encryptedString.hashCode());
|
||||
// }
|
||||
// catch (NoSuchAlgorithmException e) {
|
||||
// // nothing
|
||||
// }
|
||||
return deck;
|
||||
}
|
||||
|
||||
|
|
|
@ -386,6 +386,7 @@ public enum CardRepository {
|
|||
|
||||
return cardDao.query(queryBuilder.prepare());
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(CardRepository.class).error("Error during execution of card repository query statement", ex);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue