Class Arena


public class Arena extends Object
Arena of battling fighters (as gladiators).
Since:
2014-05-20
  • Field Details

    • DEFAULT_NUM_YEARS

      final int DEFAULT_NUM_YEARS
      See Also:
    • DEFAULT_FIGHTS_PER_YEAR

      final int DEFAULT_FIGHTS_PER_YEAR
      See Also:
    • DEFAULT_NUM_FIGHTERS

      final int DEFAULT_NUM_FIGHTERS
      See Also:
    • DEFAULT_PARTY_SIZE

      final int DEFAULT_PARTY_SIZE
      See Also:
    • DEFAULT_PCT_MAGIC_PER_LEVEL

      final int DEFAULT_PCT_MAGIC_PER_LEVEL
      See Also:
    • DEFAULT_ARMOR

      final Armor.Type DEFAULT_ARMOR
    • fighterList

      Party fighterList
      List of fighters for the arena.
    • numYears

      int numYears
      Number of years to run simulation.
    • fightsPerYear

      int fightsPerYear
      Fights held per simulated year.
    • numFighters

      int numFighters
      Desired size of the fighter list.
    • startLevel

      int startLevel
      Starting level for new recruits.
    • fighterPartySize

      int fighterPartySize
      Fighter party size.
    • fightManVsMonster

      boolean fightManVsMonster
      Fight man vs. monster?
    • useMonsterTreasureType

      boolean useMonsterTreasureType
      Treasure award by monster type?
    • useRevisedXPAwards

      boolean useRevisedXPAwards
      XP awards use revised table from Sup-I?
    • reportFighterStats

      boolean reportFighterStats
      Report summary statistics?
    • reportFighterData

      boolean reportFighterData
      Report full details on each fighter?
    • reportMonsterKills

      boolean reportMonsterKills
      Report kills achieved by each monster type?
    • reportTotalMonsterKills

      boolean reportTotalMonsterKills
      Report total kills by monster level?
    • reportYearEnd

      boolean reportYearEnd
      Report status at each year-end?
    • reportXPAwards

      boolean reportXPAwards
      Report XP award ratios?
    • reportAllXPAwards

      boolean reportAllXPAwards
      Report each individual XP award?
    • reportEveryEncounter

      boolean reportEveryEncounter
      Report every encounter?
    • makeWinPercentMatrix

      boolean makeWinPercentMatrix
      Create win percent matrix?
    • baseArmorType

      Armor.Type baseArmorType
      Base armor type for fighters.
    • supMaxAge

      int supMaxAge
      Age of oldest fighter who ever lived.
    • exitAfterArgs

      boolean exitAfterArgs
      Flag to escape after parsing arguments.
    • totalMonsterXP

      long totalMonsterXP
      Total awarded monster XP.
    • totalTreasureXP

      long totalTreasureXP
      Total awarded treasure XP.
    • typicalAlignment

      Alignment typicalAlignment
      Typical alignment for generated men.
  • Constructor Details

    • Arena

      public Arena()
      Constructor.
    • Arena

      public Arena(int numFighters, boolean manVsMon, boolean monTreas)
      Constructor (set size, sim modes).
  • Method Details

    • printBanner

      void printBanner()
      Print program banner.
    • printUsage

      public void printUsage()
      Print usage.
    • parseArgs

      public void parseArgs(String[] args)
      Parse arguments.
    • getParamInt

      int getParamInt(String s)
      Get integer following equals sign in command parameter.
    • setBaseArmorFromInt

      void setBaseArmorFromInt(int code)
      Set base armor type from integer code.
    • setReportingFromParamCode

      void setReportingFromParamCode(String s)
      Set reporting for param char code.
    • runSim

      public void runSim()
      Run the arena's top-level algorithm.
    • runOneCycle

      public void runOneCycle()
      Run one cycle of fights for the whole list.
    • recruitNewFighters

      void recruitNewFighters()
      Fill out the fighter list.
    • newFighter

      Character newFighter(int level)
      Create a new fighter of the indicated level.
    • fightDuels

      void fightDuels()
      Fight duels for all fighters in list.
    • fightDuelsManVsMan

      void fightDuelsManVsMan()
      Duel each pair of fighters.
    • fightDuelsManVsMonster

      void fightDuelsManVsMonster()
      Duel each fighter against random monsters.
    • createFighterParty

      Party createFighterParty(Monster fighter, int numFighters)
      Create a party for a given fighter of same level.
    • createMonsterParty

      Party createMonsterParty(int dungeonLevel, int numFighters)
      Create a monster party to confront a number of fighters.
    • getMonsterNumber

      int getMonsterNumber(Monster monster, int dungeonLevel, int numFighters)
      Get number of monsters for encounter (a la Vol-3, p. 11). In tabletop practice, we would like to assume a party size of 4, and roll 1d6 * dungeonLevel / monsterEHD (round to closest, possibly 0). Note E(1d6) ~ expected nominal party size of 4. Extra calculations here are to scale for different party sizes.
    • grantFightAwards

      void grantFightAwards(Party party1, Party party2, int level)
      Grant post-fight awards.
    • grantVictorAwards

      void grantVictorAwards(Party victor, Party loser, int level)
      Grant awards from fight to victorious party.
    • partyFallenXPValue

      int partyFallenXPValue(Party party)
      XP award value for given fallen party. Conditional on Vol-1 or Sup-I method.
    • treasureValue

      int treasureValue(Party party, int level)
      Value of treasure award (nominally in gold pieces). Conditional on using monster treasure type.
    • treasureValueByMonster

      int treasureValueByMonster(Party party)
      Get treasure value as per monster treasure type. (Recommended for wilderness encounters only.)
    • treasureValueByDungeon

      int treasureValueByDungeon(Party party, int level)
      Get treasure value as per level beneath surface. (Officially valid for underworld only.)
    • awardXP

      void awardXP(Monster monster, int xp)
      Award XP and magic to one creature/character.
    • addToKillTally

      void addToKillTally(Monster monster)
      Add to the kill tally for winning monster type.
    • yearEnd

      void yearEnd(int year)
      End the year.
    • reportStart

      public void reportStart()
      Print simulation starting info.
    • reportEnd

      public void reportEnd()
      Print simulation ending info.
    • reportFighterData

      void reportFighterData()
      Print every individual fighter (for testing small groups).
    • reportFighterStatistics

      public void reportFighterStatistics()
      Generate and print statistics for the fighter list.
    • compileStatBins

      StatBin[] compileStatBins()
      Compile fighters into statistical bins by level.
    • reportMonsterKills

      void reportMonsterKills()
      Prints number killed by each monster type.
    • reportMonsterKillsAtLevel

      void reportMonsterKillsAtLevel(int level)
      Prints number killed by each monster at given level.
    • reportTotalMonsterKills

      void reportTotalMonsterKills()
      Prints total kills at each monster level.
    • reportXPAwards

      void reportXPAwards()
      Report XP award ratios.
    • reportYearEnd

      void reportYearEnd(int year)
      Report year-end summary.
    • getOldestFighter

      Character getOldestFighter()
      Find oldest fighter the list. Break ties by highest level.
    • getTopFighters

      public List<Monster> getTopFighters(int number)
      Get the top fighters in list.
    • setBaseArmor

      public void setBaseArmor(Armor.Type type)
      Set the base armor type.
    • setPctMagicPerLevel

      public void setPctMagicPerLevel(int percent)
      Set change of magic per level.
    • setFightCycles

      public void setFightCycles(int num)
      Set total number of fight cycles.
    • setTypicalAlignment

      public void setTypicalAlignment(Alignment align)
      Set typical alignment.
    • getRandomAlignment

      private Alignment getRandomAlignment()
      Get random alignment for one man.
    • main

      public static void main(String[] args)
      Main application method.