record combat_rec {
string ufname; // user-friendly name
string dmg; // damage formula
string dmgtypes; // types of damage done
string special; // comma-delimited list of other action results
};
combat_rec [string, int] factors;
load_current_map("batfactors",factors); // master data file of battle factors
if (last_monster() == $monster[mother slime] || last_monster() == $monster[chester] || have_effect($effect[form of...bird]) > 0) {
remove factors["item"]; // remove items if impossible
vprint("You can't use items in this combat.",-6);
}
if (have_effect($effect[temporary amnesia]) > 0) {
remove factors["skill"]; // remove skills if impossible
vprint("You can't cast any skills with amnesia!",-5);
}
foreach ty,in,rec in factors { // reduce any ranges to average values
string deranged(string sane) {
matcher rng = create_matcher("\\{\\s*?(.+?)\\s*?,\\s*?(.+?)\\s*?,\\s*?(.+?)\\s* ?\\}",sane);
while (rng.find()) sane.replace_string(rng.group(0),rng.group(2));
return sane;
}
factors[ty,in].dmg = deranged(rec.dmg);
factors[ty,in].special = deranged(rec.special);
}