mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
small complexity rewrite
This commit is contained in:
parent
d9ace1b66f
commit
b704618f32
2 changed files with 8 additions and 15 deletions
|
@ -35,14 +35,10 @@ public enum GetKickerXValue implements DynamicValue {
|
|||
|
||||
// search that kicker used X value
|
||||
KickerAbility kickerAbility = (KickerAbility) ability;
|
||||
boolean haveVarCost = false;
|
||||
for (OptionalAdditionalCost cost : kickerAbility.getKickerCosts()) {
|
||||
List<VariableCost> varCosts = ((OptionalAdditionalCostImpl) cost).getVariableCosts();
|
||||
if (!varCosts.isEmpty()) {
|
||||
haveVarCost = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
boolean haveVarCost = kickerAbility.getKickerCosts()
|
||||
.stream()
|
||||
.anyMatch(varCost -> !((OptionalAdditionalCostImpl) varCost).getVariableCosts().isEmpty());
|
||||
|
||||
|
||||
if (haveVarCost) {
|
||||
int kickedCount = ((KickerAbility) ability).getKickedCounter(game, source);
|
||||
|
|
|
@ -3049,13 +3049,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
protected boolean canLandPlayAlternateSourceCostsAbility(Card sourceObject, ManaOptions available, Ability
|
||||
ability, Game game) {
|
||||
if (!(sourceObject instanceof Permanent)) {
|
||||
Ability sourceAbility = null;
|
||||
for (Ability landAbility : sourceObject.getAbilities()) {
|
||||
if (landAbility.getAbilityType() == AbilityType.PLAY_LAND) {
|
||||
sourceAbility = landAbility;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ability sourceAbility = sourceObject.getAbilities().stream()
|
||||
.filter(landAbility -> landAbility.getAbilityType() == AbilityType.PLAY_LAND)
|
||||
.findFirst().orElse(null);
|
||||
|
||||
if (sourceAbility != null && ((AlternativeSourceCosts) ability).isAvailable(sourceAbility, game)) {
|
||||
if (ability.getCosts().canPay(ability, sourceObject.getId(), this.getId(), game)) {
|
||||
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
||||
|
|
Loading…
Reference in a new issue