[MKM] Implement No Witnesses

This commit is contained in:
theelk801 2024-01-17 16:29:17 -05:00
parent 1a8dce83d0
commit fe97d3d77b
4 changed files with 107 additions and 14 deletions

View file

@ -10,6 +10,8 @@ import mage.game.events.GameEvent;
import mage.game.permanent.token.ClueArtifactToken;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -39,14 +41,21 @@ public class InvestigateEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
int value = this.amount.calculate(game, source, this);
if (value < 1) {
return false;
if (value > 0) {
doInvestigate(source.getControllerId(), value, game, source);
return true;
}
new ClueArtifactToken().putOntoBattlefield(value, game, source, source.getControllerId());
return false;
}
public static void doInvestigate(UUID playerId, int value, Game game, Ability source) {
new ClueArtifactToken().putOntoBattlefield(value, game, source, playerId);
for (int i = 0; i < value; i++) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, source.getControllerId()));
game.fireEvent(GameEvent.getEvent(
GameEvent.EventType.INVESTIGATED,
source.getSourceId(), source, playerId
));
}
return true;
}
@Override

View file

@ -7,8 +7,6 @@ import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.ClueArtifactToken;
import mage.players.Player;
/**
@ -43,14 +41,11 @@ public class InvestigateTargetEffect extends OneShotEffect {
return false;
}
int value = this.amount.calculate(game, source, this);
if (value < 1) {
return false;
if (value > 0) {
InvestigateEffect.doInvestigate(targetPlayer.getId(), value, game, source);
return true;
}
new ClueArtifactToken().putOntoBattlefield(value, game, source, targetPlayer.getId());
for (int i = 0; i < value; i++) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.INVESTIGATED, source.getSourceId(), source, targetPlayer.getId()));
}
return true;
return false;
}
@Override