-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathCopyHeroPower.java
More file actions
24 lines (20 loc) · 926 Bytes
/
CopyHeroPower.java
File metadata and controls
24 lines (20 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
/**
* Calls {@link ChangeHeroPowerSpell} with {@link SpellArg#CARD} equal to the casting player's opponent's hero power
* card ID.
*/
public class CopyHeroPower extends ChangeHeroPowerSpell {
@Override
protected void onCast(GameContext context, Player player, SpellDesc desc, Entity source, Entity target) {
Player opponent = context.getOpponent(player);
String opponentHeroPowerId = opponent.getHeroPowerZone().get(0).getCardId();
SpellDesc newDesc = new SpellDesc(ChangeHeroPowerSpell.class);
newDesc.put(SpellArg.CARD, opponentHeroPowerId);
super.onCast(context, player, newDesc, source, target);
}
}