Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. if (!changes && lastCast > 1000)
  2. {
  3. //if get hp lss then file
  4. bool needToHeal = ((double)player.getHp()/player.getHpMax())<0.75; //this line is a problem
  5.  
  6. for (auto a = generalActions.spellActions.begin(); a != generalActions.spellActions.end(); ++a)
  7. {
  8. if (a->getResult(player) == true)
  9. {
  10. if (a->delayCount == 0)
  11. {
  12. Spell spell = settings.getSpell(a->spellId.getId());
  13. if ((player.getMagicLevel() >= spell.magicLevel) && (player.getMana() >= spell.mana))
  14. {
  15. if (needToHeal)
  16. {
  17. if (spell.type != SpellType::HEALING)
  18. {
  19. continue;
  20. }
  21. }
  22. else if (player.isAttacking())
  23. {
  24. if (spell.type != SpellType::ATTACKING)continue;
  25. if (mobsWithin(1) >= spell.mobsAround)
  26. {
  27. //can cast
  28. }
  29. else
  30. {
  31. if ((spell.mobsAround == 1) && (mobsWithin(1) >= spell.mobsAround))
  32. {
  33. //can cast
  34. }
  35. else
  36. {
  37. //cant
  38. continue;
  39. }
  40. }
  41. }
  42. else if (spell.type == SpellType::BUFF)
  43. {
  44.  
  45. }
  46. else if (!player.isAttacking() && (spell.type == SpellType::ATTACKING))
  47. {
  48. continue;
  49. }
  50. BYTE spellBytes[2];
  51. a->spellId.toBytes(spellBytes);
  52. messenger.sendPacket(Packets::cast_spell(spellBytes));
  53.  
  54.  
  55. //messenger.castSpell(a->spellId.getId());
  56.  
  57. a->delayCount = a->getDelay();
  58. changes = true;
  59. lastCast = 0;
  60. break;
  61. }
  62. }
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement