View Single Post
  #8  
Old 12-06-2018, 06:37 PM
Almusious
Fire Beetle
 
Join Date: Sep 2012
Posts: 25
Default

May as well kill the randomizing sub, some unneeded variable declarations and also utilize ones that are already passed in the parser (rather than pulling again):

Code:
sub EVENT_ENTERZONE {   
    if ($zoneid !~ [202, 344, 345]) {
        if ($ulevel == 70) {
            if ($qglobals{"Ultimate_Unrest_Complete"} and $qglobals{"has_gotten_charm_rank_nine"} and $qglobals{"has_gotten_oot_focus"} and $qglobals{"has_finished_ultimate_quest_line"}) {
                if ($class eq "Shadow Knight") {  ## Sure could remember every class number but why, also this is already passed
					$client->SetEntityVariable("sk_flurry_of_hatred", $qglobals{"sk_flurry_of_hatred"});
					$client->SetEntityVariable("sk_flurry_of_destruction", $qglobals{"sk_flurry_of_destruction"});
                }
            }
        }
    }
}

sub EVENT_USE_SKILL {
    if ($zoneid !~ [202, 344, 345]) {
        if ($class eq "Shadow Knight") {
            if ($skill_id ~~ [0..1]) {
                if ($client->GetEntityVariable("sk_flurry_of_hatred")) {
                    if (quest::ChooseRandom(1..100) <= ($client->GetEntityVariable("sk_flurry_of_hatred") * 3)) {
						if ($client->GetTarget()->IsNPC()) { ## Slim change of client changing target before the SA's but just in case
							$client->DoSpecialAttackDamage($client->GetTarget(), $skill_id, 500, 1000, 0) for (1..3);
							$client->Message(14, "Your Flurry of Hatred talent triggered three additional attacks!");
						}
                    }
                }
            } elsif ($skill_id ~~ [2..3]) {
                if ($client->GetEntityVariable("sk_flurry_of_destruction")) {
					if (quest::ChooseRandom(1..100) <= ($client->GetEntityVariable("sk_flurry_of_destruction") * 4)) {
						if ($client->GetTarget()->IsNPC()) { ## Slim change of client changing target before the SA's but just in case
							$client->DoSpecialAttackDamage($client->GetTarget(), $skill_id, 500, 1000, 0) for (1..3);
							$client->Message(14, "Your Flurry of Destruction talent triggered three additional attacks!");
						}
					}
                }
            }
        }
    }
}
Also added a check (main reason for posting this) to ensure the target is an NPC, granted not checking if the one that was originally targeted, but a check just the same. At least this way should someone get really lucky (or unlucky I suppose) won't possibly kill themselves if they target self for a buff or such.
Reply With Quote