mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
- Cleanup.
This commit is contained in:
@@ -225,13 +225,6 @@ public final class AbilityFactory {
|
||||
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
|
||||
// targets X.
|
||||
if (mapParams.containsKey("TargetValidTargeting")) {
|
||||
|
||||
@@ -1560,7 +1560,7 @@ public abstract class SpellAbility extends GameObject implements ISpellAbility {
|
||||
boolean result = false;
|
||||
|
||||
for (final GameObject o : matchTgt.getTargets()) {
|
||||
if (matchesValid(o, splitTargetRestrictions.split(","))) {
|
||||
if (o.isValid(splitTargetRestrictions.split(","), this.getActivatingPlayer(), this.getSourceCard())) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
@@ -1588,24 +1588,6 @@ public abstract class SpellAbility extends GameObject implements ISpellAbility {
|
||||
|
||||
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
|
||||
/**
|
||||
@@ -1630,14 +1612,14 @@ public abstract class SpellAbility extends GameObject implements ISpellAbility {
|
||||
if (incR[0].equals("Spell")) {
|
||||
if (!this.isSpell())
|
||||
return false;
|
||||
}
|
||||
else if (incR[0].equals("Triggered")) {
|
||||
} else if (incR[0].equals("Triggered")) {
|
||||
if (!this.isTrigger())
|
||||
return false;
|
||||
}
|
||||
else if (incR[0].equals("Activated")) {
|
||||
} else if (incR[0].equals("Activated")) {
|
||||
if (!(this instanceof AbilityActivated))
|
||||
return false;
|
||||
} else { //not a spell/ability type
|
||||
return false;
|
||||
}
|
||||
|
||||
if (incR.length > 1) {
|
||||
|
||||
@@ -52,9 +52,6 @@ public class TargetRestrictions {
|
||||
private String uiPrompt = "";
|
||||
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
|
||||
private String saValidTargeting = null;
|
||||
|
||||
@@ -96,7 +93,6 @@ public class TargetRestrictions {
|
||||
this.minTargets = target.getMinTargets();
|
||||
this.maxTargets = target.getMaxTargets();
|
||||
this.tgtZone = target.getZone();
|
||||
this.targetSpellAbilityType = target.getTargetSpellAbilityType();
|
||||
this.saValidTargeting = target.getSAValidTargeting();
|
||||
this.dividedAsYouChoose = target.isDividedAsYouChoose();
|
||||
this.uniqueTargets = target.isUniqueTargets();
|
||||
@@ -306,29 +302,6 @@ public class TargetRestrictions {
|
||||
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>
|
||||
* setSAValidTargeting.
|
||||
|
||||
@@ -204,8 +204,9 @@ public class ComputerUtil {
|
||||
|
||||
// And lastly give some bonus points to least restrictive TargetType
|
||||
// (Spell,Ability,Triggered)
|
||||
final String tgtType = tgt.getTargetSpellAbilityType();
|
||||
restrict -= (5 * tgtType.split(",").length);
|
||||
final String tgtType = sa.getParam("TargetType");
|
||||
if (tgtType != null)
|
||||
restrict -= (5 * tgtType.split(",").length);
|
||||
|
||||
return restrict;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user