[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

@ -0,0 +1,81 @@
package mage.game.command.emblems;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.hint.Hint;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.watchers.common.CompletedDungeonWatcher;
import java.util.Set;
/**
* @author TheElk801
*/
public final class EllywickTumblestrumEmblem extends Emblem {
// 7: You get an emblem with "Creatures you control have trample and haste and get +2/+2 for each differently named dungeon you've completed."
public EllywickTumblestrumEmblem() {
this.setName("Emblem Ellywick");
this.setExpansionSetCodeForImage("AFR");
Ability ability = new SimpleStaticAbility(new GainAbilityControlledEffect(
TrampleAbility.getInstance(), Duration.EndOfGame,
StaticFilters.FILTER_PERMANENT_CREATURES
));
ability.addEffect(new GainAbilityControlledEffect(
HasteAbility.getInstance(), Duration.EndOfGame,
StaticFilters.FILTER_PERMANENT_CREATURES
).setText("and haste"));
ability.addEffect(new BoostControlledEffect(
EllywickTumblestrumEmblemValue.instance,
EllywickTumblestrumEmblemValue.instance,
Duration.EndOfGame
).setText("and get +2/+2 for each differently named dungeon you've completed"));
this.getAbilities().add(ability.addHint(EllywickTumblestrumEmblemHint.instance));
}
}
enum EllywickTumblestrumEmblemValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return 2 * CompletedDungeonWatcher.getCompletedNames(sourceAbility.getControllerId(), game).size();
}
@Override
public EllywickTumblestrumEmblemValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
}
enum EllywickTumblestrumEmblemHint implements Hint {
instance;
@Override
public String getText(Game game, Ability ability) {
Set<String> names = CompletedDungeonWatcher.getCompletedNames(ability.getControllerId(), game);
if (names.isEmpty()) {
return "No dungeons completed";
}
return "Completed dungeons: " + String.join(", ", names);
}
@Override
public EllywickTumblestrumEmblemHint copy() {
return this;
}
}