forked from External/mage
refactor: added counter removal events (#11989)
This commit is contained in:
parent
860a767cca
commit
52ddcac59d
11 changed files with 385 additions and 36 deletions
33
Mage/src/main/java/mage/game/events/RemoveCountersEvent.java
Normal file
33
Mage/src/main/java/mage/game/events/RemoveCountersEvent.java
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package mage.game.events;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.players.Player;
|
||||
|
||||
public class RemoveCountersEvent extends GameEvent {
|
||||
|
||||
boolean isDamage;
|
||||
|
||||
public RemoveCountersEvent(String name, Card targetCard, Ability source, int amount, boolean isDamage){
|
||||
super(EventType.REMOVE_COUNTERS, targetCard.getId(), source,
|
||||
targetCard.getControllerOrOwnerId(), amount, false);
|
||||
|
||||
if (source != null && source.getControllerId() != null) {
|
||||
setPlayerId(source.getControllerId()); // player who controls the source ability that removed the counters
|
||||
}
|
||||
setData(name);
|
||||
this.isDamage = isDamage;
|
||||
}
|
||||
|
||||
public RemoveCountersEvent(String name, Player targetPlayer, Ability source, int amount, boolean isDamage){
|
||||
super(EventType.REMOVE_COUNTERS, targetPlayer.getId(), source,
|
||||
(source == null ? null : source.getControllerId()), amount, false);
|
||||
setData(name);
|
||||
this.isDamage = isDamage;
|
||||
}
|
||||
|
||||
boolean counterRemovedDueToDamage(){
|
||||
return this.isDamage;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue