mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Added possibility to display any data on card's tooltip
This commit is contained in:
parent
faca6008cb
commit
e759f8a0fc
3 changed files with 27 additions and 4 deletions
|
@ -69,6 +69,8 @@ public interface Card extends MageObject {
|
|||
|
||||
public int getZoneChangeCounter();
|
||||
|
||||
public void addInfo(String key, String value);
|
||||
|
||||
/**
|
||||
* Moves the card to the specified zone
|
||||
* @param zone
|
||||
|
|
|
@ -45,10 +45,7 @@ import mage.watchers.Watcher;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T> implements Card {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -67,6 +64,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
protected SpellAbility spellAbility;
|
||||
protected boolean flipCard;
|
||||
protected int zoneChangeCounter = 1;
|
||||
protected Map<String, String> info;
|
||||
|
||||
public CardImpl(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
||||
this(ownerId, name);
|
||||
|
@ -107,6 +105,11 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
secondSideCard = card.secondSideCard;
|
||||
nightCard = card.nightCard;
|
||||
}
|
||||
|
||||
if (card.info != null) {
|
||||
info = new HashMap<String, String>();
|
||||
info.putAll(card.info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,6 +157,11 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
if (cardType.contains(CardType.INSTANT) || cardType.contains(CardType.SORCERY)) {
|
||||
rules.add(0, getSpellAbility().getRule(this.name));
|
||||
}
|
||||
if (info != null) {
|
||||
for (String data : info.values()) {
|
||||
rules.add(data);
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
|
@ -437,4 +445,12 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
|||
private void updateZoneChangeCounter() {
|
||||
zoneChangeCounter++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(String key, String value) {
|
||||
if (info == null) {
|
||||
info = new HashMap<String, String>();
|
||||
}
|
||||
info.put(key, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -442,6 +442,11 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
|
|||
return card.getZoneChangeCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(String key, String value) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public void setCopiedSpell(boolean isCopied) {
|
||||
this.copiedSpell = isCopied;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue