mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
More code cleanup
This commit is contained in:
@@ -131,8 +131,9 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
public final AbilityManaPart getManaPartRecursive() {
|
||||
SpellAbility tail = this;
|
||||
while (tail != null) {
|
||||
if(tail.manaPart != null)
|
||||
if (tail.manaPart != null) {
|
||||
return tail.manaPart;
|
||||
}
|
||||
tail = tail.getSubAbility();
|
||||
}
|
||||
return null;
|
||||
@@ -140,14 +141,17 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
|
||||
public final boolean isManaAbility() {
|
||||
// Check whether spell or ability first
|
||||
if (this.isSpell())
|
||||
if (this.isSpell()) {
|
||||
return false;
|
||||
}
|
||||
// without a target
|
||||
if (this.usesTargeting()) return false;
|
||||
if (getRestrictions() != null && getRestrictions().getPlaneswalker())
|
||||
if (this.usesTargeting()) { return false; }
|
||||
if (getRestrictions() != null && getRestrictions().getPlaneswalker()) {
|
||||
return false; //Loyalty ability, not a mana ability.
|
||||
if (this.isWrapper() && ((WrappedAbility) this).getTrigger().getMode() != TriggerType.TapsForMana)
|
||||
}
|
||||
if (this.isWrapper() && ((WrappedAbility) this).getTrigger().getMode() != TriggerType.TapsForMana) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getManaPartRecursive() != null;
|
||||
}
|
||||
@@ -1127,9 +1131,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
|
||||
String[] validTgt = tr.getValidTgts();
|
||||
if (entity instanceof GameEntity && !((GameEntity) entity).isValid(validTgt, this.getActivatingPlayer(), this.getHostCard()))
|
||||
if (entity instanceof GameEntity && !((GameEntity) entity).isValid(validTgt, this.getActivatingPlayer(), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Restrictions coming from target
|
||||
return entity.canBeTargetedBy(this);
|
||||
@@ -1298,7 +1303,6 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
while (null != parent.getParent()) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
@@ -1487,10 +1491,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
targetChosen.add(card);
|
||||
|
||||
final String desc;
|
||||
|
||||
if (!card.isFaceDown()) {
|
||||
desc = this.getHostCard().getName() + " - targeting " + card;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
desc = this.getHostCard().getName() + " - targeting Morph(" + card.getUniqueNumber() + ")";
|
||||
}
|
||||
this.setStackDescription(desc);
|
||||
@@ -1533,7 +1537,6 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
return ImmutableList.<Card>of();
|
||||
}
|
||||
|
||||
|
||||
public SpellAbility getSATargetingCard() {
|
||||
return targetChosen.isTargetingAnyCard() ? this : getParentTargetingCard();
|
||||
}
|
||||
@@ -1544,8 +1547,9 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
parent = ((WrappedAbility) parent).getWrappedAbility();
|
||||
}
|
||||
while (parent != null) {
|
||||
if (parent.targetChosen.isTargetingAnyCard())
|
||||
if (parent.targetChosen.isTargetingAnyCard()) {
|
||||
return parent;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return null;
|
||||
@@ -1675,15 +1679,21 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
final String[] incR = restriction.split("\\.", 2);
|
||||
|
||||
if (incR[0].equals("Spell")) {
|
||||
if (!this.isSpell())
|
||||
if (!this.isSpell()) {
|
||||
return false;
|
||||
} else if (incR[0].equals("Triggered")) {
|
||||
if (!this.isTrigger())
|
||||
}
|
||||
}
|
||||
else if (incR[0].equals("Triggered")) {
|
||||
if (!this.isTrigger()) {
|
||||
return false;
|
||||
} else if (incR[0].equals("Activated")) {
|
||||
if (!(this instanceof AbilityActivated))
|
||||
}
|
||||
}
|
||||
else if (incR[0].equals("Activated")) {
|
||||
if (!(this instanceof AbilityActivated)) {
|
||||
return false;
|
||||
} else { //not a spell/ability type
|
||||
}
|
||||
}
|
||||
else { //not a spell/ability type
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1812,5 +1822,4 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
this.subAbility.setIntrinsic(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -222,8 +222,8 @@ public class HumanPlaySpellAbility {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean announceType() {
|
||||
// Announcing Requirements like choosing creature type or number
|
||||
private boolean announceType() {
|
||||
String announce = ability.getParam("AnnounceType");
|
||||
PlayerController pc = ability.getActivatingPlayer().getController();
|
||||
if (announce != null) {
|
||||
|
||||
Reference in New Issue
Block a user