Exemplo n.º 1
0
void Hero::castSpell(int index, Creature& target)
{
	Spell* spell = spells.at(index);
	if (mana < spell->getManaCost()) {
		IOHelper::writeLine("You don't have enough mana to cast that!");
		return;
	}
	spell->cast(target);
	mana -= spell->getManaCost();
}
Exemplo n.º 2
0
Spell* Champion::castSpell(uint8 slot, float x, float y, Unit* target) {
   if(slot >= spells.size()) {
      return 0;
   }
   
   Spell* s = spells[slot];
   
   if(s->getCost() > stats->getCurrentMana() || s->getState() != STATE_READY) {
      return 0;
   }
   
   s->cast(x, y, target);
   stats->setCurrentMana(stats->getCurrentMana()-s->getCost());
   return s;
}
Exemplo n.º 3
0
Spell* Champion::castSpell(uint8 slot, float x, float y, Unit* target, uint32 futureProjNetId) {
   if(slot >= spells.size()) {
      return 0;
   }
   
   Spell* s = spells[slot];
   
   s->setSlot(slot);//temporary hack until we redo spells to be almost fully lua-based
   
   if(s->getCost() > stats->getCurrentMana() || s->getState() != STATE_READY) {
      return 0;
   }
   
   s->cast(x, y, target, futureProjNetId);
   stats->setCurrentMana(stats->getCurrentMana()-s->getCost());
   return s;
}