-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathNullSpell.java
46 lines (40 loc) · 1.41 KB
/
NullSpell.java
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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.targeting.EntityReference;
import java.util.Map;
/**
* A spell that has no effects.
* <p>
* This is useful for situations where a spell <b>must</b> be specified, like in a {@link
* net.demilich.metastone.game.cards.desc.CardDesc#spell} property in its JSON, but when no effects are intended.
* <p>
* For <b>example</b>, place the following as the {@code spell} property in the card JSON for a spell card that should
* do nothing:
* <pre>
* {
* "class": "NullSpell"
* }
* </pre>
* <p>
* This implements cards like Dimensius's Stop card ("Full Belly"), which should do nothing but still needs to be cast.
*/
public class NullSpell extends Spell {
/**
* Creates a spell that does nothing.
*
* @return The spell.
*/
public static SpellDesc create() {
Map<SpellArg, Object> arguments = new SpellDesc(NullSpell.class);
arguments.put(SpellArg.TARGET, EntityReference.NONE);
return new SpellDesc(arguments);
}
@Override
protected void onCast(GameContext context, Player player, SpellDesc desc, Entity source, Entity target) {
// intentionally do nothing
}
}