mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
Dungeon improves:
* Dungeons: added dungeon name hint to room's game log and choices (part of #12274); * GUI, game: added card popup hints support in feedback panel (yes/no choices); * Images: fixed miss images for dungeons in command zone, game logs and choice dialogs;
This commit is contained in:
parent
cd51954208
commit
b40e7222b3
9 changed files with 94 additions and 26 deletions
|
|
@ -584,6 +584,9 @@ public abstract class GameImpl implements Game {
|
|||
return emblem;
|
||||
}
|
||||
TheRingEmblem newEmblem = new TheRingEmblem(playerId);
|
||||
|
||||
// TODO: add image info
|
||||
|
||||
state.addCommandObject(newEmblem);
|
||||
return newEmblem;
|
||||
}
|
||||
|
|
@ -1971,7 +1974,9 @@ public abstract class GameImpl implements Game {
|
|||
ability.setSourceId(newEmblem.getId());
|
||||
}
|
||||
|
||||
state.addCommandObject(newEmblem); // TODO: generate image for emblem here?
|
||||
// image info setup in setSourceObject
|
||||
|
||||
state.addCommandObject(newEmblem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1999,6 +2004,9 @@ public abstract class GameImpl implements Game {
|
|||
for (Ability ability : newPlane.getAbilities()) {
|
||||
ability.setSourceId(newPlane.getId());
|
||||
}
|
||||
|
||||
// image info setup in setSourceObject
|
||||
|
||||
state.addCommandObject(newPlane);
|
||||
informPlayers("You have planeswalked to " + newPlane.getLogName());
|
||||
|
||||
|
|
@ -2020,6 +2028,7 @@ public abstract class GameImpl implements Game {
|
|||
@Override
|
||||
public Dungeon addDungeon(Dungeon dungeon, UUID playerId) {
|
||||
dungeon.setControllerId(playerId);
|
||||
dungeon.setSourceObject();
|
||||
state.addCommandObject(dungeon);
|
||||
return dungeon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import mage.abilities.effects.ContinuousEffect;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
import mage.cards.FrameStyle;
|
||||
import mage.cards.repository.TokenInfo;
|
||||
import mage.cards.repository.TokenRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceHintType;
|
||||
import mage.choices.ChoiceImpl;
|
||||
|
|
@ -87,6 +89,11 @@ public class Dungeon extends CommandObjectImpl {
|
|||
}
|
||||
|
||||
public void moveToNextRoom(UUID playerId, Game game) {
|
||||
Dungeon dungeon = game.getPlayerDungeon(playerId);
|
||||
if (dungeon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentRoom == null) {
|
||||
currentRoom = dungeonRooms.get(0);
|
||||
} else {
|
||||
|
|
@ -94,7 +101,7 @@ public class Dungeon extends CommandObjectImpl {
|
|||
}
|
||||
Player player = game.getPlayer(getControllerId());
|
||||
if (player != null) {
|
||||
game.informPlayers(player.getLogName() + " has entered " + currentRoom.getName());
|
||||
game.informPlayers(player.getLogName() + " has entered " + currentRoom.getName() + " (dungeon: " + dungeon.getLogName() + ")");
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.ROOM_ENTERED, currentRoom.getId(), null, playerId
|
||||
|
|
@ -139,14 +146,14 @@ public class Dungeon extends CommandObjectImpl {
|
|||
choice.setChoices(dungeonNames);
|
||||
player.choose(Outcome.Neutral, choice, game);
|
||||
if (choice.getChoice() != null) {
|
||||
return createDungeon(choice.getChoice());
|
||||
return createDungeon(choice.getChoice(), true);
|
||||
} else {
|
||||
// on disconnect
|
||||
return createDungeon("Tomb of Annihilation");
|
||||
return createDungeon("Tomb of Annihilation", true);
|
||||
}
|
||||
}
|
||||
|
||||
public static Dungeon createDungeon(String name) {
|
||||
public static Dungeon createDungeon(String name, boolean isNameMustExists) {
|
||||
switch (name) {
|
||||
case "Tomb of Annihilation":
|
||||
return new TombOfAnnihilationDungeon();
|
||||
|
|
@ -155,7 +162,26 @@ public class Dungeon extends CommandObjectImpl {
|
|||
case "Dungeon of the Mad Mage":
|
||||
return new DungeonOfTheMadMageDungeon();
|
||||
default:
|
||||
throw new UnsupportedOperationException("A dungeon should have been chosen");
|
||||
if (isNameMustExists) {
|
||||
throw new UnsupportedOperationException("A dungeon should have been chosen");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setSourceObject() {
|
||||
// choose set code due source
|
||||
TokenInfo foundInfo = TokenRepository.instance.findPreferredTokenInfoForClass(this.getClass().getName(), null);
|
||||
if (foundInfo != null) {
|
||||
this.setExpansionSetCode(foundInfo.getSetCode());
|
||||
this.setUsesVariousArt(false);
|
||||
this.setCardNumber("");
|
||||
this.setImageFileName(""); // use default
|
||||
this.setImageNumber(foundInfo.getImageNumber());
|
||||
} else {
|
||||
// how-to fix: add dungeon to the tokens-database
|
||||
throw new IllegalArgumentException("Wrong code usage: can't find token info for the dungeon: " + this.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ public class DungeonRoom {
|
|||
}
|
||||
|
||||
public DungeonRoom chooseNextRoom(UUID playerId, Game game) {
|
||||
Dungeon dungeon = game.getPlayerDungeon(playerId);
|
||||
if (dungeon == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (nextRooms.size()) {
|
||||
case 0:
|
||||
return null;
|
||||
|
|
@ -90,8 +95,8 @@ public class DungeonRoom {
|
|||
return null;
|
||||
}
|
||||
return player.chooseUse(
|
||||
Outcome.Neutral, "Choose which room to go to",
|
||||
null, room1.name, room2.name, null, game
|
||||
Outcome.Neutral, "Choose which room to go to in",
|
||||
"dungeon: " + dungeon.getLogName(), room1.name, room2.name, null, game
|
||||
) ? room1 : room2;
|
||||
default:
|
||||
throw new UnsupportedOperationException("there shouldn't be more than two rooms to go to");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue