mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
updated abilities which trigger off of a coin flip
This commit is contained in:
parent
2e1c4a054e
commit
57a362ae29
6 changed files with 69 additions and 54 deletions
|
|
@ -5,10 +5,10 @@ import mage.abilities.TriggeredAbilityImpl;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.CoinFlippedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class WinsCoinFlipTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
|
@ -33,7 +33,8 @@ public class WinsCoinFlipTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getFlag();
|
||||
CoinFlippedEvent flipEvent = (CoinFlippedEvent) event;
|
||||
return flipEvent.isWinnable() && (flipEvent.getChosen() == flipEvent.getResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,13 +2,16 @@ package mage.game.events;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
**/
|
||||
public class CoinFlippedEvent extends GameEvent {
|
||||
private final boolean result;
|
||||
private final boolean chosen;
|
||||
private final boolean winnable;
|
||||
|
||||
CoinFlippedEvent(UUID playerId, UUID sourceId, boolean result, boolean chosen, boolean winnable) {
|
||||
super(EventType.FLIP_COIN, playerId, sourceId, playerId);
|
||||
super(EventType.COIN_FLIPPED, playerId, sourceId, playerId);
|
||||
this.result = result;
|
||||
this.chosen = chosen;
|
||||
this.winnable = winnable;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package mage.game.events;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
**/
|
||||
public class FlipCoinEvent extends GameEvent {
|
||||
private boolean result;
|
||||
private final boolean chosen;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue