* Finished to change ReplacementEffects for UNTAP event to ContinuousRuleModifyingEffect.

This commit is contained in:
LevelX2 2014-07-29 17:45:48 +02:00
parent ea1a098300
commit 1f51d243ec
74 changed files with 309 additions and 244 deletions

View file

@ -593,18 +593,31 @@ public class ContinuousEffects implements Serializable {
}
}
/**
* Checks if an event wont't happen because of an rule modifying effect
*
* @param event
* @param game
* @param checkPlayableMode true if the event does not really happen but it#s checked if the event would be replaced
* @return
*/
public boolean preventedByRuleModification(GameEvent event, Game game, boolean checkPlayableMode) {
for (ContinuousRuleModifiyingEffect effect: continuousRuleModifyingEffects) {
for (Ability ability : continuousRuleModifyingEffects.getAbility(effect.getId())) {
if (!(ability instanceof StaticAbility) || ability.isInUseableZone(game, null, false)) {
if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
if (effect.applies(event, ability, checkPlayableMode, game)) {
if (effect.applies(event, ability, game)) {
if (!checkPlayableMode) {
String message = effect.getInfoMessage(ability, game);
String message = effect.getInfoMessage(ability, event, game);
if (message != null && !message.isEmpty()) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
game.informPlayer(player, message);
if (effect.sendMessageToUser()) {
Player player = game.getPlayer(event.getPlayerId());
if (player != null) {
game.informPlayer(player, message);
}
}
if (effect.sendMessageToGameLog()) {
game.informPlayers(message);
}
}
}