abs(number)
click to toggle source
def abs number
Math.abs number
end
back?(target_position)
click to toggle source
def back? target_position
Angles.angle_diff(target_phi, Math::PI) < Math::PI / 6.0
end
back_and_close?()
click to toggle source
def back_and_close?
@@back_range.include?(@target_position_phi) and (@target_position.getR <= @@strafe_distance)
end
checkProgress()
click to toggle source
close_enough?()
click to toggle source
def close_enough?
@target_position.getR < 0.5
end
is_current_skill?(possibilities)
click to toggle source
def is_current_skill? possibilities
current_skill_name = currentSkill.nil? ? "null" : currentSkill.name
possibilities.member?(current_skill_name)
end
is_on_position?()
click to toggle source
def is_on_position?
abs(@agentModel.getPosition().getXYDistanceFrom(@target_position_global)) < 0.5
end
left_and_close?()
click to toggle source
def left_and_close?
(@target_position.r <= @@strafe_distance) and @@left_strafe_range.include?(Angles.normalize(@target_position_phi))
end
left_and_distant?()
click to toggle source
def left_and_distant?
@@left_range.include? Angles.normalize(@target_position_phi)
end
pickLowSkill()
click to toggle source
def pickLowSkill
if not @validity_proc.call
return nil
end
if @target_position_global == nil
return nil
else
@agentModel = Java::sk.fiit.jim.agent.models.AgentModel.getInstance
@target_position = @agentModel.relativize(@target_position_global)
end
@target_position_phi = @target_position.getPhi()
if @target_position_phi != nil
@target_position_phi2 = @target_position_phi
elsif @target_position_phi == nil and plan.see_ball?
@target_position_phi = @target_position_phi2
end
case
when me.on_ground?
return
when is_on_position?
@agentInfo.loguj("close ")
return nil
when left_and_close?:
return get_skill("step_left")
when right_and_close?:
return get_skill("step_right")
when back_and_close?:
return get_skill("walk_back")
when straight?:
return get_skill("walk_forward")
when left_and_distant?:
return get_skill("turn_left_cont_20")
when right_and_distant?:
return get_skill("turn_right_cont_20")
else
return nil
end
end
right_and_close?()
click to toggle source
def right_and_close?
(@target_position.r <= @@strafe_distance) and @@right_strafe_range.include?(Angles.normalize(@target_position_phi))
end
right_and_distant?()
click to toggle source
def right_and_distant?
@@right_range.include? Angles.normalize(@target_position.getPhi())
end
straight?()
click to toggle source
def straight?
@@straight_range1.include?(@target_position_phi) or @@straight_range2.include?(@target_position_phi)
end