mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring
This commit is contained in:
@@ -276,7 +276,7 @@ public final class GameActionUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
// set the cost to this directly to buypass non mana cost
|
||||
// set the cost to this directly to bypass non mana cost
|
||||
final SpellAbility newSA = sa.copyWithDefinedCost("Discard<1/CARDNAME>");
|
||||
newSA.setActivatingPlayer(activator);
|
||||
newSA.putParam("CostDesc", ManaCostParser.parse("0"));
|
||||
@@ -295,6 +295,32 @@ public final class GameActionUtil {
|
||||
alternatives.add(newSA);
|
||||
}
|
||||
}
|
||||
if (sa.hasParam("Equip") && activator.hasKeyword("You may pay 0 rather than pay equip costs.")) {
|
||||
for (final KeywordInterface inst : source.getKeywords()) {
|
||||
// need to find the correct Keyword from which this Ability is from
|
||||
if (!inst.getAbilities().contains(sa)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// set the cost to this directly to bypass non mana cost
|
||||
SpellAbility newSA = sa.copyWithDefinedCost("0");
|
||||
newSA.setActivatingPlayer(activator);
|
||||
newSA.putParam("CostDesc", ManaCostParser.parse("0"));
|
||||
|
||||
// need to build a new Keyword to get better Reminder Text
|
||||
String data[] = inst.getOriginal().split(":");
|
||||
data[1] = "0";
|
||||
KeywordInterface newKi = Keyword.getInstance(StringUtils.join(data, ":"));
|
||||
|
||||
// makes new SpellDescription
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(newSA.getCostDescription());
|
||||
sb.append("(").append(newKi.getReminderText()).append(")");
|
||||
newSA.setDescription(sb.toString());
|
||||
|
||||
alternatives.add(newSA);
|
||||
}
|
||||
}
|
||||
|
||||
return alternatives;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
this.name = fName;
|
||||
this.effectiveDate = effectiveDate;
|
||||
|
||||
if(sets != null) {
|
||||
if (sets != null) {
|
||||
StaticData data = StaticData.instance();
|
||||
Set<String> parsedSets = new HashSet<>();
|
||||
for (String set : sets) {
|
||||
@@ -129,10 +129,9 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
continue;
|
||||
}
|
||||
parsedSets.add(set);
|
||||
|
||||
}
|
||||
allowedSetCodes = Lists.newArrayList(parsedSets);
|
||||
}else{
|
||||
} else {
|
||||
allowedSetCodes = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -183,7 +182,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
}
|
||||
|
||||
private static Date parseDate(String date) {
|
||||
if( date.length() <= 7 )
|
||||
if (date.length() <= 7)
|
||||
date = date + "-01";
|
||||
try {
|
||||
return formatter.parse(date);
|
||||
@@ -192,7 +191,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
}
|
||||
}
|
||||
|
||||
public Date getEffectiveDate() { return effectiveDate; }
|
||||
public Date getEffectiveDate() { return effectiveDate; }
|
||||
|
||||
public FormatType getFormatType() {
|
||||
return this.formatType;
|
||||
@@ -299,10 +298,9 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
|
||||
if (other.formatType != formatType){
|
||||
return formatType.compareTo(other.formatType);
|
||||
}else{
|
||||
if (other.formatSubType != formatSubType){
|
||||
return formatSubType.compareTo(other.formatSubType);
|
||||
}
|
||||
}
|
||||
if (other.formatSubType != formatSubType){
|
||||
return formatSubType.compareTo(other.formatSubType);
|
||||
}
|
||||
if (formatType.equals(FormatType.HISTORIC)){
|
||||
int compareDates = this.effectiveDate.compareTo(other.effectiveDate);
|
||||
@@ -342,7 +340,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
|
||||
@Override
|
||||
protected GameFormat read(File file) {
|
||||
if(!includeHistoric && !coreFormats.contains(file.getName())){
|
||||
if (!includeHistoric && !coreFormats.contains(file.getName())) {
|
||||
return null;
|
||||
}
|
||||
final Map<String, List<String>> contents = FileSection.parseSections(FileUtil.readFile(file));
|
||||
@@ -391,17 +389,17 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
}
|
||||
|
||||
Boolean strRestrictedLegendary = section.getBoolean("restrictedlegendary");
|
||||
if ( strRestrictedLegendary != null ) {
|
||||
if (strRestrictedLegendary != null) {
|
||||
restrictedLegendary = strRestrictedLegendary;
|
||||
}
|
||||
|
||||
strCars = section.get("additional");
|
||||
if ( strCars != null ) {
|
||||
if (strCars != null) {
|
||||
additionalCards = Arrays.asList(strCars.split("; "));
|
||||
}
|
||||
|
||||
strCars = section.get("rarities");
|
||||
if ( strCars != null ) {
|
||||
if (strCars != null) {
|
||||
CardRarity cr;
|
||||
rarities = Lists.newArrayList();
|
||||
for (String s: strCars.split(", ")) {
|
||||
@@ -453,8 +451,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
|
||||
public Iterable<GameFormat> getSanctionedList() {
|
||||
List<GameFormat> coreList = new ArrayList<>();
|
||||
for(GameFormat format: naturallyOrdered){
|
||||
if(format.getFormatType().equals(FormatType.SANCTIONED)){
|
||||
for (GameFormat format: naturallyOrdered) {
|
||||
if (format.getFormatType().equals(FormatType.SANCTIONED)){
|
||||
coreList.add(format);
|
||||
}
|
||||
}
|
||||
@@ -463,8 +461,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
|
||||
public Iterable<GameFormat> getFilterList() {
|
||||
List<GameFormat> coreList = new ArrayList<>();
|
||||
for(GameFormat format: naturallyOrdered){
|
||||
if(!format.getFormatType().equals(FormatType.HISTORIC)
|
||||
for (GameFormat format: naturallyOrdered) {
|
||||
if (!format.getFormatType().equals(FormatType.HISTORIC)
|
||||
&&!format.getFormatType().equals(FormatType.DIGITAL)){
|
||||
coreList.add(format);
|
||||
}
|
||||
@@ -474,8 +472,8 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
|
||||
public Iterable<GameFormat> getHistoricList() {
|
||||
List<GameFormat> coreList = new ArrayList<>();
|
||||
for(GameFormat format: naturallyOrdered){
|
||||
if(format.getFormatType().equals(FormatType.HISTORIC)){
|
||||
for (GameFormat format: naturallyOrdered) {
|
||||
if (format.getFormatType().equals(FormatType.HISTORIC)){
|
||||
coreList.add(format);
|
||||
}
|
||||
}
|
||||
@@ -484,10 +482,10 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
|
||||
public Map<String, List<GameFormat>> getHistoricMap() {
|
||||
Map<String, List<GameFormat>> coreList = new HashMap<>();
|
||||
for(GameFormat format: naturallyOrdered){
|
||||
if(format.getFormatType().equals(FormatType.HISTORIC)){
|
||||
for (GameFormat format: naturallyOrdered){
|
||||
if (format.getFormatType().equals(FormatType.HISTORIC)){
|
||||
String alpha = format.getName().substring(0,1);
|
||||
if(!coreList.containsKey(alpha)){
|
||||
if (!coreList.containsKey(alpha)) {
|
||||
coreList.put(alpha,new ArrayList<>());
|
||||
}
|
||||
coreList.get(alpha).add(format);
|
||||
@@ -549,7 +547,7 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
SortedSet<GameFormat> result = new TreeSet<>();
|
||||
Set<FormatSubType> coveredTypes = new HashSet<>();
|
||||
CardPool allCards = deck.getAllCardsInASinglePool();
|
||||
for(GameFormat gf : reverseDateOrdered) {
|
||||
for (GameFormat gf : reverseDateOrdered) {
|
||||
if (gf.getFormatType().equals(FormatType.DIGITAL) && !exhaustive){
|
||||
//exclude Digital formats from lists for now
|
||||
continue;
|
||||
@@ -587,13 +585,12 @@ public class GameFormat implements Comparable<GameFormat> {
|
||||
}
|
||||
if (gf2.formatType != gf1.formatType){
|
||||
return gf1.formatType.compareTo(gf2.formatType);
|
||||
}else{
|
||||
if (gf2.formatSubType != gf1.formatSubType){
|
||||
return gf1.formatSubType.compareTo(gf2.formatSubType);
|
||||
}
|
||||
}
|
||||
if (gf2.formatSubType != gf1.formatSubType){
|
||||
return gf1.formatSubType.compareTo(gf2.formatSubType);
|
||||
}
|
||||
if (gf1.formatType.equals(FormatType.HISTORIC)){
|
||||
if(gf1.effectiveDate!=gf2.effectiveDate) {//for matching dates or default dates default to name sorting
|
||||
if (gf1.effectiveDate!=gf2.effectiveDate) {//for matching dates or default dates default to name sorting
|
||||
return gf1.effectiveDate.compareTo(gf2.effectiveDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2200,6 +2200,10 @@ public class AbilityUtils {
|
||||
return doXMath(player.getCycledThisTurn(), expr, c, ctb);
|
||||
}
|
||||
|
||||
if (sq[0].equals("YouEquippedThisTurn")) {
|
||||
return doXMath(player.getEquippedThisTurn(), expr, c, ctb);
|
||||
}
|
||||
|
||||
if (sq[0].equals("YouDrewThisTurn")) {
|
||||
return doXMath(player.getNumDrawnThisTurn(), expr, c, ctb);
|
||||
}
|
||||
@@ -3372,6 +3376,18 @@ public class AbilityUtils {
|
||||
if (value.equals("DungeonsCompleted")) {
|
||||
return doXMath(player.getCompletedDungeons().size(), m, source, ctb);
|
||||
}
|
||||
if (value.startsWith("DungeonCompletedNamed")) {
|
||||
String [] full = value.split("_");
|
||||
String name = full[1];
|
||||
int completed = 0;
|
||||
List<Card> dungeons = player.getCompletedDungeons();
|
||||
for (Card c : dungeons) {
|
||||
if (c.getName().equals(name)) {
|
||||
++completed;
|
||||
}
|
||||
}
|
||||
return doXMath(completed, m, source, ctb);
|
||||
}
|
||||
if (value.equals("DifferentlyNamedDungeonsCompleted")) {
|
||||
int amount = 0;
|
||||
List<Card> dungeons = player.getCompletedDungeons();
|
||||
|
||||
@@ -164,6 +164,14 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect {
|
||||
final Trigger parsedTrigger = TriggerHandler.parseTrigger(AbilityUtils.getSVar(sa, s), c, false, sa);
|
||||
addedTriggers.add(parsedTrigger);
|
||||
}
|
||||
if (sa.hasParam("GainsTriggeredAbilitiesOf")) {
|
||||
final List<Card> cards = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("GainsTriggeredAbilitiesOf"), sa);
|
||||
for (final Card card : cards) {
|
||||
for (Trigger t : card.getTriggers()) {
|
||||
addedTriggers.add(t.copy(c, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// give replacement effects
|
||||
final List<ReplacementEffect> addedReplacements = Lists.newArrayList();
|
||||
|
||||
@@ -148,6 +148,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
private int investigatedThisTurn = 0;
|
||||
private int surveilThisTurn = 0;
|
||||
private int cycledThisTurn = 0;
|
||||
private int equippedThisTurn = 0;
|
||||
private int lifeLostThisTurn = 0;
|
||||
private int lifeLostLastTurn = 0;
|
||||
private int lifeGainedThisTurn = 0;
|
||||
@@ -2498,6 +2499,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
resetInvestigatedThisTurn();
|
||||
resetSurveilThisTurn();
|
||||
resetCycledThisTurn();
|
||||
resetEquippedThisTurn();
|
||||
resetSacrificedThisTurn();
|
||||
clearAssignedDamage();
|
||||
resetAttackersDeclaredThisTurn();
|
||||
@@ -3455,6 +3457,17 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
cycledThisTurn = 0;
|
||||
}
|
||||
|
||||
public void addEquipped() { equippedThisTurn++; }
|
||||
|
||||
public int getEquippedThisTurn() {
|
||||
return equippedThisTurn;
|
||||
}
|
||||
|
||||
public void resetEquippedThisTurn() {
|
||||
equippedThisTurn = 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasUrzaLands() {
|
||||
final CardCollectionView landsControlled = getCardsIn(ZoneType.Battlefield);
|
||||
return Iterables.any(landsControlled, Predicates.and(CardPredicates.isType("Urza's"), CardPredicates.isType("Mine")))
|
||||
|
||||
@@ -436,6 +436,13 @@ public class PlayerView extends GameEntityView {
|
||||
return getZoneSize(TrackableProperty.Library);
|
||||
}
|
||||
|
||||
public FCollectionView<CardView> getSideboard() {
|
||||
return get(TrackableProperty.Sideboard);
|
||||
}
|
||||
public int getSideboardSize() {
|
||||
return getZoneSize(TrackableProperty.Sideboard);
|
||||
}
|
||||
|
||||
public FCollectionView<CardView> getCards(final ZoneType zone) {
|
||||
TrackableProperty prop = getZoneProp(zone);
|
||||
if (prop != null) {
|
||||
|
||||
@@ -326,6 +326,11 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
activator.addCycled(sp);
|
||||
}
|
||||
|
||||
// Log number of Equips
|
||||
if (sp.hasParam("Equip")) {
|
||||
activator.addEquipped();
|
||||
}
|
||||
|
||||
if (sp.hasParam("Crew")) {
|
||||
// Trigger crews!
|
||||
runParams.put(AbilityKey.Vehicle, sp.getHostCard());
|
||||
|
||||
Reference in New Issue
Block a user