Method code for $has_reactions.check_reactions()

[Turn on line numbering]
arg type, str, sender;
var rnum, t, id, chance, times, method, template, m;

rnum = random(100);
for t in ([type, 'any]) {
    if (!dict_contains(active, t))
        continue;
    for id in (dict_keys(active[t])) {
        [chance, times] = active[t][id];
        if (rnum > chance)
            break;
        [method, template] = reactions[id];
        if ((m = str.(method)(template))) {
            if (times == 1)
                .remove_active(t, id);
            else if (times > 1)
                .update_active(t, id, [chance, --times]);
            if (.do_reaction(str, m, id, sender) != 'continue)
                return;
        }
    }
}

["// Created 23-Aug-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark