# SpellDataInst

# 说明

SpellDataInst类表示英雄技能的实例,包含技能的当前状态信息,如冷却时间、等级、充能数等,并提供施放技能的方法。

# 如何使用

AIBaseClient* hero = ObjectManager::Player();
if (hero) {
    SpellDataInst* qSpell = hero->GetSpell(eSpellSlot::Q);
    if (qSpell && qSpell->Level() > 0 && qSpell->RemainingCooldown() <= 0) {
        // Q技能已学习且不在冷却中,可以使用
    }
}

# Ammo

int Ammo()

获取技能当前的弹药数量。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    int ammo = spell->Ammo();
    // 使用弹药数量
}

# GunAmmo

int GunAmmo()

获取技能的枪弹数量。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    int gunAmmo = spell->GunAmmo();
    // 使用枪弹数量
}

# Level

int Level()

获取技能的当前等级。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::E);
if (spell) {
    int level = spell->Level();
    // 使用技能等级
}

# Slot

eSpellSlot Slot()

获取技能的栏位。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell) {
    eSpellSlot slot = spell->Slot();
    // 使用技能栏位
}

# ToggleState

int ToggleState()

获取技能的切换状态。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    int toggleState = spell->ToggleState();
    // 使用技能切换状态
}

# Cooldown

float Cooldown()

获取技能的总冷却时间。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    float cd = spell->Cooldown();
    // 使用技能总冷却时间
}

# RemainingCooldown

float RemainingCooldown()

获取技能的剩余冷却时间。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell) {
    float remainingCd = spell->RemainingCooldown();
    if (remainingCd <= 0) {
        // 技能已冷却完毕,可以使用
    }
}

# AmmoRechargeStart

float AmmoRechargeStart()

获取弹药开始充能的时间点。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    float rechargeStart = spell->AmmoRechargeStart();
    // 使用弹药充能开始时间
}

# ChargingStartTime

float ChargingStartTime()

获取技能开始充能的时间点。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    float chargingStart = spell->ChargingStartTime();
    // 使用技能充能开始时间
}

# SData

SpellData* SData()

获取技能的基础数据。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::E);
if (spell) {
    SpellData* spellData = spell->SData();
    if (spellData) {
        // 使用技能基础数据
    }
}

# Stacks

int Stacks()

获取技能的当前叠加层数。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    int stacks = spell->Stacks();
    // 使用技能叠加层数
}

# IconIndex

uint8_t IconIndex()

获取技能图标的索引。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    uint8_t iconIndex = spell->IconIndex();
    // 使用技能图标索引
}

# LevelUpSpell

void LevelUpSpell()

提升技能等级。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell && spell->CanBeUpgraded()) {
    spell->LevelUpSpell();
    // 技能已升级
}

# CanBeUpgraded

bool CanBeUpgraded()

判断技能是否可以升级。

SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell && spell->CanBeUpgraded()) {
    // 技能可以升级
}

# CastChargingSpell

bool CastChargingSpell(Vector const& position, bool triggerEvent = true)

施放蓄力技能到指定位置。

参数名字 参数类型 描述
position Vector const& 目标位置
triggerEvent bool 是否触发事件,默认为true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    Vector targetPos = enemy->Position();
    spell->CastChargingSpell(targetPos);
}

# CastSpell

bool CastSpell(bool triggerEvent = true)

施放无目标技能。

参数名字 参数类型 描述
triggerEvent bool 是否触发事件,默认为true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    spell->CastSpell();
}

# CastSpell

bool CastSpell(AIBaseClient* target, bool triggerEvent = true)

施放指向单位的技能。

参数名字 参数类型 描述
target AIBaseClient* 目标单位
triggerEvent bool 是否触发事件,默认为true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    AIBaseClient* enemy = GetNearestEnemy();
    if (enemy) {
        spell->CastSpell(enemy);
    }
}

# CastSpell

bool CastSpell(Vector const& position, bool triggerEvent = true)

施放指向位置的技能。

参数名字 参数类型 描述
position Vector const& 目标位置
triggerEvent bool 是否触发事件,默认为true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::E);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    Vector targetPos = enemy->Position();
    spell->CastSpell(targetPos);
}

# CastSpell

bool CastSpell(Vector const& startPosition, Vector const& endPosition, bool triggerEvent = true)

施放有起始和终点位置的技能。

参数名字 参数类型 描述
startPosition Vector const& 起始位置
endPosition Vector const& 目标位置
triggerEvent bool 是否触发事件,默认为true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    Vector startPos = hero->Position();
    Vector endPos = enemy->Position();
    spell->CastSpell(startPos, endPos);
}