Buggy code:
} if ( ! ( activateAlternateOrAdditionalCosts ( sourceObject , noMana , controller , game ) ) ) { if ( ( getAbilityType ( ) . equals ( SPELL ) ) && ( ( ( SpellAbility ) ( this ) ) . getSpellAbilityType ( ) . equals ( LAND_ALTERNATE ) ) ) { return false ; } } VariableManaCost variableManaCost = handleManaXCosts ( game , noMana , controller ) ; String announceString = handleOtherXCosts ( game , controller ) ; for ( UUID modeId : this . getModes ( ) . getSelectedModes ( ) ) { this . getModes ( ) . setMode ( this . getModes ( ) . get ( modeId ) ) ; if ( ( ( sourceObject ) != null ) && ( ! ( this . getAbilityType ( ) . equals ( TRIGGERED ) ) ) ) { sourceObject . adjustTargets ( this , game ) ; } if ( ( ( getTargets ( ) . size ( ) ) > 0 ) && ( ( getTargets ( ) . chooseTargets ( getEffects ( ) . get ( 0 ) . getOutcome ( ) , this . controllerId , this , game ) ) == false ) ) { if ( ( variableManaCost != null ) || ( announceString != null ) ) { game . informPlayer ( controller , new StringBuilder ( ( ( sourceObject ) != null ? sourceObject . getLogName ( ) : "" ) ) . append ( ":<seq2seq4repair_space>no<seq2seq4repair_space>valid<seq2seq4repair_space>targets<seq2seq4repair_space>with<seq2seq4repair_space>this<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>X" ) . toString ( ) ) ; } return false ; } } for ( Cost cost : optionalCosts ) { if ( cost instanceof ManaCost ) { cost . clearPaid ( ) ; if ( controller . chooseUse ( Benefit , ( ( "Pay<seq2seq4repair_space>optional<seq2seq4repair_space>cost<seq2seq4repair_space>" + ( cost . getText ( ) ) ) + "?" ) , game ) ) { manaCostsToPay . add ( ( ( ManaCost ) ( cost ) ) ) ; } } } if ( ( sourceObject ) != null ) { sourceObject . adjustCosts ( this , game ) ; for ( Ability ability : sourceObject . getAbilities ( ) ) { if ( ability instanceof AdjustingSourceCosts ) { ( ( AdjustingSourceCosts ) ( ability ) ) . adjustCosts ( this , game ) ; } } } if ( ( ( this ) instanceof ManaAbility ) && ( ! ( costs . pay ( this , game , sourceId , controllerId , noMana ) ) ) ) { AbilityImpl . logger . debug ( "activate<seq2seq4repair_space>mana<seq2seq4repair_space>ability<seq2seq4repair_space>failed<seq2seq4repair_space>-<seq2seq4repair_space>non<seq2seq4repair_space>mana<seq2seq4repair_space>costs" ) ; return false ; } if ( costModificationActive ) { game . getContinuousEffects ( ) . costModification ( this , game ) ; } else { costModificationActive = true ; } UUID activatorId = controllerId ; if ( ( ( this ) instanceof ActivatedAbilityImpl ) && ( ( ( ( ActivatedAbilityImpl ) ( this ) ) . getActivatorId ( ) ) != null ) ) { activatorId = ( ( ActivatedAbilityImpl ) ( this ) ) . getActivatorId ( ) ; } if ( ! ( useAlternativeCost ( game ) ) ) { if ( ! ( manaCostsToPay . pay ( this , game , sourceId , activatorId , false ) ) ) { return false ; } } if ( ! ( costs . pay ( this , game , sourceId , activatorId , noMana ) ) ) { AbilityImpl . logger . debug ( "activate<seq2seq4repair_space>failed<seq2seq4repair_space>-<seq2seq4repair_space>non<seq2seq4repair_space>mana<seq2seq4repair_space>costs" ) ; return false ; } if ( announceString != null ) { game . informPlayers ( announceString ) ; } if ( variableManaCost != null ) { int xValue = getManaCostsToPay ( ) . getX ( ) ; game . informPlayers ( new StringBuilder ( controller . getName ( ) ) . append ( "<seq2seq4repair_space>announces<seq2seq4repair_space>a<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>" ) . append ( xValue ) . append ( "<seq2seq4repair_space>for<seq2seq4repair_space>" ) . append ( variableManaCost . getText ( ) ) . toString ( ) ) ; } activated = true ; if ( this . getAbilityType ( ) . equals ( MANA ) ) { for ( Cost cost : costs ) { if ( cost instanceof TapSourceCost ) { Mana mana = null ; Effect effect = getEffects ( ) . get ( 0 ) ; if ( effect instanceof BasicManaEffect ) { mana = ( ( BasicManaEffect ) ( effect ) ) . getMana ( game , this ) ; } else if ( effect instanceof DynamicManaEffect ) { mana = ( ( DynamicManaEffect ) ( effect ) ) . getMana ( game , this ) ; } <START_BUG> if ( mana != null ) { <END_BUG> ManaEvent event = new ManaEvent ( EventType . TAPPED_FOR_MANA , sourceId , sourceId , controllerId , mana ) ; if ( ! ( game . replaceEvent ( event ) ) ) { game . fireEvent ( event ) ; } } break ; } } } return true ; } @ Override public boolean isActivated ( ) { } @ Override public boolean activateAlternateOrAdditionalCosts ( MageObject sourceObject , boolean noMana , Player controller , Game game ) { } protected String handleOtherXCosts ( Game game , Player controller ) { } protected VariableManaCost handleManaXCosts ( Game game , boolean noMana , Player controller ) { } @ Override public void reset ( Game game ) { } protected boolean useAlternativeCost ( Game game ) { } @ Override public boolean checkIfClause ( Game game ) { } @ Override public UUID getControllerId ( ) { } @ Override public void setControllerId ( UUID controllerId ) { } @ Override public UUID getSourceId ( ) { } @ Override public void setSourceId ( UUID sourceId ) { } @ Override public Costs < Cost > getCosts ( ) { } @ Override public ManaCosts < ManaCost > getManaCosts ( ) { } @ Override public ManaCosts < ManaCost > getManaCostsToPay ( ) { } @ Override public List < AlternativeCost > getAlternativeCosts ( ) { } @ Override public Costs < Cost > getOptionalCosts ( ) { }

Fix:
if ( ( mana != null ) && ( ( mana . getAny ( ) ) == 0 ) ) {