mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
fix Molten Disaster (#12307)
* add test case * unify KickedCondition for battlefield and stack usage * cleanup Molten Disaster to common classes
This commit is contained in:
parent
69e9f3de8a
commit
bdebf7020c
8 changed files with 164 additions and 141 deletions
|
|
@ -24,7 +24,8 @@ public enum KickedCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return KickerAbility.getKickedCounter(game, source) >= kickedCount;
|
||||
return KickerAbility.getKickedCounter(game, source) >= kickedCount // for on battlefield
|
||||
|| KickerAbility.getSpellKickedCount(game, source.getSourceId()) >= kickedCount; // for on stack
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -105,9 +105,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
|
||||
private void addKickerCostAndSetup(OptionalAdditionalCost newCost) {
|
||||
this.kickerCosts.add(newCost);
|
||||
this.kickerCosts.forEach(cost -> {
|
||||
cost.setCostType(VariableCostType.ADDITIONAL);
|
||||
});
|
||||
this.kickerCosts.forEach(cost -> cost.setCostType(VariableCostType.ADDITIONAL));
|
||||
}
|
||||
|
||||
private void resetKicker() {
|
||||
|
|
@ -124,10 +122,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
* Return total kicker activations with the specified Cost (blank for all kickers/multikickers)
|
||||
* Checks the start of the tags, to work for that blank method, which requires direct access
|
||||
*
|
||||
* @param game
|
||||
* @param source
|
||||
* @param needKickerCost use cost.getText(true)
|
||||
* @return
|
||||
*/
|
||||
public static int getKickedCounterStrict(Game game, Ability source, String needKickerCost) {
|
||||
Map<String, Object> costsTags = CardUtil.getSourceCostsTagsMap(game, source);
|
||||
|
|
@ -148,10 +143,6 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
|
||||
/**
|
||||
* Return total kicker activations (kicker + multikicker)
|
||||
*
|
||||
* @param game
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static int getKickedCounter(Game game, Ability source) {
|
||||
return getKickedCounterStrict(game, source, "");
|
||||
|
|
@ -159,10 +150,6 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
|
||||
/**
|
||||
* If spell was kicked
|
||||
*
|
||||
* @param game
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public boolean isKicked(Game game, Ability source) {
|
||||
return isKicked(game, source, "");
|
||||
|
|
@ -171,10 +158,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
/**
|
||||
* If spell was kicked by specific kicker cost
|
||||
*
|
||||
* @param game
|
||||
* @param source
|
||||
* @param needKickerCost use cost.getText(true)
|
||||
* @return
|
||||
*/
|
||||
public boolean isKicked(Game game, Ability source, String needKickerCost) {
|
||||
return getKickedCounterStrict(game, source, needKickerCost) > 0;
|
||||
|
|
@ -287,10 +271,6 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
|
||||
/**
|
||||
* Find spell's kicked stats. Must be used on stack only, e.g. for SPELL_CAST events
|
||||
*
|
||||
* @param game
|
||||
* @param spellId
|
||||
* @return
|
||||
*/
|
||||
public static int getSpellKickedCount(Game game, UUID spellId) {
|
||||
Spell spell = game.getSpellOrLKIStack(spellId);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package mage.abilities.keyword;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -37,9 +39,13 @@ public class SplitSecondAbility extends SimpleStaticAbility {
|
|||
public SplitSecondAbility copy() {
|
||||
return new SplitSecondAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Molten Disaster has a copy of this effect in it's class, so in case this effect has to be changed check also there
|
||||
// For abilities that need the effect conditionally. Must set text manually.
|
||||
public static ConditionalContinuousRuleModifyingEffect getSplitSecondEffectWithCondition(Condition condition) {
|
||||
return new ConditionalContinuousRuleModifyingEffect(new SplitSecondEffect(), condition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class SplitSecondEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue