mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -23,9 +23,9 @@ import forge.game.player.Player;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class SpellEffect {
|
public abstract class SpellEffect {
|
||||||
|
|
||||||
public abstract void resolve(final SpellAbility sa);
|
public abstract void resolve(final SpellAbility sa);
|
||||||
|
|
||||||
protected String getStackDescription(final SpellAbility sa) {
|
protected String getStackDescription(final SpellAbility sa) {
|
||||||
// Unless overriden, let the spell description also be the stack description
|
// Unless overriden, let the spell description also be the stack description
|
||||||
return sa.getDescription();
|
return sa.getDescription();
|
||||||
@@ -33,7 +33,7 @@ import forge.game.player.Player;
|
|||||||
|
|
||||||
|
|
||||||
protected void resolveDrawback(final SpellAbility sa) {
|
protected void resolveDrawback(final SpellAbility sa) {
|
||||||
|
|
||||||
// if mana production has any type of SubAbility, undoable=false
|
// if mana production has any type of SubAbility, undoable=false
|
||||||
final AbilitySub abSub = sa.getSubAbility();
|
final AbilitySub abSub = sa.getSubAbility();
|
||||||
if (abSub != null) {
|
if (abSub != null) {
|
||||||
@@ -41,16 +41,16 @@ import forge.game.player.Player;
|
|||||||
AbilityFactory.resolve(abSub, false);
|
AbilityFactory.resolve(abSub, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this effect description with needed prelude and epilogue
|
* Returns this effect description with needed prelude and epilogue.
|
||||||
* @param params
|
* @param params
|
||||||
* @param commonSpell
|
* @param commonSpell
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public final String getStackDescriptionWithSubs(final Map<String, String> params, final SpellAbility sa) {
|
public final String getStackDescriptionWithSubs(final Map<String, String> params, final SpellAbility sa) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
// prelude for when this is root ability
|
// prelude for when this is root ability
|
||||||
if (!(sa instanceof AbilitySub)) {
|
if (!(sa instanceof AbilitySub)) {
|
||||||
sb.append(sa.getSourceCard()).append(" -");
|
sb.append(sa.getSourceCard()).append(" -");
|
||||||
@@ -59,13 +59,14 @@ import forge.game.player.Player;
|
|||||||
|
|
||||||
// Own description
|
// Own description
|
||||||
String stackDesc = params.get("StackDescription");
|
String stackDesc = params.get("StackDescription");
|
||||||
if ( stackDesc != null ) {
|
if (stackDesc != null) {
|
||||||
if ( !"None".equalsIgnoreCase(stackDesc) ) // by typing "none" they want to suppress output
|
if (!"None".equalsIgnoreCase(stackDesc)) { // by typing "none" they want to suppress output
|
||||||
sb.append( stackDesc.replace("CARDNAME", sa.getSourceCard().getName()));
|
sb.append(stackDesc.replace("CARDNAME", sa.getSourceCard().getName()));
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
sb.append(this.getStackDescription(sa));
|
sb.append(this.getStackDescription(sa));
|
||||||
|
}
|
||||||
|
|
||||||
// This inlcudes all subAbilities
|
// This inlcudes all subAbilities
|
||||||
final AbilitySub abSub = sa.getSubAbility();
|
final AbilitySub abSub = sa.getSubAbility();
|
||||||
if (abSub != null) {
|
if (abSub != null) {
|
||||||
@@ -90,31 +91,32 @@ import forge.game.player.Player;
|
|||||||
protected List<Player> getDefinedPlayersBeforeTargetOnes(SpellAbility sa) {
|
protected List<Player> getDefinedPlayersBeforeTargetOnes(SpellAbility sa) {
|
||||||
return getTargetPlayers(sa, false, false);
|
return getTargetPlayers(sa, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Each AF used its own preference in choosing target players:
|
// Each AF used its own preference in choosing target players:
|
||||||
// Some checked target first and params["Defined"] then - @see targetIsPreferred
|
// Some checked target first and params["Defined"] then - @see targetIsPreferred
|
||||||
// Some wanted empty list when params["Defined"] was not set - @see wantEmptyAsDefault
|
// Some wanted empty list when params["Defined"] was not set - @see wantEmptyAsDefault
|
||||||
// Poor me had to gather it all in a single place
|
// Poor me had to gather it all in a single place
|
||||||
private final static List<Player> emptyPlayerList = Collections.unmodifiableList(new ArrayList<Player>());
|
private static final List<Player> emptyPlayerList = Collections.unmodifiableList(new ArrayList<Player>());
|
||||||
private List<Player> getTargetPlayers(SpellAbility sa, final boolean wantEmptyAsDefault, final boolean targetIsPreferred) {
|
private List<Player> getTargetPlayers(SpellAbility sa, final boolean wantEmptyAsDefault, final boolean targetIsPreferred) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
final String defined = sa.getParam("Defined");
|
final String defined = sa.getParam("Defined");
|
||||||
if ( tgt != null && ( targetIsPreferred || ( StringUtils.isEmpty(defined) && !wantEmptyAsDefault ) ) )
|
if (tgt != null && (targetIsPreferred || (StringUtils.isEmpty(defined) && !wantEmptyAsDefault))) {
|
||||||
return tgt.getTargetPlayers();
|
return tgt.getTargetPlayers();
|
||||||
if ( StringUtils.isEmpty(defined) && wantEmptyAsDefault )
|
}
|
||||||
|
if (StringUtils.isEmpty(defined) && wantEmptyAsDefault) {
|
||||||
return emptyPlayerList;
|
return emptyPlayerList;
|
||||||
|
}
|
||||||
return AbilityFactory.getDefinedPlayers(sa.getSourceCard(), defined, sa);
|
return AbilityFactory.getDefinedPlayers(sa.getSourceCard(), defined, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<SpellAbility> getTargetSpellAbilities(SpellAbility sa) {
|
protected List<SpellAbility> getTargetSpellAbilities(SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
return tgt != null ? tgt.getTargetSAs() : AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
return tgt != null ? tgt.getTargetSAs() : AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<Object> getTargetObjects(SpellAbility sa) {
|
protected List<Object> getTargetObjects(SpellAbility sa) {
|
||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
return tgt != null ? tgt.getTargets() : AbilityFactory.getDefinedObjects(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
return tgt != null ? tgt.getTargets() : AbilityFactory.getDefinedObjects(sa.getSourceCard(), sa.getParam("Defined"), sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user