forked from External/mage
* Fixed available mana calculation for Cryptic Trilobite and Titans' Nest. Added some improvements for available mana calculation of conditional mana.
This commit is contained in:
parent
3d989b24ac
commit
768f1bec4f
100 changed files with 507 additions and 144 deletions
|
|
@ -52,7 +52,7 @@ public class ConditionalMana extends Mana implements Serializable {
|
|||
|
||||
public ConditionalMana(final ConditionalMana conditionalMana) {
|
||||
super(conditionalMana);
|
||||
conditions = conditionalMana.conditions;
|
||||
conditions.addAll(conditionalMana.conditions);
|
||||
scope = conditionalMana.scope;
|
||||
staticText = conditionalMana.staticText;
|
||||
manaProducerId = conditionalMana.manaProducerId;
|
||||
|
|
@ -67,6 +67,10 @@ public class ConditionalMana extends Mana implements Serializable {
|
|||
this.scope = scope;
|
||||
}
|
||||
|
||||
public List<Condition> getConditions() {
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public boolean apply(Ability ability, Game game, UUID manaProducerId, Cost costToPay) {
|
||||
if (conditions.isEmpty()) {
|
||||
throw new IllegalStateException("Conditional mana should contain at least one Condition");
|
||||
|
|
@ -173,6 +177,24 @@ public class ConditionalMana extends Mana implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Mana mana) {
|
||||
if (mana instanceof ConditionalMana) {
|
||||
for (Condition condition : ((ConditionalMana) mana).getConditions()) {
|
||||
addCondition(condition);
|
||||
}
|
||||
}
|
||||
super.add(mana);
|
||||
}
|
||||
|
||||
public String getConditionString() {
|
||||
String condStr = "[";
|
||||
for (Condition condition : conditions) {
|
||||
condStr += condition.getManaText();
|
||||
}
|
||||
return condStr + "]";
|
||||
}
|
||||
|
||||
public void add(ManaType manaType, int amount) {
|
||||
switch (manaType) {
|
||||
case BLACK:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue