mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
The Ring Emblem - fixed not working 3rd effect with blocker sacrifice (closes #11425), added docs and usage example for BLOCKER_DECLARED and CREATURE_BLOCKED game events
This commit is contained in:
parent
571711e67d
commit
27c9543f62
5 changed files with 33 additions and 10 deletions
|
|
@ -81,7 +81,6 @@ enum BaneLordOfDarknessCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
return Optional
|
||||
.ofNullable(game.getPlayer(source.getControllerId()))
|
||||
.filter(Objects::nonNull)
|
||||
.map(Player::getLife)
|
||||
.map(x -> 2 * x <= game.getStartingLife())
|
||||
.orElse(false);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ public abstract class VillainousChoice {
|
|||
}
|
||||
String controllerName = Optional
|
||||
.ofNullable(game.getPlayer(source.getControllerId()))
|
||||
.filter(Objects::nonNull)
|
||||
.map(Player::getName)
|
||||
.orElse("Opponent");
|
||||
return message.replace("{controller}", controllerName);
|
||||
|
|
|
|||
|
|
@ -3963,6 +3963,7 @@ public abstract class GameImpl implements Game {
|
|||
public String toString() {
|
||||
Player activePayer = this.getPlayer(this.getActivePlayerId());
|
||||
StringBuilder sb = new StringBuilder()
|
||||
.append(this.isSimulation() ? "!!!SIMULATION!!! " : "")
|
||||
.append(this.getGameType().toString())
|
||||
.append("; ").append(CardUtil.getTurnInfo(this))
|
||||
.append("; active: ").append((activePayer == null ? "none" : activePayer.getName()))
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import mage.players.Player;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.common.TemptedByTheRingWatcher;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -71,7 +69,7 @@ public final class TheRingEmblem extends Emblem {
|
|||
).setTriggerPhrase("Whenever your Ring-bearer attacks, ");
|
||||
break;
|
||||
case 2:
|
||||
logText ="Whenever your Ring-bearer becomes blocked by a creature, that creature's controller sacrifices it at end of combat.";
|
||||
logText = "Whenever your Ring-bearer becomes blocked by a creature, that creature's controller sacrifices it at end of combat.";
|
||||
ability = new TheRingEmblemTriggeredAbility();
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -91,9 +89,9 @@ public final class TheRingEmblem extends Emblem {
|
|||
game.getState().addAbility(ability, this);
|
||||
|
||||
String name = "";
|
||||
if(controllerId != null){
|
||||
if (controllerId != null) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if(player != null){
|
||||
if (player != null) {
|
||||
name = player.getLogName();
|
||||
}
|
||||
}
|
||||
|
|
@ -130,7 +128,6 @@ class TheRingEmblemLegendaryEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = Optional
|
||||
.ofNullable(game.getPlayer(source.getControllerId()))
|
||||
.filter(Objects::nonNull)
|
||||
.map(player -> player.getRingBearer(game))
|
||||
.orElse(null);
|
||||
if (permanent == null) {
|
||||
|
|
@ -186,7 +183,7 @@ class TheRingEmblemTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CREATURE_BLOCKED;
|
||||
return event.getType() == GameEvent.EventType.BLOCKER_DECLARED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -195,7 +192,7 @@ class TheRingEmblemTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Permanent blocker = game.getPermanent(event.getSourceId());
|
||||
if (attacker == null
|
||||
|| blocker == null
|
||||
|| attacker.isControlledBy(getControllerId())
|
||||
|| !attacker.isControlledBy(getControllerId())
|
||||
|| !attacker.isRingBearer()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,13 +307,40 @@ public class GameEvent implements Serializable {
|
|||
DECLARING_BLOCKERS,
|
||||
DECLARED_BLOCKERS,
|
||||
DECLARE_BLOCKER,
|
||||
|
||||
/* BLOCKER_DECLARED
|
||||
raise one time for each declared blocker (e.g. multiple events per attacker allows)
|
||||
|
||||
warning, must use for rules: becomes blocked by a creature
|
||||
|
||||
rules ref:
|
||||
Acolyte of the Inferno’s last ability will trigger once for each creature that blocks it.
|
||||
Each of those creatures will be dealt 2 damage.
|
||||
(2015-06-22)
|
||||
|
||||
targetId attacker id
|
||||
sourceId blocker id
|
||||
playerId blocker controller id
|
||||
*/
|
||||
BLOCKER_DECLARED,
|
||||
|
||||
/* CREATURE_BLOCKED
|
||||
raise one time per attacker (e.g. only one event per attacker allows)
|
||||
|
||||
warning, must use for rules: xxx becomes blocked,
|
||||
|
||||
rules ref:
|
||||
Rakdos Roustabout
|
||||
An ability that triggers when a creature becomes blocked triggers only once
|
||||
if two or more creatures block it.
|
||||
(2019-01-25)
|
||||
|
||||
targetId attacker id
|
||||
sourceId not used for this event
|
||||
playerId not used for this event
|
||||
*/
|
||||
CREATURE_BLOCKED,
|
||||
|
||||
CREATURE_BLOCKS,
|
||||
BATCH_BLOCK_NONCOMBAT,
|
||||
UNBLOCKED_ATTACKER,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue