foul-magics/Mage/src/main/java/mage/abilities/effects/common/RevealHandSourceControllerEffect.java
Evan Kranzler 80e11b2052
(WIP) Replacing blocking/blocked by predicates (#8729)
* replaced blocking/blocked by predicates

* added test for knight of dusk (currently fails)

* added source parameter to filters and everything else that needs it

* some changes to various predicates

* test fix

* small changes to filter code

* merge fix

* fixed a test failure

* small change to Karn, Scion of Urza

* removed sourceId from filter methods and other similar places

* added new getobject method to fix some test failures

* a few more fixes

* fixed merge conflicts

* merge fix
2022-03-23 18:45:02 -04:00

41 lines
1.1 KiB
Java

package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author noahg
*/
public class RevealHandSourceControllerEffect extends OneShotEffect {
public RevealHandSourceControllerEffect() {
super(Outcome.Discard);
this.staticText = "reveal your hand";
}
public RevealHandSourceControllerEffect(final RevealHandSourceControllerEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source);
if (player != null && sourceObject != null) {
player.revealCards(sourceObject.getIdName(), player.getHand(), game);
return true;
}
return false;
}
@Override
public RevealHandSourceControllerEffect copy() {
return new RevealHandSourceControllerEffect(this);
}
}