-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathCloneMinionSpell.java
More file actions
39 lines (35 loc) · 1.24 KB
/
CloneMinionSpell.java
File metadata and controls
39 lines (35 loc) · 1.24 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
33
34
35
36
37
38
39
package net.demilich.metastone.game.spells;
import net.demilich.metastone.game.GameContext;
import net.demilich.metastone.game.Player;
import net.demilich.metastone.game.cards.Attribute;
import net.demilich.metastone.game.entities.Entity;
import net.demilich.metastone.game.entities.heroes.Hero;
import net.demilich.metastone.game.entities.minions.Minion;
import net.demilich.metastone.game.spells.desc.SpellDesc;
/**
* Clones a specified minion. Use {@link SummonSpell} instead.
* <pre>
* {
* "class": "SummonSpell",
* "target": The target that you would like to clone.
* }
* </pre>
*
* @deprecated Use SummonSpell instead.
*/
@Deprecated
public class CloneMinionSpell extends Spell {
@Override
protected void onCast(GameContext context, Player player, SpellDesc desc, Entity source, Entity target) {
// Special case Lord Jaraxxus / Mirror Image interaction
if (target instanceof Hero) {
target = context.resolveSingleTarget(context.getSummonReferenceStack().peek());
target.getAttributes().remove(Attribute.DESTROYED);
}
Minion template = (Minion) target;
Minion clone = template.getCopy();
if (context.getLogic().summon(player.getId(), clone, source, -1, false)) {
clone.setAttribute(Attribute.SUMMONING_SICKNESS);
}
}
}