Skip to content

Commit

Permalink
Re-enabling world district for Scenario mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tukkek committed Feb 6, 2018
1 parent ce023f5 commit dea579c
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 44 deletions.
89 changes: 53 additions & 36 deletions javelin/controller/generator/feature/FeatureGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javelin.controller.upgrade.UpgradeHandler;
import javelin.model.unit.Monster;
import javelin.model.unit.Squad;
import javelin.model.unit.abilities.discipline.Discipline;
import javelin.model.world.Actor;
import javelin.model.world.Caravan;
import javelin.model.world.World;
Expand All @@ -30,12 +31,29 @@
import javelin.model.world.location.town.Town;
import javelin.model.world.location.town.labor.basic.Dwelling;
import javelin.model.world.location.town.labor.basic.Lodge;
import javelin.model.world.location.town.labor.criminal.ThievesGuild;
import javelin.model.world.location.town.labor.cultural.BardsGuild;
import javelin.model.world.location.town.labor.cultural.MagesGuild;
import javelin.model.world.location.town.labor.cultural.MagesGuild.MageGuildData;
import javelin.model.world.location.town.labor.ecological.ArcheryRange;
import javelin.model.world.location.town.labor.ecological.Henge;
import javelin.model.world.location.town.labor.ecological.MeadHall;
import javelin.model.world.location.town.labor.military.Academy;
import javelin.model.world.location.town.labor.military.MartialAcademy;
import javelin.model.world.location.town.labor.military.MartialAcademy.MartialAcademyData;
import javelin.model.world.location.town.labor.military.Monastery;
import javelin.model.world.location.town.labor.military.RealmAcademy;
import javelin.model.world.location.town.labor.productive.Shop;
import javelin.model.world.location.town.labor.religious.Sanctuary;
import javelin.model.world.location.town.labor.religious.Shrine;
import javelin.model.world.location.unique.AdventurersGuild;
import javelin.model.world.location.unique.Artificer;
import javelin.model.world.location.unique.AssassinsGuild;
import javelin.model.world.location.unique.DeepDungeon;
import javelin.model.world.location.unique.Haxor;
import javelin.model.world.location.unique.MercenariesGuild;
import javelin.model.world.location.unique.PillarOfSkulls;
import javelin.model.world.location.unique.SummoningCircle;
import javelin.model.world.location.unique.TrainingHall;
import javelin.model.world.location.unique.minigame.Arena;
import javelin.model.world.location.unique.minigame.Battlefield;
Expand Down Expand Up @@ -72,21 +90,16 @@ private FeatureGenerator() {
}
register(Dungeon.class, dungeons);
register(Outpost.class, new GenerationData(.25f, null, 0));
// register(Lodge.class, new GenerationData(.75f, 5, 1));
// register(Shrine.class, new GenerationData());
register(Resource.class, new GenerationData());
// register(Mine.class, new GenerationData(0, 2, 2));

register(Trove.class, new GenerationData(null));
register(Guardian.class, new GenerationData(null));
register(Dwelling.class, new GenerationData(null));

// register(Portal.class, new GenerationData() {
// @Override
// public Actor generate(Class<? extends Actor> feature) {
// return Portal.open();
// }
// });
if (World.scenario.worlddistrict) {
register(Lodge.class, new GenerationData(.75f, 5, 1));
register(Shrine.class, new GenerationData());
}

if (Caravan.ALLOW) {
register(Caravan.class,
Expand Down Expand Up @@ -209,8 +222,10 @@ void generatelocations(World seed, Town easya) {
ArrayList<Location> locations = new ArrayList<Location>();
generateuniquelocations(locations);
UpgradeHandler.singleton.gather();
// generatemageguilds(locations);
// generateacademies(locations);
if (World.scenario.worlddistrict) {
generatemageguilds(locations);
generateacademies(locations);
}
locations.addAll(World.scenario.generatelocations(seed));
Collections.shuffle(locations);
int place = Math.min(locations.size(),
Expand All @@ -222,12 +237,14 @@ void generatelocations(World seed, Town easya) {
}

void generateuniquelocations(ArrayList<Location> locations) {
locations.addAll(Arrays.asList(new Location[] {
// new MercenariesGuild(),
// new Artificer(),
// new SummoningCircle(),
new PillarOfSkulls(), new Arena(), new Battlefield(),
new DungeonRush(), new Ziggurat(), new DeepDungeon() }));
locations.addAll(Arrays.asList(new Location[] { new PillarOfSkulls(),
new Arena(), new Battlefield(), new DungeonRush(),
new Ziggurat(), new DeepDungeon() }));
if (World.scenario.worlddistrict) {
locations.addAll(
Arrays.asList(new Location[] { new MercenariesGuild(),
new Artificer(), new SummoningCircle(), }));
}
locations.addAll(Arrays.asList(new Haunt[] { new AbandonedManor(),
new SunkenShip(), new ShatteredTemple(), new WitchesHideout(),
new Graveyard(), new OrcSettlement() }));
Expand Down Expand Up @@ -255,20 +272,20 @@ public int compare(Monster o1, Monster o2) {
spawnnear(t, new TrainingHall(), seed, 2, 3, false);
}

// static void generateacademies(ArrayList<Location> locations) {
// for (MartialAcademyData g : MartialAcademy.ACADEMIES) {
// locations.add(g.generate());
// }
// locations.addAll(Arrays.asList(new Academy[] { new ArcheryRange(),
// new MeadHall(), new AssassinsGuild(), new Henge(),
// new BardsGuild(), new ThievesGuild(), new Monastery(),
// new Sanctuary() }));
// for (Discipline d : Discipline.DISCIPLINES) {
// if (d.hasacademy) {
// locations.add(d.generateacademy());
// }
// }
// }
static void generateacademies(ArrayList<Location> locations) {
for (MartialAcademyData g : MartialAcademy.ACADEMIES) {
locations.add(g.generate());
}
locations.addAll(Arrays.asList(new Academy[] { new ArcheryRange(),
new MeadHall(), new AssassinsGuild(), new Henge(),
new BardsGuild(), new ThievesGuild(), new Monastery(),
new Sanctuary() }));
for (Discipline d : Discipline.DISCIPLINES) {
if (d.hasacademy) {
locations.add(d.generateacademy());
}
}
}

static int countplaces() {
int count = 0;
Expand All @@ -282,9 +299,9 @@ static int countplaces() {
return count;
}

// static void generatemageguilds(ArrayList<Location> locations) {
// for (MageGuildData g : MagesGuild.GUILDS) {
// locations.add(g.generate());
// }
// }
static void generatemageguilds(ArrayList<Location> locations) {
for (MageGuildData g : MagesGuild.GUILDS) {
locations.add(g.generate());
}
}
}
1 change: 1 addition & 0 deletions javelin/controller/scenario/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ record = true;
startingfeatures = size * size / 5;
simpletroves = false;
rewardbonus = 1;
worlddistrict = false;
}

@Override
Expand Down
21 changes: 13 additions & 8 deletions javelin/controller/scenario/Scenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@
* Scenario mode is a much faster type of gameplay than the main
* {@link Campaign} mode. It's supposed to be finished on anywhere from 2 hours
* of play to an afternoon (but of course it can be saved an resumed too).
*
*
* The world is a lot more static in this mode. Several features and
* {@link Location}s are disabled - including {@link RandomEncounter}s in ohe
* overworld map and {@link Hazard}s. The only "moving pieces" in the world map
* are yourself and {@link Incursion}s.
*
*
* The {@link FeatureGenerator} is disabled after the original world is created,
* meaning that, wuthout random encounters and other infinite means of gaining
* experience and loot, you are on a race against time to conquer all hostile
* {@link Town}s - 1 to 3, with varying degress of power according to the
* quantity in each game.
*
*
* There is only one enemy {@link Realm} per game and the starting features are
* roughly made to be 1/3 neutral and 2/3 hostile.
*/
Expand All @@ -70,7 +70,7 @@ public class Scenario implements Serializable {
public int size = 30;
/**
* Allow access to {@link Minigame}s or not.
*
*
* TODO may allow access but should fix them for scenario mode where their
* {@link UniqueLocation}s aren't present.
*/
Expand All @@ -87,15 +87,15 @@ public class Scenario implements Serializable {
/**
* If not <code>null</code>, this amount will be seeded during {@link World}
* generation. It will also be the cap as per {@link GenerationData#max}.
*
*
* Number of starting dungeons in the {@link World} map. Since {@link Key}s
* are important to {@link Win}ning the game this should be a fair amount,
* otherwise the player will depend only on {@link Caravan}s if too many
* dungeons are destroyed or if unable to find the proper {@link Chest}
* inside the dungeons he does find. Not that dungeons also spawn during the
* course of a game but since this is highly randomized a late-game player
* who ran out of dungeons should not be required to depend on that alone.
*
*
* @see Actor#destroy(Incursion)
* @see FeatureGenerator
*/
Expand Down Expand Up @@ -152,12 +152,17 @@ public boolean record = false;
public boolean randomrealms = true;
/**
* Affect labor and training speeds and amounts for XP and gold rewards.
*
*
* @see Labor#work(float)
* @see RewardCalculator
* @see Order
*/
public int rewardbonus = 3;
/**
* If <code>true</code> will try to generate all possible {@link Location}s
* around the world.
*/
public boolean worlddistrict = true;

/**
* @return Starting encounter level for each hostile town in
Expand All @@ -170,7 +175,7 @@ public static int getscenariochallenge() {

/**
* {@link Upgrade} or not the starting squad after it's been selected.
*
*
* @see SquadScreen
*/
public void upgradesquad(ArrayList<Combatant> squad) {
Expand Down

0 comments on commit dea579c

Please sign in to comment.