Partyskill casting improvement

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
Historm
Human
Human
Posts: 27
Joined: 01 Jun 2011, 01:59
Noob?: No

Partyskill casting improvement

#1 Post by Historm »

corelogic.pm starting at roughly line 2452 and going to 2479

The following code implements dist and target_dist in a better way for partyskill blocks.

target_dist is a range and applies to how close or far away the target needs to be for this block to be activated
dist is a fixed value and represents the cast distance of the skill.

this is useful because various skills have different casting distances, for example, firebolt has a longer cast range than deluge.

if the target is within the desired range (target_dist), this code will check if the target is within the cast range (dist), and then, as an added bonus, if you are not within the cast range, move you into cast range.

as a working example, the following config block
partySkill Deluge {
lvl 5
target_dist < 9
dist 3
sp > 50
target thorsTKM
target_whenNotGround Deluge
inInventory Yellow Gemstone > 1
whenStatusInactive EFST_POSTDELAY
disabled 0
}

if the character thorsTKM is less than 9 units away, then proceed
if the character is more than 3 units away, then move to 3 units and proceed
the previous code has ensured that you are within 3 units of the target, you can now cast deluge under the target

this will allow you to have support characters follow at a farther distance and still step forward to use buffs.
if (
( # range check
$party_skill{owner}{ID} eq $player->{ID}
|| inRange(distance($party_skill{owner}{pos_to}, $player->{pos}), $config{"partySkill_$i"."_target_dist"} || $config{partySkillDistance} || "0..8")
)
&& ( # target check
!$config{"partySkill_$i"."_target"}
or existsInList($config{"partySkill_$i"."_target"}, $player->{name})
or $player->{ID} eq $char->{ID} && existsInList($config{"partySkill_$i"."_target"}, '@main')
or $char->{homunculus} && $player->{ID} eq $char->{homunculus}{ID} && existsInList($config{"partySkill_$i"."_target"}, '@homunculus')
or $char->{mercenary} && $player->{ID} eq $char->{mercenary}{ID} && existsInList($config{"partySkill_$i"."_target"}, '@mercenary')
)
&& checkPlayerCondition("partySkill_$i"."_target", $ID)
){
######move inrange
my $castDist = distance($party_skill{owner}{pos_to}, $player->{pos_to});
if (
defined $config{"partySkill_$i"."_dist"} &&
$castDist > $config{"partySkill_$i"."_dist"}
){
#message TF("Calculating Route to cast. I am %s away and my range is %s.\n" , $castDist , $config{"partySkill_$i"."_dist"}) , "debug";
my (%vec, %pos);
stand() if ($char->{sitting});
getVector(\%vec, $player->{pos_to}, $party_skill{owner}{pos_to});
moveAlongVector(\%pos, $party_skill{owner}{pos_to}, \%vec, $castDist - $config{"partySkill_$i"."_dist"});
$char->move(@pos{qw(x y)});
}
#####move inrange
[/color]