Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!changes && lastCast > 1000)
- {
- //if get hp lss then file
- bool needToHeal = ((double)player.getHp()/player.getHpMax())<0.75; //this line is a problem
- for (auto a = generalActions.spellActions.begin(); a != generalActions.spellActions.end(); ++a)
- {
- if (a->getResult(player) == true)
- {
- if (a->delayCount == 0)
- {
- Spell spell = settings.getSpell(a->spellId.getId());
- if ((player.getMagicLevel() >= spell.magicLevel) && (player.getMana() >= spell.mana))
- {
- if (needToHeal)
- {
- if (spell.type != SpellType::HEALING)
- {
- continue;
- }
- }
- else if (player.isAttacking())
- {
- if (spell.type != SpellType::ATTACKING)continue;
- if (mobsWithin(1) >= spell.mobsAround)
- {
- //can cast
- }
- else
- {
- if ((spell.mobsAround == 1) && (mobsWithin(1) >= spell.mobsAround))
- {
- //can cast
- }
- else
- {
- //cant
- continue;
- }
- }
- }
- else if (spell.type == SpellType::BUFF)
- {
- }
- else if (!player.isAttacking() && (spell.type == SpellType::ATTACKING))
- {
- continue;
- }
- BYTE spellBytes[2];
- a->spellId.toBytes(spellBytes);
- messenger.sendPacket(Packets::cast_spell(spellBytes));
- //messenger.castSpell(a->spellId.getId());
- a->delayCount = a->getDelay();
- changes = true;
- lastCast = 0;
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement