float hitchance(string id) {
if (id == "jiggle") return 1.0;
if (have_equipped($item[operation patriot shield]) && happened("shieldthrown") && !happened("shieldcrit")) return 1;
// cunctatitis blocks 50% of everything, black cat blocks 50% of items/skills
float through = 1.0 - 0.5*to_int(have_effect($effect[cunctatitis]) > 0);
if (id == "attack") through *= 1.0 - fumble_chance();
else if (my_fam() == $familiar[black cat]) through *= 0.5;
[COLOR="#FF0000"]float attack = my_stat(current_hit_stat().to_string()) + ((equipped_item($slot[weapon]) == $item[none] && equipped_item($slot[offhand]) == $item[none]&& have_skill($skill[master of the surprising fist]))? 20: 0);[/COLOR]
matcher aid = create_matcher("(attack|use|skill) ?(\\d+)?",id);
if (aid.find()) switch (aid.group(1)) {
case "attack": break;
case "use": return (contains_text(to_string(m),"Naughty Sorceress") || m == $monster[bonerdagon]) ? through*0.75 : through;
case "skill": if (contains_text(to_string(m),"Naughty Sorceress") || m == $monster[bonerdagon])
through *= 0.5;
switch (to_int(aid.group(2))) {
case 0001: case 2003: case 7097: break; // beak, head, turtle*7 tails all have regular hitchance
case 7010: case 7011: case 7012: case 7013: case 7014: attack = 10; // bottle rockets are mox+10
case 7008: attack += my_stat("Moxie"); break; // moxman
case 1003: if (have_skill($skill[eye of the stoat])) attack += 20; // ts
case 1004: case 1005: if (my_class() == $class[seal clubber] && item_type(equipped_item($slot[weapon])) == "club" &&
weapon_hands(equipped_item($slot[weapon])) == 2) return through; // lts
if ($ints[1003,1004] contains aid.group(2).to_int()) break;
if (have_skill($skill[eye of the stoat])) attack *= 1.25 + 0.05*to_int(my_class() == $class[seal clubber]); break;
case 2015: case 2103: attack = my_stat("Muscle") + 20; break; // kneebutt & head+knee
default: attack = 0;
}
}
return attack == 0 ? through : min(critchance() + (1.0 - critchance())*max(6.0 + attack - max(monster_stat("def"),0),0)/11.0,1.0)*through;
}