boolean will_attack()
{
int rounds_to_kill;
boolean no_attack = (m == $monster[procrastination giant] || contains_text(to_lower_case(to_string(m)), "quantum"));
if(get_action("attack").id != "")
{
int round_limit = (my_primestat() == $stat[moxie] ? minmax(maxround - round, 1, maxround) : minmax(maxround - round, 1, 10));
rounds_to_kill = to_int(kill_rounds(regular(1)));
//Info printing
vprint("SpamAttack: " + (rounds_to_kill + round < maxround ? "You will kill the monster in " + rounds_to_kill : "You won't kill the monster before " + maxround) + " rounds with your basic attack.", "purple", 7);
vprint("SpamAttack: The monster will take " + (die_rounds() > maxround ? "more than " + maxround : die_rounds()) + " rounds to kill you.", "purple", 7);
//Debug info printing
vprint("rounds_to_kill: " + rounds_to_kill + ", round_limit: " + round_limit + ", maxround: " + maxround + ", die_rounds(): " + die_rounds() + ", hitchance(\"attack\"): " + hitchance("attack"), "purple", 9);
if(rounds_to_kill < round_limit && die_rounds() > rounds_to_kill && hitchance("attack") > 0.5)
{ //How many rounds will it take me to kill the monster by attacking
vprint("SpamAttack: Expected received damage per round: " + m_dpr(0,0) + ", Rounds to kill: " + rounds_to_kill + ", Expected damage: " + dmg_dealt(get_action("attack").dmg) + ", Hit chance: " + hitchance(1),"purple",9);
if(!no_attack) //Do not attack evil monsters
{
vprint("SpamAttack: Monster is weak. We are just going to bash its head in. It'll take " + rounds_to_kill + " rounds.", "purple", 2);
return true;
}
}
}
return false;
}