mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- Cleanup.
This commit is contained in:
@@ -225,13 +225,6 @@ public final class AbilityFactory {
|
|||||||
abTgt.setZone(ZoneType.listValueOf(mapParams.get("TgtZone")));
|
abTgt.setZone(ZoneType.listValueOf(mapParams.get("TgtZone")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Target Type mostly for Counter: Spell,Activated,Triggered,Ability
|
|
||||||
// (or any combination of)
|
|
||||||
// Ability = both activated and triggered abilities
|
|
||||||
if (mapParams.containsKey("TargetType")) {
|
|
||||||
abTgt.setTargetSpellAbilityType(mapParams.get("TargetType"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TargetValidTargeting most for Counter: e.g. target spell that
|
// TargetValidTargeting most for Counter: e.g. target spell that
|
||||||
// targets X.
|
// targets X.
|
||||||
if (mapParams.containsKey("TargetValidTargeting")) {
|
if (mapParams.containsKey("TargetValidTargeting")) {
|
||||||
|
|||||||
@@ -1560,7 +1560,7 @@ public abstract class SpellAbility extends GameObject implements ISpellAbility {
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
for (final GameObject o : matchTgt.getTargets()) {
|
for (final GameObject o : matchTgt.getTargets()) {
|
||||||
if (matchesValid(o, splitTargetRestrictions.split(","))) {
|
if (o.isValid(splitTargetRestrictions.split(","), this.getActivatingPlayer(), this.getSourceCard())) {
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1589,24 +1589,6 @@ public abstract class SpellAbility extends GameObject implements ISpellAbility {
|
|||||||
return topSA.getSourceCard().isValid(tgt.getValidTgts(), this.getActivatingPlayer(), this.getSourceCard());
|
return topSA.getSourceCard().isValid(tgt.getValidTgts(), this.getActivatingPlayer(), this.getSourceCard());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean matchesValid(final GameObject o, final String[] valids) {
|
|
||||||
final Card srcCard = this.getSourceCard();
|
|
||||||
final Player activatingPlayer = this.getActivatingPlayer();
|
|
||||||
if (o instanceof Card) {
|
|
||||||
final Card c = (Card) o;
|
|
||||||
return c.isValid(valids, activatingPlayer, srcCard);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o instanceof Player) {
|
|
||||||
Player p = (Player) o;
|
|
||||||
if (p.isValid(valids, activatingPlayer, srcCard)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Takes one argument like Permanent.Blue+withFlying
|
// Takes one argument like Permanent.Blue+withFlying
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -1630,14 +1612,14 @@ public abstract class SpellAbility extends GameObject implements ISpellAbility {
|
|||||||
if (incR[0].equals("Spell")) {
|
if (incR[0].equals("Spell")) {
|
||||||
if (!this.isSpell())
|
if (!this.isSpell())
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (incR[0].equals("Triggered")) {
|
||||||
else if (incR[0].equals("Triggered")) {
|
|
||||||
if (!this.isTrigger())
|
if (!this.isTrigger())
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (incR[0].equals("Activated")) {
|
||||||
else if (incR[0].equals("Activated")) {
|
|
||||||
if (!(this instanceof AbilityActivated))
|
if (!(this instanceof AbilityActivated))
|
||||||
return false;
|
return false;
|
||||||
|
} else { //not a spell/ability type
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (incR.length > 1) {
|
if (incR.length > 1) {
|
||||||
|
|||||||
@@ -52,9 +52,6 @@ public class TargetRestrictions {
|
|||||||
private String uiPrompt = "";
|
private String uiPrompt = "";
|
||||||
private List<ZoneType> tgtZone = Arrays.asList(ZoneType.Battlefield);
|
private List<ZoneType> tgtZone = Arrays.asList(ZoneType.Battlefield);
|
||||||
|
|
||||||
//SpellAbility Restrictions
|
|
||||||
// Comma-separated <Spell,Activated,Triggered>
|
|
||||||
private String targetSpellAbilityType = null;
|
|
||||||
// The target SA of this SA must be targeting a Valid X
|
// The target SA of this SA must be targeting a Valid X
|
||||||
private String saValidTargeting = null;
|
private String saValidTargeting = null;
|
||||||
|
|
||||||
@@ -96,7 +93,6 @@ public class TargetRestrictions {
|
|||||||
this.minTargets = target.getMinTargets();
|
this.minTargets = target.getMinTargets();
|
||||||
this.maxTargets = target.getMaxTargets();
|
this.maxTargets = target.getMaxTargets();
|
||||||
this.tgtZone = target.getZone();
|
this.tgtZone = target.getZone();
|
||||||
this.targetSpellAbilityType = target.getTargetSpellAbilityType();
|
|
||||||
this.saValidTargeting = target.getSAValidTargeting();
|
this.saValidTargeting = target.getSAValidTargeting();
|
||||||
this.dividedAsYouChoose = target.isDividedAsYouChoose();
|
this.dividedAsYouChoose = target.isDividedAsYouChoose();
|
||||||
this.uniqueTargets = target.isUniqueTargets();
|
this.uniqueTargets = target.isUniqueTargets();
|
||||||
@@ -306,29 +302,6 @@ public class TargetRestrictions {
|
|||||||
return this.tgtZone;
|
return this.tgtZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Setter for the field <code>targetSpellAbilityType</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param tgtSAType
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
*/
|
|
||||||
public final void setTargetSpellAbilityType(final String tgtSAType) {
|
|
||||||
this.targetSpellAbilityType = tgtSAType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* Getter for the field <code>targetSpellAbilityType</code>.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a {@link java.lang.String} object.
|
|
||||||
*/
|
|
||||||
public final String getTargetSpellAbilityType() {
|
|
||||||
return this.targetSpellAbilityType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* setSAValidTargeting.
|
* setSAValidTargeting.
|
||||||
|
|||||||
@@ -204,7 +204,8 @@ public class ComputerUtil {
|
|||||||
|
|
||||||
// And lastly give some bonus points to least restrictive TargetType
|
// And lastly give some bonus points to least restrictive TargetType
|
||||||
// (Spell,Ability,Triggered)
|
// (Spell,Ability,Triggered)
|
||||||
final String tgtType = tgt.getTargetSpellAbilityType();
|
final String tgtType = sa.getParam("TargetType");
|
||||||
|
if (tgtType != null)
|
||||||
restrict -= (5 * tgtType.split(",").length);
|
restrict -= (5 * tgtType.split(",").length);
|
||||||
|
|
||||||
return restrict;
|
return restrict;
|
||||||
|
|||||||
Reference in New Issue
Block a user