mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
rename GameEventType to GameLogEntryType to avoid mixing up things.
This commit is contained in:
@@ -3164,7 +3164,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public final void equipCard(final Card c) {
|
||||
if (c.hasKeyword("CARDNAME can't be equipped.")) {
|
||||
getGame().getGameLog().add(GameEventType.STACK_RESOLVE, "Trying to equip " + c.getName() + " but it can't be equipped.");
|
||||
getGame().getGameLog().add(GameLogEntryType.STACK_RESOLVE, "Trying to equip " + c.getName() + " but it can't be equipped.");
|
||||
return;
|
||||
}
|
||||
if (this.hasStartOfKeyword("CantEquip")) {
|
||||
@@ -3173,7 +3173,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String[] k = parse.split(" ", 2);
|
||||
final String[] restrictions = k[1].split(",");
|
||||
if (c.isValid(restrictions, this.getController(), this)) {
|
||||
getGame().getGameLog().add(GameEventType.STACK_RESOLVE, "Trying to equip " + c.getName() + " but it can't be equipped.");
|
||||
getGame().getGameLog().add(GameLogEntryType.STACK_RESOLVE, "Trying to equip " + c.getName() + " but it can't be equipped.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3365,7 +3365,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public final void enchantEntity(final GameEntity entity) {
|
||||
if (entity.hasKeyword("CARDNAME can't be enchanted.")) {
|
||||
getGame().getGameLog().add(GameEventType.STACK_RESOLVE, "Trying to enchant " + entity.getName()
|
||||
getGame().getGameLog().add(GameLogEntryType.STACK_RESOLVE, "Trying to enchant " + entity.getName()
|
||||
+ " but it can't be enchanted.");
|
||||
return;
|
||||
}
|
||||
@@ -7409,7 +7409,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
game.fireEvent(new GameEventCardDamaged());
|
||||
}
|
||||
|
||||
getGame().getGameLog().add(GameEventType.DAMAGE, String.format("Dealing %d damage to %s. %s", damageToAdd, this.getName(), additionalLog));
|
||||
getGame().getGameLog().add(GameLogEntryType.DAMAGE, String.format("Dealing %d damage to %s. %s", damageToAdd, this.getName(), additionalLog));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GameLog extends MyObservable {
|
||||
* @param message the message
|
||||
* @param type the level
|
||||
*/
|
||||
public void add(final GameEventType type, final String message) {
|
||||
public void add(final GameLogEntryType type, final String message) {
|
||||
log.add(new GameLogEntry(type, message));
|
||||
this.updateObservers();
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class GameLog extends MyObservable {
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
public String getLogText(final GameEventType logLevel) {
|
||||
public String getLogText(final GameLogEntryType logLevel) {
|
||||
List<GameLogEntry> filteredAndReversed = getLogEntries(logLevel);
|
||||
return StringUtils.join(filteredAndReversed, "\r\n");
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class GameLog extends MyObservable {
|
||||
* @param logLevel the log level
|
||||
* @return the log text
|
||||
*/
|
||||
public List<GameLogEntry> getLogEntries(final GameEventType logLevel) { // null to fetch all
|
||||
public List<GameLogEntry> getLogEntries(final GameLogEntryType logLevel) { // null to fetch all
|
||||
final List<GameLogEntry> result = new ArrayList<GameLogEntry>();
|
||||
|
||||
for (int i = log.size() - 1; i >= 0; i--) {
|
||||
@@ -94,7 +94,7 @@ public class GameLog extends MyObservable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<GameLogEntry> getLogEntriesExact(final GameEventType logLevel) { // null to fetch all
|
||||
public List<GameLogEntry> getLogEntriesExact(final GameLogEntryType logLevel) { // null to fetch all
|
||||
final List<GameLogEntry> result = new ArrayList<GameLogEntry>();
|
||||
|
||||
for (int i = log.size() - 1; i >= 0; i--) {
|
||||
|
||||
@@ -2,10 +2,10 @@ package forge;
|
||||
|
||||
public class GameLogEntry {
|
||||
public final String message;
|
||||
public final GameEventType type;
|
||||
public final GameLogEntryType type;
|
||||
// might add here date and some other fields
|
||||
|
||||
GameLogEntry(final GameEventType type0, final String messageIn) {
|
||||
GameLogEntry(final GameLogEntryType type0, final String messageIn) {
|
||||
type = type0;
|
||||
message = messageIn;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package forge;
|
||||
|
||||
public enum GameEventType {
|
||||
public enum GameLogEntryType {
|
||||
GAME_OUTCOME("Game outcome"),
|
||||
MATCH_RESULTS("Match result"),
|
||||
TURN("Turn"),
|
||||
@@ -18,7 +18,7 @@ public enum GameEventType {
|
||||
PHASE("Phase");
|
||||
|
||||
private final String caption;
|
||||
private GameEventType(String name) {
|
||||
private GameLogEntryType(String name) {
|
||||
this.caption = name;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
String whoHas = p.getKey().equals(human) ? "You have" : p.getKey().getName() + " has";
|
||||
String outcome = String.format("%s %s", whoHas, p.getValue().getOutcome().toString());
|
||||
outcomes.add(outcome);
|
||||
log.add(GameEventType.GAME_OUTCOME, outcome);
|
||||
log.add(GameLogEntryType.GAME_OUTCOME, outcome);
|
||||
}
|
||||
|
||||
return generateSummary(ev.history);
|
||||
@@ -63,7 +63,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
for(int i = 0; i < wins.length; i++) {
|
||||
sb.append(players[i].getName()).append(": ").append(wins[i]).append(" ");
|
||||
}
|
||||
return new GameLogEntry(GameEventType.MATCH_RESULTS, sb.toString());
|
||||
return new GameLogEntry(GameLogEntryType.MATCH_RESULTS, sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,13 +78,13 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
else
|
||||
message = String.format("%s is controlled by %s", p.getName(), newController.getName());
|
||||
|
||||
return new GameLogEntry(GameEventType.PLAYER_CONROL, message);
|
||||
return new GameLogEntry(GameLogEntryType.PLAYER_CONROL, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameLogEntry visit(GameEventTurnPhase ev) {
|
||||
Player p = ev.playerTurn;
|
||||
return new GameLogEntry(GameEventType.PHASE, ev.phaseDesc + Lang.getPossesive(p.getName()) + " " + ev.phase.nameForUi);
|
||||
return new GameLogEntry(GameLogEntryType.PHASE, ev.phaseDesc + Lang.getPossesive(p.getName()) + " " + ev.phase.nameForUi);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
sb.append(" to attack ").append(defender.toString()).append(".");
|
||||
}
|
||||
|
||||
return new GameLogEntry(GameEventType.COMBAT, sb.toString());
|
||||
return new GameLogEntry(GameLogEntryType.COMBAT, sb.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
}
|
||||
}
|
||||
|
||||
return new GameLogEntry(GameEventType.COMBAT, sb.toString());
|
||||
return new GameLogEntry(GameLogEntryType.COMBAT, sb.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import forge.Command;
|
||||
import forge.Constant;
|
||||
import forge.CounterType;
|
||||
import forge.GameEntity;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.Singletons;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
@@ -207,7 +207,7 @@ public class CardFactoryUtil {
|
||||
public void resolve() {
|
||||
if (sourceCard.turnFaceUp()) {
|
||||
String sb = this.getActivatingPlayer() + " has unmorphed " + sourceCard.getName();
|
||||
sourceCard.getGame().getGameLog().add(GameEventType.STACK_RESOLVE, sb);
|
||||
sourceCard.getGame().getGameLog().add(GameLogEntryType.STACK_RESOLVE, sb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ public class CardFactoryUtil {
|
||||
c.addCounter(CounterType.TIME, counters, true);
|
||||
|
||||
String sb = String.format("%s has suspended %s with %d time counters on it.", this.getActivatingPlayer(), c.getName(), counters);
|
||||
game.getGameLog().add(GameEventType.STACK_RESOLVE, sb);
|
||||
game.getGameLog().add(GameLogEntryType.STACK_RESOLVE, sb);
|
||||
}
|
||||
};
|
||||
final StringBuilder sbDesc = new StringBuilder();
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.Card;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.card.ability.AbilityFactory;
|
||||
import forge.card.ability.AbilityUtils;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -154,7 +154,7 @@ public class ReplacementHandler {
|
||||
chosenRE.setHasRun(false);
|
||||
String message = chosenRE.toString();
|
||||
if ( !StringUtils.isEmpty(message))
|
||||
game.getGameLog().add(GameEventType.EFFECT_REPLACED, chosenRE.toString());
|
||||
game.getGameLog().add(GameLogEntryType.EFFECT_REPLACED, chosenRE.toString());
|
||||
return res;
|
||||
} else {
|
||||
if (possibleReplacers.size() == 0) {
|
||||
|
||||
@@ -39,7 +39,7 @@ import forge.Command;
|
||||
import forge.CounterType;
|
||||
import forge.FThreads;
|
||||
import forge.GameEntity;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.card.CardType;
|
||||
import forge.card.TriggerReplacementBase;
|
||||
import forge.card.ability.AbilityFactory;
|
||||
@@ -1570,7 +1570,7 @@ public class GameAction {
|
||||
p.onMulliganned();
|
||||
allKept = false;
|
||||
} else {
|
||||
game.getGameLog().add(GameEventType.MULLIGAN, p.getName() + " has kept a hand of " + p.getZone(ZoneType.Hand).size() + " cards");
|
||||
game.getGameLog().add(GameLogEntryType.MULLIGAN, p.getName() + " has kept a hand of " + p.getZone(ZoneType.Hand).size() + " cards");
|
||||
hasKept[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.google.common.collect.Lists;
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.CardPredicates;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.card.trigger.Trigger;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.deck.CardPool;
|
||||
@@ -312,7 +312,7 @@ public class GameNew {
|
||||
Predicate<Card> goodForAnte = Predicates.not(CardPredicates.Presets.BASIC_LANDS);
|
||||
Card ante = Aggregates.random(Iterables.filter(lib, goodForAnte));
|
||||
if (ante == null) {
|
||||
game.getGameLog().add(GameEventType.ANTE, "Only basic lands found. Will ante one of them");
|
||||
game.getGameLog().add(GameLogEntryType.ANTE, "Only basic lands found. Will ante one of them");
|
||||
ante = Aggregates.random(lib);
|
||||
}
|
||||
anteed.add(Pair.of(p, ante));
|
||||
@@ -324,7 +324,7 @@ public class GameNew {
|
||||
for(Pair<Player, Card> kv : cards) {
|
||||
Player p = kv.getKey();
|
||||
p.getGame().getAction().moveTo(ZoneType.Ante, kv.getValue());
|
||||
p.getGame().getGameLog().add(GameEventType.ANTE, p + " anted " + kv.getValue());
|
||||
p.getGame().getGameLog().add(GameLogEntryType.ANTE, p + " anted " + kv.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.apache.commons.lang.time.StopWatch;
|
||||
import forge.Card;
|
||||
import forge.CardLists;
|
||||
import forge.FThreads;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.Singletons;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.card.trigger.TriggerType;
|
||||
@@ -197,7 +197,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
|
||||
if (this.phase == PhaseType.UNTAP) {
|
||||
this.turn++;
|
||||
game.getGameLog().add(GameEventType.TURN, "Turn " + this.turn + " (" + this.getPlayerTurn() + ")");
|
||||
game.getGameLog().add(GameLogEntryType.TURN, "Turn " + this.turn + " (" + this.getPlayerTurn() + ")");
|
||||
}
|
||||
|
||||
game.fireEvent(new GameEventTurnPhase(this.getPlayerTurn(), this.getPhase(), phaseType));
|
||||
|
||||
@@ -10,7 +10,7 @@ import forge.CardLists;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.CounterType;
|
||||
import forge.FThreads;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.Singletons;
|
||||
import forge.card.ability.AbilityUtils;
|
||||
import forge.card.ability.ApiType;
|
||||
@@ -349,7 +349,7 @@ public class HumanPlay {
|
||||
|
||||
if (false == source.canReceiveCounters(counterType)) {
|
||||
String message = String.format("Won't be able to pay upkeep for %s but it can't have %s counters put on it.", source, counterType.getName());
|
||||
p.getGame().getGameLog().add(GameEventType.STACK_RESOLVE, message);
|
||||
p.getGame().getGameLog().add(GameLogEntryType.STACK_RESOLVE, message);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import forge.Constant.Preferences;
|
||||
import forge.CounterType;
|
||||
import forge.FThreads;
|
||||
import forge.GameEntity;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.Singletons;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.ability.AbilityFactory;
|
||||
@@ -673,7 +673,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
runParams.put("IsCombatDamage", isCombat);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.DamageDone, runParams, false);
|
||||
|
||||
game.getGameLog().add(GameEventType.DAMAGE, String.format("Dealing %d damage to %s. %s", damageToDo, this.getName(), additionalLog));
|
||||
game.getGameLog().add(GameLogEntryType.DAMAGE, String.format("Dealing %d damage to %s. %s", damageToDo, this.getName(), additionalLog));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
this.poisonCounters += num;
|
||||
|
||||
game.fireEvent(new GameEventPoisonCounter(this, source, num));
|
||||
game.getGameLog().add(GameEventType.DAMAGE_POISON, this + " receives a poison counter from " + source);
|
||||
game.getGameLog().add(GameLogEntryType.DAMAGE_POISON, this + " receives a poison counter from " + source);
|
||||
|
||||
this.updateObservers();
|
||||
}
|
||||
@@ -1768,7 +1768,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
game.getAction().checkStateEffects();
|
||||
|
||||
// add to log
|
||||
game.getGameLog().add(GameEventType.LAND, this + " played " + land);
|
||||
game.getGameLog().add(GameLogEntryType.LAND, this + " played " + land);
|
||||
|
||||
// play a sound
|
||||
game.fireEvent(new GameEventLandPlayed(this, land));
|
||||
@@ -3128,7 +3128,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
public void onMulliganned() {
|
||||
game.fireEvent(new GameEventMulligan(this)); // quest listener may interfere here
|
||||
final int newHand = getCardsIn(ZoneType.Hand).size();
|
||||
game.getGameLog().add(GameEventType.MULLIGAN, this + " has mulliganed down to " + newHand + " cards.");
|
||||
game.getGameLog().add(GameLogEntryType.MULLIGAN, this + " has mulliganed down to " + newHand + " cards.");
|
||||
stats.notifyHasMulliganed();
|
||||
stats.notifyOpeningHandSize(newHand);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.CardLists;
|
||||
import forge.FThreads;
|
||||
import forge.Singletons;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.card.ability.AbilityUtils;
|
||||
import forge.card.cardfactory.CardFactory;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
@@ -312,7 +312,7 @@ public class MagicStack extends MyObservable implements Iterable<SpellAbilitySta
|
||||
AbilityUtils.resolve(sp, false);
|
||||
//sp.resolve();
|
||||
sp.resetOnceResolved();
|
||||
game.getGameLog().add(GameEventType.MANA, sp.getSourceCard() + " - " + sp.getDescription());
|
||||
game.getGameLog().add(GameLogEntryType.MANA, sp.getSourceCard() + " - " + sp.getDescription());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public class MagicStack extends MyObservable implements Iterable<SpellAbilitySta
|
||||
}
|
||||
sb.append(".");
|
||||
|
||||
game.getGameLog().add(GameEventType.STACK_ADD, sb.toString());
|
||||
game.getGameLog().add(GameLogEntryType.STACK_ADD, sb.toString());
|
||||
//============= GameLog ======================
|
||||
|
||||
// if activating player slips through the cracks, assign activating
|
||||
@@ -602,7 +602,7 @@ public class MagicStack extends MyObservable implements Iterable<SpellAbilitySta
|
||||
|
||||
boolean thisHasFizzled = this.hasFizzled(sa, source, false);
|
||||
String messageForLog = thisHasFizzled ? source.getName() + " ability fizzles." : sa.getStackDescription();
|
||||
game.getGameLog().add(GameEventType.STACK_RESOLVE, messageForLog);
|
||||
game.getGameLog().add(GameLogEntryType.STACK_RESOLVE, messageForLog);
|
||||
if (thisHasFizzled) { // Fizzle
|
||||
// TODO: Spell fizzles, what's the best way to alert player?
|
||||
Log.debug(source.getName() + " ability fizzles.");
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.miginfocom.swing.MigLayout;
|
||||
import forge.Command;
|
||||
import forge.GameLog;
|
||||
import forge.GameLogEntry;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.Singletons;
|
||||
import forge.game.Match;
|
||||
import forge.game.player.LobbyPlayer;
|
||||
@@ -183,10 +183,10 @@ public class ViewWinLose {
|
||||
|
||||
GameLog log = match.getCurrentGame().getGameLog();
|
||||
|
||||
for (GameLogEntry o : log.getLogEntriesExact(GameEventType.GAME_OUTCOME))
|
||||
for (GameLogEntry o : log.getLogEntriesExact(GameLogEntryType.GAME_OUTCOME))
|
||||
pnlOutcomes.add(new FLabel.Builder().text(o.message).fontSize(14).build(), "h 20!");
|
||||
|
||||
for (GameLogEntry o : log.getLogEntriesExact(GameEventType.MATCH_RESULTS))
|
||||
for (GameLogEntry o : log.getLogEntriesExact(GameLogEntryType.MATCH_RESULTS))
|
||||
lblStats.setText(o.message);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.swing.border.EmptyBorder;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import forge.GameLog;
|
||||
import forge.GameLogEntry;
|
||||
import forge.GameEventType;
|
||||
import forge.GameLogEntryType;
|
||||
import forge.gui.framework.DragCell;
|
||||
import forge.gui.framework.DragTab;
|
||||
import forge.gui.framework.EDocID;
|
||||
@@ -119,7 +119,7 @@ public enum VLog implements IVDoc<CLog> {
|
||||
|
||||
// TODO - some option to make this configurable is probably desirable
|
||||
// By default, grab everything log level 3 or less.
|
||||
final List<GameLogEntry> data = model.getLogEntries(GameEventType.DAMAGE);
|
||||
final List<GameLogEntry> data = model.getLogEntries(GameLogEntryType.DAMAGE);
|
||||
final int size = data.size();
|
||||
|
||||
pnl.removeAll();
|
||||
|
||||
Reference in New Issue
Block a user