Skip to content

Spell

Spell declaration and removal

To create a spell you need to register first. You need to do it only once. Best way to do it is in on_load function.

Declaring a spell

//Registers a spell
//  - spellslot of the spell
//  - range of the spell
script_spell* plugin_sdk->register_spell( spellslot slot, float range );

Removal of the spell

//Removes the spell from SDK
//  - pointer to the spell
//
bool plugin_sdk->remove_spell( script_spell* spell );

Example of declaration and removal:

script_spell* q = nullptr;

PLUGIN_API bool on_sdk_load( plugin_sdk_core* plugin_sdk_good )
{
    DECLARE_GLOBALS( plugin_sdk_good );

    q = plugin_sdk->register_spell( spellslot::q, 125.f );

    return true;
}

PLUGIN_API void on_sdk_unload( )
{
    plugin_sdk->remove_spell( q );
}

Declaring spell values

Declaring a skillshot

//Sets a spell to a skillshot
//  - delay in seconds of a spell
//  - radius of a spell
//  - speed of a spell
//  - collision flags of a spell
//  - type of a spell [ skillshot_line, skillshot_circle, skillshot_cone ]
//
void set_skillshot( float delay, float radius, float speed, std::vector<collisionable_objects> flags, skillshot_type skillshot_type );

Important notes:

  • delay is expressed in seconds. Example: Ezreal Q has delay of 250ms you need to pass 0.25f. Reminder: 1 second is 1000 milliseconds
  • radius of a spell is it's width / 2. Example: Ezreal Q has width of 120 you need to pass 60 to the function
  • speed of a spell is the missile speed. If the spell has no missile you need to pass a FLT_MAX value
  • flags is a vector of all collision object types of a spell. Available types:

    collisionable_objects::minions

    collisionable_objects::heroes

    collisionable_objects::yasuo_wall

    collisionable_objects::walls

    collisionable_objects::allies

skillshot_type is the type of the spell. Available types:

skillshot_type::skillshot_line

skillshot_type::skillshot_circle

skillshot_type::skillshot_cone

Declaring a charged spell

Info

You can use set skillshot together with set_charged on a single spell.

//Sets a spell to a charged spell
//  - minimum range
//  - maximum charged range 
//  - charge duration is seconds
//
void set_charged( float range_min, float range_max, float charge_duration );

Examples:

  • Declaring Ezreal's Q

    q = plugin_sdk->register_spell(spellslot::q, 1200);
    q->set_skillshot(0.25f, 60.0f, 2000.0f, { collisionable_objects::minions, collisionable_objects::yasuo_wall, collisionable_objects::heroes }, skillshot_type::skillshot_line);
    

  • Declaring Xerath's Q

    q = plugin_sdk->register_spell(spellslot::r, 1450);
    q->set_charged(735.0f, 1450.0f, 2.0f);
    q->set_skillshot(0.625f, 70.f, FLT_MAX, { }, skillshot_type::skillshot_line);
    

  • Declaring Xerath's R

    r = plugin_sdk->register_spell(spellslot::r, 5000);
    r->set_skillshot(0.7f, 200.f, FLT_MAX, { }, skillshot_type::skillshot_circle);
    

Class reference

class script_spell
{
    float charged_min_range{};
    float charged_max_range{};
    float charging_started_time{};
    float charge_duration{};

    float radius{};
    float speed{};
    float delay{};
    float _range{};

    bool collision{};
    bool is_charged_spell = false;

    spellslot slot = spellslot::invalid;

    vector from{};
    skillshot_type type{};
    std::vector<collisionable_objects> collision_flags{};
    damage_type _damage_type{};

    script_spell( );
    script_spell( spellslot slot );
    script_spell( spellslot slot, float range );
    script_spell( spellslot slot, float range, skillshot_type type, float delay, float speed, float radius, bool collision );

    void update_chargeable_spell_handle( spellslot slot, bool release_cast );

    virtual ~script_spell( ) = default;
    virtual spell_data_inst_script handle( );
    virtual std::string name( );
    virtual uint32_t name_hash( );

    virtual float cooldown_time( );
    virtual float mana_cost( );
    virtual float range( );
    virtual float charged_percentage( );

    virtual int ammo( );
    virtual int toogle_state( );
    virtual int level( );

    virtual bool is_ready( float time = 0.f );

    virtual bool cast( );
    virtual bool cast( game_object_script unit, hit_chance minimum, bool aoe = false, int min_targets = 0 );
    virtual bool cast( vector position );
    virtual bool cast( game_object_script unit );
    virtual bool cast( vector start_position, vector end_position );
    virtual bool fast_cast( vector position );

    virtual bool cast_on_best_farm_position( int min_minions = 2, bool is_jugnle_mobs = false );

    virtual bool is_charging( );
    virtual bool is_fully_charged( );

    virtual bool start_charging( );
    virtual bool start_charging( const vector& position );

    virtual float get_damage( game_object_script target, int stage = 0 );

    virtual std::vector<collisionable_objects> get_collision_flags( );
    virtual vector range_check_from( );

    virtual void set_radius( float radius );
    virtual void set_speed( float speed );
    virtual void set_delay( float delay );
    virtual void set_range( float range );
    virtual void set_sollision_flags( std::vector <collisionable_objects> flags );
    virtual void set_range_check_from( vector const& position );
    virtual void set_skillshot( float delay, float radius, float speed, std::vector<collisionable_objects> flags, skillshot_type skillshot_type );
    virtual void set_charged( float range_min, float range_max, float charge_duration );

    virtual prediction_output get_prediction( game_object_script target, bool aoe = false, float overrideRange = -1, std::vector<collisionable_objects> collisionable = {} );
    virtual prediction_output get_prediction_no_collision( game_object_script target, bool aoe = false, float overrideRange = -1 );

    virtual float get_last_cast_spell_time( );

    virtual vector get_cast_on_best_farm_position( int min_minions = 2, bool is_jugnle_mobs = false );

    virtual void set_damage_type( damage_type type );
    virtual damage_type get_damage_type( );

    virtual spellslot get_slot( );
    virtual float get_speed( );
    virtual float get_delay( );
    virtual float get_radius( );

    virtual bool can_cast( game_object_script unit );

    virtual bool is_in_range( game_object_script target, float range = -1 );
    virtual bool is_in_range( vector const& point, float range = -1 );

    int8_t icon_index( );
    game_object_script get_target( float extra_range = 0 );
    prediction_output get_prediction( game_object_script target, vector origin, vector range_check_from );
}