mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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
|
@ -68,6 +68,8 @@ public interface Card extends MageObject {
|
||||||
public void assignNewId();
|
public void assignNewId();
|
||||||
|
|
||||||
public int getZoneChangeCounter();
|
public int getZoneChangeCounter();
|
||||||
|
|
||||||
|
public void addInfo(String key, String value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the card to the specified zone
|
* Moves the card to the specified zone
|
||||||
|
|
|
@ -45,10 +45,7 @@ import mage.watchers.Watcher;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T> implements Card {
|
public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T> implements Card {
|
||||||
private static final long serialVersionUID = 1L;
|
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 SpellAbility spellAbility;
|
||||||
protected boolean flipCard;
|
protected boolean flipCard;
|
||||||
protected int zoneChangeCounter = 1;
|
protected int zoneChangeCounter = 1;
|
||||||
|
protected Map<String, String> info;
|
||||||
|
|
||||||
public CardImpl(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
public CardImpl(UUID ownerId, int cardNumber, String name, Rarity rarity, CardType[] cardTypes, String costs) {
|
||||||
this(ownerId, name);
|
this(ownerId, name);
|
||||||
|
@ -107,6 +105,11 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
||||||
secondSideCard = card.secondSideCard;
|
secondSideCard = card.secondSideCard;
|
||||||
nightCard = card.nightCard;
|
nightCard = card.nightCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (card.info != null) {
|
||||||
|
info = new HashMap<String, String>();
|
||||||
|
info.putAll(card.info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (cardType.contains(CardType.INSTANT) || cardType.contains(CardType.SORCERY)) {
|
||||||
rules.add(0, getSpellAbility().getRule(this.name));
|
rules.add(0, getSpellAbility().getRule(this.name));
|
||||||
}
|
}
|
||||||
|
if (info != null) {
|
||||||
|
for (String data : info.values()) {
|
||||||
|
rules.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
return rules;
|
return rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,4 +445,12 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
|
||||||
private void updateZoneChangeCounter() {
|
private void updateZoneChangeCounter() {
|
||||||
zoneChangeCounter++;
|
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();
|
return card.getZoneChangeCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInfo(String key, String value) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
public void setCopiedSpell(boolean isCopied) {
|
public void setCopiedSpell(boolean isCopied) {
|
||||||
this.copiedSpell = isCopied;
|
this.copiedSpell = isCopied;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue