- targetanimation=staffhitreversedanim;
- currentanimation=staffhitreversedanim;
- victim->currentanimation=staffhitreversalanim;
- victim->targetanimation=staffhitreversalanim;
- }
- if(targetanimation==staffspinhitanim&&findDistancefast(&victim->coords,&coords)<2&&((victim->id==0&&victim->crouchkeydown)||Random()%2==0)){
- if(victim->weaponactive!=-1){
- victim->throwtogglekeydown=1;
- weapons.owner[victim->weaponids[0]]=-1;
- weapons.velocity[victim->weaponids[0]]=victim->velocity*.2;
- if(weapons.velocity[victim->weaponids[0]].x==0)weapons.velocity[victim->weaponids[0]].x=.1;
- weapons.tipvelocity[victim->weaponids[0]]=weapons.velocity[victim->weaponids[0]];
- weapons.missed[victim->weaponids[0]]=1;
- weapons.freetime[victim->weaponids[0]]=0;
- weapons.firstfree[victim->weaponids[0]]=1;
- weapons.physics[victim->weaponids[0]]=1;
- victim->num_weapons--;
- if(victim->num_weapons){
- victim->weaponids[0]=victim->weaponids[victim->num_weapons];
- if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0;
- }
-
- victim->weaponactive=-1;
- for(int j=0;j<numplayers;j++){
- player[j].wentforweapon=0;
- }
- }
- targetanimation=staffspinhitreversedanim;
- currentanimation=staffspinhitreversedanim;
- victim->currentanimation=staffspinhitreversalanim;
- victim->targetanimation=staffspinhitreversalanim;
- }
- if(targetanimation==swordslashanim&&findDistancefast(&victim->coords,&coords)<2&&((victim->id==0&&victim->crouchkeydown)||Random()%4==0)){
- if(victim->weaponactive!=-1){
- victim->throwtogglekeydown=1;
- weapons.owner[victim->weaponids[0]]=-1;
- weapons.velocity[victim->weaponids[0]]=victim->velocity*.2;
- if(weapons.velocity[victim->weaponids[0]].x==0)weapons.velocity[victim->weaponids[0]].x=.1;
- weapons.tipvelocity[victim->weaponids[0]]=weapons.velocity[victim->weaponids[0]];
- weapons.missed[victim->weaponids[0]]=1;
- weapons.freetime[victim->weaponids[0]]=0;
- weapons.firstfree[victim->weaponids[0]]=1;
- weapons.physics[victim->weaponids[0]]=1;
- victim->num_weapons--;
- if(victim->num_weapons){
- victim->weaponids[0]=victim->weaponids[victim->num_weapons];
- if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0;
- }
-
- victim->weaponactive=-1;
- for(int j=0;j<numplayers;j++){
- player[j].wentforweapon=0;
- }
- }
- targetanimation=swordslashreversedanim;
- currentanimation=swordslashreversedanim;
- victim->currentanimation=swordslashreversalanim;
- victim->targetanimation=swordslashreversalanim;
- }
- if(targetanimation==knifeslashstartanim&&findDistancefast(&victim->coords,&coords)<2&&(victim->id==0||Random()%4==0)){
- if(victim->weaponactive!=-1){
- victim->throwtogglekeydown=1;
- weapons.owner[victim->weaponids[0]]=-1;
- weapons.velocity[victim->weaponids[0]]=victim->velocity*.2;
- if(weapons.velocity[victim->weaponids[0]].x==0)weapons.velocity[victim->weaponids[0]].x=.1;
- weapons.tipvelocity[victim->weaponids[0]]=weapons.velocity[victim->weaponids[0]];
- weapons.missed[victim->weaponids[0]]=1;
- weapons.freetime[victim->weaponids[0]]=0;
- weapons.firstfree[victim->weaponids[0]]=1;
- weapons.physics[victim->weaponids[0]]=1;
- victim->num_weapons--;
- if(victim->num_weapons){
- victim->weaponids[0]=victim->weaponids[victim->num_weapons];
- if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0;
- }
-
- victim->weaponactive=-1;
- for(int j=0;j<numplayers;j++){
- player[j].wentforweapon=0;
- }
- }
- targetanimation=knifeslashreversedanim;
- currentanimation=knifeslashreversedanim;
- victim->currentanimation=knifeslashreversalanim;
- victim->targetanimation=knifeslashreversalanim;
- }
- if(targetanimation!=knifeslashstartanim&&targetanimation!=staffhitanim&&targetanimation!=staffspinhitanim&&targetanimation!=winduppunchanim&&targetanimation!=wolfslapanim&&targetanimation!=swordslashanim&&targetanimation!=swordslashanim){
- victim->targettilt2=targettilt2;
- victim->currentframe=currentframe;
- victim->targetframe=targetframe;
- victim->target=target;
- victim->velocity=0;
- victim->oldcoords=victim->coords;
- victim->coords=coords;
- victim->targetrotation=targetrotation;
- victim->rotation=targetrotation;
- victim->victim=this;
- }
- if(targetanimation==winduppunchanim){
- targetanimation=winduppunchblockedanim;
- victim->targetanimation=blockhighleftanim;
- victim->targetframe=1;
- victim->target=.5;
- victim->victim=this;
- victim->targetrotation=targetrotation+180;
- }
- if(targetanimation==wolfslapanim){
- targetanimation=winduppunchblockedanim;
- victim->targetanimation=blockhighleftanim;
- victim->targetframe=1;
- victim->target=.5;
- victim->victim=this;
- victim->targetrotation=targetrotation+180;
- }
- if((targetanimation==swordslashanim||targetanimation==staffhitanim||targetanimation==staffspinhitanim)&&victim->weaponactive!=-1){
- targetanimation=swordslashparriedanim;
- parriedrecently=.4;
- victim->parriedrecently=0;
- victim->targetanimation=swordslashparryanim;
- victim->targetframe=1;
- victim->target=.5;
- victim->victim=this;
- victim->targetrotation=targetrotation+180;
-
- if(abs(Random()%20)==0||weapons.type[victim->weaponids[victim->weaponactive]]==knife){
- if(victim->weaponactive!=-1){
- if(weapons.type[victim->weaponids[0]]==staff||weapons.type[weaponids[0]]==staff){
- if(weapons.type[victim->weaponids[0]]==staff)weapons.damage[victim->weaponids[0]]+=.2+float(abs(Random()%100)-50)/250;
- if(weapons.type[weaponids[0]]==staff)weapons.damage[weaponids[0]]+=.2+float(abs(Random()%100)-50)/250;
- emit_sound_at(swordstaffsound, victim->coords);
- }
- else{
- emit_sound_at(metalhitsound, victim->coords);
- }
- }
- XYZ aim;
- victim->Puff(righthand);
- victim->target=0;
- victim->targetframe=0;
- victim->targetanimation=staggerbackhighanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- weapons.owner[victim->weaponids[0]]=-1;
- aim=DoRotation(facing,0,90,0)*21;
- aim.y+=7;
- weapons.velocity[victim->weaponids[0]]=aim*-.2;
- weapons.tipvelocity[victim->weaponids[0]]=aim;
- weapons.missed[victim->weaponids[0]]=1;
- weapons.hitsomething[victim->weaponids[0]]=0;
- weapons.freetime[victim->weaponids[0]]=0;
- weapons.firstfree[victim->weaponids[0]]=1;
- weapons.physics[victim->weaponids[0]]=1;
- victim->num_weapons--;
- if(victim->num_weapons){
- victim->weaponids[0]=victim->weaponids[num_weapons];
- if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0;
- }
- victim->weaponactive=-1;
- for(int i=0;i<numplayers;i++){
- player[i].wentforweapon=0;
- }