bool Spreader::update(std::list<Unit*>::iterator itr){ //This is just using magic numbers right now - we need to discuss //how to interpret the units stats/do some refactoring. //wait 30 frames, then spread 1 "layer" of icing every 30 frames if(spreadDelay%30 == 0 && spreadDelay >= 30) { //spread 3 layers of icing if(amountSpread < 4) { float radius = amountSpread*20.0f; float thetaJump = PI/4.0/(float)amountSpread; for (double spreadTheta = 0.0; spreadTheta < 2*PI; spreadTheta += thetaJump) { float xIncr = radius * cos(spreadTheta); float yIncr = radius * sin(spreadTheta); if(isInWorld(CIwFVec2(position.x + xIncr, position.y + yIncr), worldRad.x, worldRad.y)) { game->addIcing(new Icing(CIwFVec2(position.x + xIncr, position.y + yIncr), game, owner)); } } amountSpread++; } } spreadDelay++; curFrame = (curFrame + 1) % numFrames; return true; }
void cItem::explode(NXWSOCKET s) { if (s < 0 || s > now) return; //Luxor unsigned int dmg=0,len=0; P_CHAR pc_current=MAKE_CHAR_REF(currchar[s]); VALIDATEPC(pc_current); if(!isInWorld()) return; type=0; //needed for recursive explosion //Luxor - recursive explosions!! :DD NxwItemWrapper si; si.fillItemsNearXYZ( getPosition(), 5, true ); for( si.rewind(); !si.isEmpty(); si++ ) { P_ITEM p_nearbie=si.getItem(); if(ISVALIDPI(p_nearbie) && p_nearbie->type == ITYPE_POTION && p_nearbie->morey == 3) { //It's an explosion potion! p_nearbie->explode(s); } } //End Luxor recursive explosions staticeffect2(this, 0x36, 0xB0, 0x10, 0x80, 0x00); soundeffect3(this, 0x0207); len=morex/250; //4 square max damage at 100 alchemy switch (morez) { case 1:dmg=RandomNum( 5,10) ;break; case 2:dmg=RandomNum(10,20) ;break; case 3:dmg=RandomNum(20,40) ;break; default: ErrOut("Switch fallout. NoX-Wizard.cpp, explodeitem()\n"); //Morrolan dmg=RandomNum(5,10); } if (dmg<5) dmg=RandomNum(5,10); // 5 points minimum damage if (len<2) len=2; // 2 square min damage range NxwCharWrapper sc; sc.fillCharsNearXYZ( getPosition(), len, true ); for( sc.rewind(); !sc.isEmpty(); sc++ ) { P_CHAR pc=sc.getChar(); if( ISVALIDPC(pc) ) { pc->damage( dmg+(2-pc->distFrom(this)), DAMAGE_FIRE ); } } Delete(); }
/*! \author Luxor \brief execute decay on the item \return true if decayed (so deleted), false else */ LOGICAL cItem::doDecay() { if ( !canDecay() ) return false; if ( magic == 4/* || magic == 2*/ ) return false; if ( !isInWorld() ) return false; if ( TIMEOUT( decaytime ) ) { if ( amxevents[EVENT_IONDECAY] !=NULL ) { g_bByPass = false; amxevents[EVENT_IONDECAY]->Call(getSerial32(), DELTYPE_DECAY); if ( g_bByPass == true ) return false; } /* g_bByPass = false; runAmxEvent( EVENT_IONDECAY, getSerial32(), DELTYPE_DECAY ); if ( g_bByPass == true ) return false; */ //Multis if ( !isFieldSpellItem() && !corpse ) { if ( getMultiSerial32() == INVALID ) { P_ITEM pi_multi = findmulti(getPosition()); if ( ISVALIDPI(pi_multi) ) { if ( pi_multi->more4 == 0 ) { setDecayTime(); SetMultiSerial(pi_multi->getSerial32()); return false; } } } else { setDecayTime(); return false; } } //End Multis if( type == ITYPE_CONTAINER || ( !SrvParms->lootdecayswithcorpse && corpse ) ) { NxwItemWrapper si; si.fillItemsInContainer( this, false ); for( si.rewind(); !si.isEmpty(); si++ ) { P_ITEM pj = si.getItem(); if( ISVALIDPI(pj) ) { pj->setContSerial(INVALID); pj->MoveTo( getPosition() ); pj->setDecayTime(); pj->Refresh(); } } } Delete(); return true; } else return false; }