package th; // This file concerns leveling up; the "levels" of the game are generated // mainly by Map.java. See also Node.java, Region.java, and the files for // specific regions. // public class Level { public static Level humanoid = new Level( 2, 2, 2, 8,// increments 25, 25, 30, 150, // Maximums. 33, 33, 33 // Chances of each. ); public static Level dragon = new Level( 2, 2, 2, 8,// increments 45, 45, 45, 250, // Maximums. 13, 13, 13 // Chances of each. ); public static Level pathetic_creature = new Level( 1, 1, 1, 4,// increments 10, 10, 10, 20, // Maximums. 25, 25, 25 // Chances of each. ); public static Level moderate_animal = new Level( 2, 2, 1, 8,// increments 30, 30, 10, 160, // Maximums. 50, 33, 10 // Chances of each. ); public static Level fox = new Level( 4, 4, 4, 8, 25, 50, 30, 120, 50, 75, 50 ); public static Level beast = new Level( 5, 2, 2, 15,// increments 36, 36, 12, 250, // Maximums. 55, 25, 15 // Chances of each. ); public static Level flayer = new Level ( 3, 3, 3, 6, 25, 25, 40, 110, 50, 50, 50 ); int st, dx, in, hp; // 1..n increase in this level. int mst, mdx, min, mhp; // Maximums. int pst, pdx, pin; // Percent chance of advancement in this area. public Level(int st, int dx, int in, int hp, int mst, int mdx, int min, int mhp, int pst, int pdx, int pin) { this.st = st; this.mst = mst; this.pst = pst; this.dx = dx; this.mdx = mdx; this.pdx = pdx; this.in = in; this.min = min; this.pin = pin; this.hp = hp; this.mhp = mhp; } public void level_up(Mon mon) { int delta; delta = Utl.d(dx); if (Utl.rn(100) < pdx && delta + mon.mdx <= mdx) { Ifc.you("|is| more dexterous!", mon); mon.mdx += delta; mon.dx += delta; g.update.addElement(mon); } delta = Utl.d(st); if (Utl.rn(100) < pst && delta + mon.mst <= mst) { Ifc.you("|is| stronger!", mon); mon.mdx += delta; mon.dx += delta; } delta = Utl.d(in); if (Utl.rn(100) < pin && delta + mon.min <= min) { Ifc.you("|is| smarter!", mon); mon.min += delta; mon.in += delta; } delta = Utl.d(hp); if (delta + mon.mhp <= mhp) { mon.mhp += delta; mon.hp += delta; } } public void levels(Mon mon, int n) { for (int i = 0; i < n; ++i) level_up(mon); } }