/** * This function awards some bonus items based on the hero's professional skills. * * @param h */ private static void applyBonusItems(Thing h) { if (h.getFlag(Skill.PRAYER)) { Thing t = Lib.create("potion of holy water"); t.set("Number", h.getStat(Skill.PRAYER)); h.addThingWithStacking(t); } if (h.getFlag(Skill.TRADING)) { Thing t = Lib.create("sovereign"); t.set("Number", h.getStat(Skill.TRADING)); h.addThingWithStacking(t); } if (h.getFlag(Skill.WEAPONLORE)) { Thing t = Lib.createType("IsWeapon", RPG.d(2, 6)); h.addThingWithStacking(t); } if (h.getFlag(Skill.COOKING)) { Thing t = Lib.createType("IsFood", 25); t.set("Number", h.getStat(Skill.COOKING)); h.addThingWithStacking(t); } if (h.getFlag(Skill.ARCHERY)) { // a reanged weapon + ammo Thing t = Lib.createType("IsRangedWeapon", RPG.d(h.getStat(Skill.ARCHERY), 6)); Thing ms = RangedWeapon.createAmmo(t, RPG.d(h.getStat(Skill.ARCHERY), 6)); h.addThing(t); h.addThing(ms); } Thing[] ws = h.getFlaggedContents("IsWeapon"); if (ws.length == 0) { h.addThing(Lib.createType("IsWeapon", 1)); } }