But I wrote the following edit to the AI.pm and Attack.pm files.
The objective of this code is to allow kore to target the Firewall skill vertically if the attackSkillSlot block has a new setting called "useVertical" which is set to not zero and the skill is ground targeted.
can a real programmer look at this and implement it if it is good, please?
the new ai_skillUse2 in AI.pm
Code: Select all
sub ai_skillUse2 {
my ($skill, $lvl, $maxCastTime, $minCastTime, $target, $prefix, $waitBeforeUse, $tag, $vertical) = @_;
#check to use vertical, and if this skill is location cast, to prevent errors
if ($vertical && ($skill->getTargetType == Skill::TARGET_LOCATION)) {
#is declaring variables nessecary?
#Can I just call this information in the if evals?
#do I need three arrays?
#for @target_loc = @{$target->{pos_to}}{qw(x y)};, should I be using ->(pos) instead of ->(pos_to)?
#can I this call a seperate function to make ai_skilluse2 cleaner?
my @target_loc = @{$target->{pos_to}}{qw(x y)};
my @my_loc = @{$skill->getOwner->{pos}}{qw(x y)};
my @vertical_loc = (0 0);
#based on the simple pathing algorithm that mobs have, I know where to firewall based on where the mob stands in relation to me
#if the mob is farther horizontally than vertically, or if it is perfectly diagonal
if (abs($my_loc[0] - $target_loc[0]) >= abs($my_loc[1] - $target_loc[1])) {
#if the mob is below me
if ($my_loc[1] > $target_loc[1]) {
$vertical_loc[1]--;
}
#else if the mob above me
else if ($my_loc[1] < $target_loc[1]) {
$vertical_loc[1]++;
}
}
#else if the mob is farther vertically than horizontally
else if (abs($my_loc[0] - $target_loc[0]) < abs($my_loc[1] - $target_loc[1])) {
#if the mobs is on my left
if ($my_loc[0] > $target_loc[0]) {
$vertical_loc[0]--;
}
#else if the mob on my right
else if ($my_loc[0] < $target_loc[0]) {
$vertical_loc[0]++;
}
}
#if I haven't incremented, then I can't firewall. so check if I have then process the skill
if (abs($vertical_loc[0]) || abs($vertical_loc[1])) {
#use the skill on the location.
#if the mob is actually on my location, I did not increment the location array anyways. who knows why that would happen, but it is handled.
ai_skillUse(
$skill->getHandle(),
$lvl,
$maxCastTime,
$minCastTime,
$my_loc[0] + $vertical_loc[0], $my_loc[1] + $vertical_loc[1],
$tag, undef, $waitBeforeUse, $prefix
)
#Ideally right now I would move 2 cells down my firewall.
#I don't know if this is the proper place to call the move function
#but if it is, the pseudocode is something like
#my @move_loc = (0 0);
#if the mob is farther horizontally than vertically, or if it is perfectly diagonal
#if (abs($my_loc[0] - $target_loc[0]) >= abs($my_loc[1] - $target_loc[1])) {
# #if the mob is on my left
# if ($my_loc[0] > $target_loc[0]) {
# $move_loc[0]+=2;
# }
# #else if the mob on my right
# else if ($my_loc[0] < $target_loc[0]) {
# $move_loc[0]-=2;
# }
#}
##else if the mob is farther vertically than horizontally
#else if (abs($my_loc[0] - $target_loc[0]) < abs($my_loc[1] - $target_loc[1])) {
# #if the mobs is above me
# if ($my_loc[1] < $target_loc[1]) {
# $move_loc[0]-=2;
# }
# #else if the mob below me
# else if ($my_loc[1] > $target_loc[1]) {
# $move_loc[0]+=2;
## }
#}
#move (($my_loc[0] + move_loc[0]) ($my_loc[1] + move_loc[1]));
}
}
else {
ai_skillUse(
$skill->getHandle(),
$lvl,
$maxCastTime,
$minCastTime,
$skill->getTargetType == Skill::TARGET_LOCATION ? (@{$target->{pos_to}}{qw(x y)})
: $skill->getTargetType == Skill::TARGET_SELF ? ($skill->getOwner->{ID}, undef)
: ($target->{ID}, undef),
$tag, undef, $waitBeforeUse, $prefix
)
}
}
Code: Select all
ai_skillUse2(
$skill,
$config{"attackSkillSlot_${slot}_lvl"} || $char->getSkillLevel($skill),
$config{"attackSkillSlot_${slot}_maxCastTime"},
$config{"attackSkillSlot_${slot}_minCastTime"},
$config{"attackSkillSlot_${slot}_isSelfSkill"} ? $char : $target,
"attackSkillSlot_${slot}",
undef,
"attackSkill",
$config{"attackSkillSlot_${slot}_useVertical"},
);