-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathComboSpell.java
More file actions
32 lines (27 loc) · 1.16 KB
/
ComboSpell.java
File metadata and controls
32 lines (27 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package net.demilich.metastone.game.spells;
import net.demilich.metastone.game.GameContext;
import net.demilich.metastone.game.Player;
import net.demilich.metastone.game.entities.Entity;
import net.demilich.metastone.game.spells.desc.SpellArg;
import net.demilich.metastone.game.spells.desc.SpellDesc;
import net.demilich.metastone.game.cards.Attribute;
import java.util.Map;
/**
* Shorthand for a {@link ConditionalEffectSpell} that only plays the spell if the player has activated a combo (i.e.,
* previously played a card earlier this turn).
*
* @see ConditionalEffectSpell for how to write this spell.
*/
public final class ComboSpell extends ConditionalEffectSpell {
public static SpellDesc create(SpellDesc either, SpellDesc or, boolean exclusive) {
Map<SpellArg, Object> arguments = new SpellDesc(ComboSpell.class);
arguments.put(SpellArg.SPELL1, either);
arguments.put(SpellArg.SPELL2, or);
arguments.put(SpellArg.EXCLUSIVE, exclusive);
return new SpellDesc(arguments);
}
@Override
protected boolean isConditionFulfilled(GameContext context, Player player, SpellDesc desc, Entity source, Entity target) {
return player.hasAttribute(Attribute.COMBO);
}
}