mirror of
https://github.com/correl/mage.git
synced 2025-01-12 11:08:01 +00:00
Fixed build problem with OptionalAdditionalCostImpl.
This commit is contained in:
parent
f77fd14b1e
commit
05e35bcae7
3 changed files with 36 additions and 28 deletions
|
@ -30,7 +30,7 @@ package mage.abilities.costs;
|
||||||
/**
|
/**
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public interface OptionalAdditionalCost extends Costs {
|
public interface OptionalAdditionalCost extends Cost {
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.costs;
|
package mage.abilities.costs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,10 +32,7 @@ package mage.abilities.costs;
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
|
public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> extends CostsImpl<Cost> implements OptionalAdditionalCost {
|
||||||
|
|
||||||
public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> extends CostsImpl<Cost> implements OptionalAdditionalCost{
|
|
||||||
|
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String reminderText;
|
protected String reminderText;
|
||||||
|
@ -104,26 +100,26 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> e
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a text suffix for the game log, that can be added to
|
* Returns a text suffix for the game log, that can be added to the cast
|
||||||
* the cast message.
|
* message.
|
||||||
*
|
*
|
||||||
* @param position - if there are multiple costs, it's the postion the cost is set (starting with 0)
|
* @param position - if there are multiple costs, it's the postion the cost
|
||||||
|
* is set (starting with 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getCastSuffixMessage(int position) {
|
public String getCastSuffixMessage(int position) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (isActivated() && (!isRepeatable() || getActivateCount() > 0)) {
|
if (isActivated() && (!isRepeatable() || getActivateCount() > 0)) {
|
||||||
sb.append(position > 0 ? " and ":"").append(" with ");
|
sb.append(position > 0 ? " and " : "").append(" with ");
|
||||||
if (isRepeatable()) {
|
if (isRepeatable()) {
|
||||||
sb.append(getActivateCount()).append(getActivateCount() > 1? " times ":" time ");
|
sb.append(getActivateCount()).append(getActivateCount() > 1 ? " times " : " time ");
|
||||||
}
|
}
|
||||||
sb.append(name);
|
sb.append(name);
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the player intends to pay the cost, the cost will be activated
|
* If the player intends to pay the cost, the cost will be activated
|
||||||
*
|
*
|
||||||
|
@ -132,7 +128,9 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> e
|
||||||
public void activate() {
|
public void activate() {
|
||||||
activated = true;
|
activated = true;
|
||||||
++activatedCounter;
|
++activatedCounter;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the activate and count information
|
* Reset the activate and count information
|
||||||
|
@ -152,7 +150,7 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> e
|
||||||
@Override
|
@Override
|
||||||
public void setRepeatable(boolean repeatable) {
|
public void setRepeatable(boolean repeatable) {
|
||||||
this.repeatable = repeatable;
|
this.repeatable = repeatable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the cost be multiple times activated
|
* Can the cost be multiple times activated
|
||||||
|
@ -162,7 +160,9 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> e
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepeatable() {
|
public boolean isRepeatable() {
|
||||||
return repeatable;
|
return repeatable;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the cost was activated
|
* Returns if the cost was activated
|
||||||
|
@ -170,20 +170,24 @@ public class OptionalAdditionalCostImpl <T extends OptionalAdditionalCostImpl> e
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isActivated(){
|
public boolean isActivated() {
|
||||||
return activated;
|
return activated;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of times the cost was activated
|
* Returns the number of times the cost was activated
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getActivateCount(){
|
public int getActivateCount() {
|
||||||
return activatedCounter;
|
return activatedCounter;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OptionalAdditionalCostImpl copy() {
|
public OptionalAdditionalCostImpl copy() {
|
||||||
return new OptionalAdditionalCostImpl(this);
|
return new OptionalAdditionalCostImpl(this);
|
||||||
|
|
|
@ -218,15 +218,19 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
||||||
if (kickerCost.canPay(ability, sourceId, controllerId, game)
|
if (kickerCost.canPay(ability, sourceId, controllerId, game)
|
||||||
&& player.chooseUse(Outcome.Benefit, "Pay " + times + kickerCost.getText(false) + " ?", ability, game)) {
|
&& player.chooseUse(Outcome.Benefit, "Pay " + times + kickerCost.getText(false) + " ?", ability, game)) {
|
||||||
this.activateKicker(kickerCost, ability, game);
|
this.activateKicker(kickerCost, ability, game);
|
||||||
for (Iterator itKickerCost = kickerCost.iterator(); itKickerCost.hasNext();) {
|
if (kickerCost instanceof Costs) {
|
||||||
Object kickerCostObject = itKickerCost.next();
|
for (Iterator itKickerCost = ((Costs) kickerCost).iterator(); itKickerCost.hasNext();) {
|
||||||
if ((kickerCostObject instanceof Costs) || (kickerCostObject instanceof CostsImpl)) {
|
Object kickerCostObject = itKickerCost.next();
|
||||||
for (@SuppressWarnings("unchecked") Iterator<Cost> itDetails = ((Costs) kickerCostObject).iterator(); itDetails.hasNext();) {
|
if ((kickerCostObject instanceof Costs) || (kickerCostObject instanceof CostsImpl)) {
|
||||||
addKickerCostsToAbility(itDetails.next(), ability, game);
|
for (@SuppressWarnings("unchecked") Iterator<Cost> itDetails = ((Costs) kickerCostObject).iterator(); itDetails.hasNext();) {
|
||||||
|
addKickerCostsToAbility(itDetails.next(), ability, game);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addKickerCostsToAbility((Cost) kickerCostObject, ability, game);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
addKickerCostsToAbility((Cost) kickerCostObject, ability, game);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
addKickerCostsToAbility((Cost) kickerCost, ability, game);
|
||||||
}
|
}
|
||||||
again = kickerCost.isRepeatable();
|
again = kickerCost.isRepeatable();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue