Ejemplo n.º 1
0
void Projectile::update(int64 diff) {

   if(!target) {
      setToRemove();
      return;
   }
   
   if(target->isSimpleTarget()) { // Skillshot
      const std::map<uint32, Object*>& objects = map->getObjects();
      for(auto& it : objects) {
         if(isToRemove()) {
            return;
         }
         
         if(collide(it.second) && it.second->getNetId() != getNetId()) {//projectile shouldn't collide with itself
            printf("Collide with 0x%08X !\n", it.second->getNetId());
            originSpell->applyEffects(it.second, this);
         }
      }
   } else {
      Unit* u = static_cast<Unit*>(target);
      if(collide(u)) { // Autoguided spell
         if(originSpell) {
            originSpell->applyEffects(u, this);
         } else { // auto attack
            owner->autoAttackHit(u);
            setToRemove();
         }
      }
   }
   
   Object::update(diff);
   
}
Ejemplo n.º 2
0
// Restricted Copy Functions
V3Formula* const
V3Formula::createSuccessor(V3NtkHandler* const handler) const {
   assert (handler);
   if (_handler != handler->getHandler()) {
      Msg(MSG_ERR) << "Require handler to be the Immediate Sucessor of formula's Handler !!" << endl;
      return 0;
   }
   V3Formula* const formula = new V3Formula(handler); assert (formula);
   formula->_formula.clear(); formula->_formula.reserve(_formula.size());
   formula->_rootId = _rootId; V3NetId id; V3InputVec inputs; inputs.clear();
   for (uint32_t i = 0; i < _formula.size(); ++i)
      if (isLeaf(i)) {
         id = getNetId(i); assert (V3NetUD != id);
         id = handler->getCurrentNetId(id); inputs.push_back(id);
         if (V3NetUD == id) {
            Msg(MSG_ERR) << "Unresolvable Formula Found !!" << endl;
            delete formula; return 0;
         }
         else formula->_formula.push_back(make_pair(_formula[i].first, inputs));
         inputs.clear();
      }
      else formula->_formula.push_back(_formula[i]);
   assert (formula); return formula;
}
Ejemplo n.º 3
0
// Elaboration Functions
void
V3Formula::collectLeafFormula(V3UI32Set& netSet) const {
   for (uint32_t i = 0; i < _formula.size(); ++i)
      if (isLeaf(i)) netSet.insert(getNetId(i).id);
}