Skip to content

Commit

Permalink
Merge branch '1.7' of https://github.com/tukkek/javelin into 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
tukkek committed Feb 1, 2018
2 parents 2e09066 + d46baf5 commit 9e7ba1d
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 139 deletions.
16 changes: 7 additions & 9 deletions javelin/Debug.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
* never be called from other parts of the game unless {@link Javelin#DEBUG} is
* <code>true</code>. Other methods are helpers to be used within the class,
* such as {@link #additems(Item[])}.
*
*
* Ideally changes to this class should never be commited unless when expanding
* debug functionalities (such adding new entry or helper methods).
*
*
* @author alex
*/
public class Debug {
Expand Down Expand Up @@ -60,13 +60,11 @@ static void additems(Item[] items) {
}

static String printtowninfo() {
String s = "\n\n";
String s = "";
for (Town t : Town.gettowns()) {
s += t.population + " ";
}
s += "\n\n";
for (Town t : Town.gettowns()) {
s += CrCalculator.calculateel(t.garrison) + " ";
String el = t.ishostile()
? ", EL " + CrCalculator.calculateel(t.garrison) : "";
s += t + " (" + t.getrank().title + el + ")\n";
}
return s;
}
Expand Down Expand Up @@ -114,7 +112,7 @@ public static void oninit() {
* Called from {@link Help}. Useful for making changes during the course of
* a game or testing sequence, since Javelin doesn't have a developer
* console for debugging purposes.
*
*
* @return Any text will be printed below the usual help output.
*/
public static String onworldhelp() {
Expand Down
96 changes: 39 additions & 57 deletions javelin/controller/generator/feature/FeatureGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
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;
import javelin.model.world.location.Location;
import javelin.model.world.location.Outpost;
import javelin.model.world.location.Portal;
import javelin.model.world.location.Resource;
import javelin.model.world.location.dungeon.Dungeon;
import javelin.model.world.location.dungeon.temple.Temple;
Expand All @@ -32,30 +30,12 @@
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.Mine;
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 @@ -91,22 +71,22 @@ private FeatureGenerator() {
dungeons.max = startingdungeons;
}
register(Dungeon.class, dungeons);
register(Outpost.class, new GenerationData());
register(Lodge.class, new GenerationData(.75f, 5, 1));
register(Shrine.class, new GenerationData());
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(Mine.class, new GenerationData(0, 2, 2));

register(Trove.class, new GenerationData(1.5f, null, 0));
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();
}
});
// register(Portal.class, new GenerationData() {
// @Override
// public Actor generate(Class<? extends Actor> feature) {
// return Portal.open();
// }
// });

if (Caravan.ALLOW) {
register(Caravan.class,
Expand Down Expand Up @@ -161,7 +141,7 @@ GenerationData register(Class<? extends Actor> class1,
*/
public void spawn(float chance, boolean generatingworld) {
if (countplaces() >= World.scenario.startingfeatures
|| (!World.scenario.respawnlocations && !generatingworld)) {
|| !World.scenario.respawnlocations && !generatingworld) {
return;
}
for (Class<? extends Actor> feature : generators.keySet()) {
Expand Down Expand Up @@ -229,8 +209,8 @@ void generatelocations(World seed, Town easya) {
ArrayList<Location> locations = new ArrayList<Location>();
generateuniquelocations(locations);
UpgradeHandler.singleton.gather();
generatemageguilds(locations);
generateacademies(locations);
// generatemageguilds(locations);
// generateacademies(locations);
locations.addAll(World.scenario.generatelocations(seed));
Collections.shuffle(locations);
int place = Math.min(locations.size(),
Expand All @@ -242,10 +222,12 @@ 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 MercenariesGuild(),
// new Artificer(),
// new SummoningCircle(),
new PillarOfSkulls(), new Arena(), new Battlefield(),
new DungeonRush(), new Ziggurat(), new DeepDungeon() }));
locations.addAll(Arrays.asList(new Haunt[] { new AbandonedManor(),
new SunkenShip(), new ShatteredTemple(), new WitchesHideout(),
new Graveyard(), new OrcSettlement() }));
Expand Down Expand Up @@ -273,20 +255,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 @@ -300,9 +282,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());
// }
// }
}
12 changes: 6 additions & 6 deletions javelin/model/unit/Squad.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/**
* A group of units that the player controls as a overworld game unit. If a
* player loses all his squads the game ends.
*
*
* TODO when this breaks the 1000 line limit an easy fix is to turn
* {@link #members} into a SquadMemmbers class. See {@link #sort()}.
*
Expand Down Expand Up @@ -167,7 +167,7 @@ public Image getimage() {
* Sorts alphabetically, with all mercenaries to the final of the
* {@link #members} list, making it easier to overcome some current UI
* limitations.
*
*
* TODO this shouldn't be public but ensure by the architecure. A solution
* would be to make {@link #members} a class of its own (not a List) which
* exposes a singgle add methods like {@link #add(Combatant)} and
Expand Down Expand Up @@ -273,7 +273,7 @@ public void dismiss(Combatant c) {

/**
* Will automatically {@link #sort()} after inclusion..
*
*
* @param member
* Adds this unit to {@link #members}.
* @param equipmentp
Expand Down Expand Up @@ -716,7 +716,7 @@ public boolean skipcombat(int diffifculty) {
final String prompt = "Do you want to skip this " + difficulty
+ " battle?\n\n" //
+ "Press ENTER to open the battle screen.\n"
+ "Press s to skip it and calculate results autmatically.";
+ "Press s to skip it and calculate results automatically.";
input = Javelin.prompt(prompt);
}
return input == 's';
Expand Down Expand Up @@ -780,7 +780,7 @@ public int getupkeep() {

/**
* 100XP = 1CR.
*
*
* @return Total of XP between all active {@link Squad} members.
*/
public int sumxp() {
Expand Down Expand Up @@ -822,7 +822,7 @@ ArrayList<Spell> getavailablespells() {

/**
* Uses available spells to heal your party.
*
*
* @see #canheal()
*/
public void quickheal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
/**
* Brings you back to last visited town. See the d20 SRD for more info. Assumes
* caster level 20 to be able to transport as many creatures as willed.
*
*
* Destination for this spell is set when the spell is prepared, not when it's
* cast, so it makes some sense that that a {@link Scroll} could also be
* prepared before being cast. It's a bit of a stretch but doing anything else
* would be very complicated considering the numberr of different ways an
* {@link Item} can be generated in Javelin.
*
*
* http://paizo.com/pathfinderRPG/prd/coreRulebook/spells/wordOfRecall.html
*/
public class WordOfRecall extends Spell {
Expand All @@ -32,7 +32,7 @@ public WordOfRecall() {
Realm.MAGIC);
casterlevel = 20;
castoutofbattle = true;
isritual = true;
isritual = false;
isscroll = true;
}

Expand Down
4 changes: 2 additions & 2 deletions javelin/model/world/Incursion.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public class Incursion extends Actor {
static final int PREFERREDVICTORYCHANCE = 5 + 2;
/** Only taken into account if running {@link Javelin#DEBUG}. */
static final boolean SPAWN = true;
static final boolean SPAWN = false;
/** Move even if {@link Javelin#DEBUGDISABLECOMBAT} is enabled. */
static final boolean FORCEMOVEMENT = false;
static final VictoryChance VICTORYCHANCES = new VictoryChance();
Expand Down Expand Up @@ -161,7 +161,7 @@ void attack(Actor target) {
* {@link Actor#realm} or targets that would require the Incursion to cross
* water to get there. If this results in no potential target, will assgign
* <code>null</code> to {@link #target}.
*
*
* Once tha filtering is done, will select the closest target that allows
* for the {@link #PREFERREDVICTORYCHANCE} of winning. If none is available,
* will use the nearest valid target.
Expand Down
Loading

0 comments on commit 9e7ba1d

Please sign in to comment.