What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[Code] Combat snippet collection

p4mdude

Member
Joined
Oct 6, 2015
Messages
55
Reaction score
0
Hi there,

here are some code snippets concerning combat you might find useful.

CanCast()

Description: Checks whether a certain skill is known and whether or not it is on cooldown.
Required input: string (name of skill)
Optional input: none
Return type: boolean
Dependencies: none

Code:
public bool CanCast(string Skill)
            {
                if (isSkillLearned(Skill) && skillCooldown(Skill) == 0) { return true; }
                else { return false; }
            }

RangeCheck()

Description: Checks if your target is within a certain range.
Required input: integer (range to check in yards)
Optional input: none
Return type: boolean
Dependencies: none

Code:
            public bool RangeCheck(int yards)
            {
                if (me.dist(me.target) <= yards) { return true; }
                else { return false; }
            }

CastSkill()

Description: Checks if you can cast a certain skill, checks if your target is within a certain range, then casts the skill.
Required input: string (name of skill), integer (range to check in yards)
Optional input: none
Return type: boolean
Dependencies: CanCast(), RangeCheck()

Code:
public bool CastSkill(string CurrentSkill, int yard)
            {
                if (CanCast(CurrentSkill) && RangeCheck(yard))
                {
                    if (me.isCasting || me.isGlobalCooldown)
                    {
                        return false;
                    }
                    else { 
                    UseSkill(CurrentSkill, false, false); // not suitable for casts on self
                    return true;
                }
                }
                return false;
            }
 
Back
Top