(final Card c, final SpellAbility sa, final boolean regenerate, Map<AbilityKey, Object> params)
| 2133 | } |
| 2134 | |
| 2135 | public final boolean destroy(final Card c, final SpellAbility sa, final boolean regenerate, Map<AbilityKey, Object> params) { |
| 2136 | if (!c.canBeDestroyed()) { |
| 2137 | return false; |
| 2138 | } |
| 2139 | |
| 2140 | final Map<AbilityKey, Object> repRunParams = AbilityKey.mapFromAffected(c); |
| 2141 | repRunParams.put(AbilityKey.Cause, sa); |
| 2142 | repRunParams.put(AbilityKey.Regeneration, regenerate); |
| 2143 | if (params != null) { |
| 2144 | repRunParams.putAll(params); |
| 2145 | } |
| 2146 | if (game.getReplacementHandler().run(ReplacementType.Destroy, repRunParams) != ReplacementResult.NotReplaced) { |
| 2147 | return false; |
| 2148 | } |
| 2149 | |
| 2150 | Player activator = null; |
| 2151 | if (sa != null) { |
| 2152 | activator = sa.getActivatingPlayer(); |
| 2153 | } |
| 2154 | |
| 2155 | //for animation |
| 2156 | c.updateWasDestroyed(true); |
| 2157 | // Play the Destroy sound |
| 2158 | game.fireEvent(new GameEventCardDestroyed()); |
| 2159 | |
| 2160 | final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c); |
| 2161 | runParams.put(AbilityKey.Causer, activator); |
| 2162 | if (params != null) { |
| 2163 | runParams.putAll(params); |
| 2164 | } |
| 2165 | game.getTriggerHandler().runTrigger(TriggerType.Destroyed, runParams, false); |
| 2166 | |
| 2167 | final Card sacrificed = sacrificeDestroy(c, sa, params); |
| 2168 | return sacrificed != null; |
| 2169 | } |
| 2170 | |
| 2171 | /** |
| 2172 | * @return the sacrificed Card in its new location, or {@code null} if the |
no test coverage detected