[AFR] Implementing dungeon mechanic (ready for review) (#7937)

* added dungeon and dungeon room class

* [AFR] Implemented Tomb of Annihilation

* [AFR] Implemented Shortcut Seeker

* [AFR] Implemented Gloom Stalker

* [AFR] Implemented Nadaar, Selfless Paladin

* added room triggers

* added more venturing code, currently untested

* fixed error

* moved venture into dungeon from player class to game class

* removed unnecessary sourceobject from dungeon

* fixed npe error

* added dungeon completion

* fixed concurrent modification exception

* added logging

* added proper copy methods

* added views

* updated room text generation

* added some missing code

* finished implementing CompletedDungeonCondition

* [AFR] Implemented Ellywick Tumblestrum

* [AFR] Implemented Lost Mine of Phandelver

* added choice dialog for dungeons

* [AFR] Implemented Dungeon of the Mad Mage

* small text fix

* added initial dungeon test

* [AFR] Implemented Cloister Gargoyle

* [AFR] Implemented Dungeon Crawler

* small text change for dungeon rooms

* added more tests

* some simplification to dungeon props

* updated testing helper functions

* added currently failing test for venturing on separate steps and turns

* added tests for dungeon completion

* fixed missing trigger visual and dungeons not persisting through turns

* some text updates

* added rollback test

* added a test for multiple dungeons at once

* added one more condition test
This commit is contained in:
Evan Kranzler 2021-06-29 06:57:43 -04:00 committed by GitHub
parent c6d08ce344
commit bb591dd038
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 2481 additions and 144 deletions

View file

@ -20,6 +20,7 @@ import mage.counters.CounterType;
import mage.designations.Designation;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.command.Dungeon;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.permanent.Permanent;
@ -579,6 +580,11 @@ public class CardView extends SimpleCardView {
Emblem emblem = (Emblem) object;
this.rarity = Rarity.SPECIAL;
this.rules = emblem.getAbilities().getRules(emblem.getName());
} else if (object instanceof Dungeon) {
this.mageObjectType = MageObjectType.DUNGEON;
Dungeon dungeon = (Dungeon) object;
this.rarity = Rarity.SPECIAL;
this.rules = dungeon.getRules();
} else if (object instanceof Plane) {
this.mageObjectType = MageObjectType.PLANE;
Plane plane = (Plane) object;
@ -631,6 +637,21 @@ public class CardView extends SimpleCardView {
this.rarity = Rarity.COMMON;
}
public CardView(DungeonView dungeon) {
this(true);
this.gameObject = true;
this.id = dungeon.getId();
this.mageObjectType = MageObjectType.DUNGEON;
this.name = dungeon.getName();
this.displayName = name;
this.displayFullName = name;
this.rules = dungeon.getRules();
// emblem images are always with common (black) symbol
this.frameStyle = FrameStyle.M15_NORMAL;
this.expansionSetCode = dungeon.getExpansionSetCode();
this.rarity = Rarity.COMMON;
}
public CardView(PlaneView plane) {
this(true);
this.gameObject = true;

View file

@ -6,6 +6,7 @@ import mage.abilities.effects.Effect;
import mage.cards.Card;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.command.Dungeon;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.permanent.Permanent;
@ -110,6 +111,9 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
abilityView = new AbilityView(ability, sourceObject.getName(), new CardView(new EmblemView((Emblem) sourceObject)));
abilityView.setName(sourceObject.getName());
// abilityView.setExpansionSetCode(sourceCard.getExpansionSetCode());
} else if (sourceObject instanceof Dungeon) {
abilityView = new AbilityView(ability, sourceObject.getName(), new CardView(new DungeonView((Dungeon) sourceObject)));
abilityView.setName(sourceObject.getName());
} else if (sourceObject instanceof Plane) {
abilityView = new AbilityView(ability, sourceObject.getName(), new CardView(new PlaneView((Plane) sourceObject)));
abilityView.setName(sourceObject.getName());

View file

@ -0,0 +1,84 @@
package mage.view;
import mage.game.command.Dungeon;
import mage.players.PlayableObjectStats;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public class DungeonView implements CommandObjectView, Serializable {
protected UUID id;
protected String name;
protected String expansionSetCode;
protected List<String> rules;
protected PlayableObjectStats playableStats = new PlayableObjectStats();
public DungeonView(Dungeon dungeon) {
this.id = dungeon.getId();
this.name = dungeon.getName();
this.expansionSetCode = dungeon.getExpansionSetCodeForImage();
this.rules = dungeon.getRules();
}
@Override
public String getExpansionSetCode() {
return expansionSetCode;
}
@Override
public String getName() {
return name;
}
@Override
public UUID getId() {
return id;
}
@Override
public List<String> getRules() {
return rules;
}
@Override
public boolean isPlayable() {
return this.playableStats.getPlayableAmount() > 0;
}
@Override
public void setPlayableStats(PlayableObjectStats playableStats) {
this.playableStats = playableStats;
}
@Override
public PlayableObjectStats getPlayableStats() {
return this.playableStats;
}
@Override
public boolean isChoosable() {
// unsupported
return false;
}
@Override
public void setChoosable(boolean isChoosable) {
// unsupported
}
@Override
public boolean isSelected() {
// unsupported
return false;
}
@Override
public void setSelected(boolean isSelected) {
// unsupported
}
}

View file

@ -13,6 +13,7 @@ import mage.game.ExileZone;
import mage.game.Game;
import mage.game.GameState;
import mage.game.combat.CombatGroup;
import mage.game.command.Dungeon;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.permanent.Permanent;
@ -114,6 +115,12 @@ public class GameView implements Serializable {
stack.put(stackObject.getId(),
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView));
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
} else if (object instanceof Dungeon) {
CardView cardView = new CardView(new DungeonView((Dungeon) object));
stackObject.setName(object.getName());
stack.put(stackObject.getId(),
new StackAbilityView(game, (StackAbility) stackObject, object.getName(), cardView));
checkPaid(stackObject.getId(), ((StackAbility) stackObject));
} else if (object instanceof Plane) {
CardView cardView = new CardView(new PlaneView((Plane) object));
stackObject.setName(object.getName());

View file

@ -6,10 +6,7 @@ import mage.designations.Designation;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.GameState;
import mage.game.command.CommandObject;
import mage.game.command.Commander;
import mage.game.command.Emblem;
import mage.game.command.Plane;
import mage.game.command.*;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.players.net.UserData;
@ -113,6 +110,11 @@ public class PlayerView implements Serializable {
if (emblem.getControllerId().equals(this.playerId)) {
commandList.add(new EmblemView(emblem));
}
} else if (commandObject instanceof Dungeon) {
Dungeon dungeon = (Dungeon) commandObject;
if (dungeon.getControllerId().equals(this.playerId)) {
commandList.add(new DungeonView(dungeon));
}
} else if (commandObject instanceof Plane) {
Plane plane = (Plane) commandObject;
// Planes are universal and all players can see them.