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:
xenohedron 2024-05-27 17:25:02 -04:00 committed by GitHub
parent 69e9f3de8a
commit bdebf7020c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 164 additions and 141 deletions

View file

@ -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);