hedgewars/HHHandlers.inc
changeset 1849 2a989e5abda6
parent 1749 7170f626e9d6
child 1854 6e05013899b2
equal deleted inserted replaced
1848:1eb88d41ccc6 1849:2a989e5abda6
   177                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   177                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
   178                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
   178                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
   179                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
   179                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
   180                         amDrill: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
   180                         amDrill: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
   181                         amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
   181                         amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
       
   182                       amLowGravity: cGravity:= cMaxWindSpeed / 2;
       
   183                       amExtraDamage: cDamageModifier:= _1_5;
       
   184                       //this flag unfortunately gets cleared too often for true invulnerability, although it seemed like the natural choice
       
   185                       //amInvulnerable: State:= State or gstNoDamage;
       
   186                       amInvulnerable: Invulnerable:= true;
       
   187                       amExtraTime: TurnTimeLeft:= TurnTimeLeft + 30000;
   182                   end;
   188                   end;
   183 
   189 
   184         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
   190         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
   185 
   191 
   186         Power:= 0;
   192         Power:= 0;
   191            Message:= Message or gm_Attack;
   197            Message:= Message or gm_Attack;
   192            CurAmmoGear^.Message:= Message
   198            CurAmmoGear^.Message:= Message
   193            end else begin
   199            end else begin
   194            if not CurrentTeam^.ExtDriven and
   200            if not CurrentTeam^.ExtDriven and
   195              ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a');
   201              ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a');
   196            AfterAttack
   202            AfterAttack;
   197            end
   203            end
   198         end else Message:= Message and not gm_Attack
   204         end else Message:= Message and not gm_Attack;
   199      end
   205      end
   200 end;
   206 end;
   201 
   207 
   202 procedure AfterAttack;
   208 procedure AfterAttack;
   203 begin
   209 begin
   204 with CurrentHedgehog^.Gear^,
   210 with CurrentHedgehog^.Gear^,
   205 		CurrentHedgehog^ do
   211 		CurrentHedgehog^ do
   206 	begin
   212 	begin
   207 		Inc(AttacksNum);
   213 	State:= State and not gstAttacking;
   208 		State:= State and not gstAttacking;
   214     if ((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_Utility) = 0 then
   209 		if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or
   215         begin
   210 		((GameFlags and gfMultiWeapon) <> 0) then isInMultiShoot:= true
   216         Inc(AttacksNum);
   211 		else begin
   217         if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or
   212 		TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn;
   218         ((GameFlags and gfMultiWeapon) <> 0) then 
   213 		State:= State or gstAttacked;
   219             isInMultiShoot:= true
   214 		OnUsedAmmo(CurrentHedgehog^)
   220         else 
   215 		end;
   221             begin
       
   222             TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn;
       
   223             State:= State or gstAttacked;
       
   224             OnUsedAmmo(CurrentHedgehog^);
       
   225             end;
       
   226         end
       
   227     else
       
   228        begin
       
   229        OnUsedAmmo(CurrentHedgehog^);
       
   230        ApplyAmmoChanges(CurrentHedgehog^);
       
   231        end;
   216 	AttackBar:= 0;
   232 	AttackBar:= 0;
   217 	end
   233 	end
   218 end;
   234 end;
   219 
   235 
   220 ////////////////////////////////////////////////////////////////////////////////
   236 ////////////////////////////////////////////////////////////////////////////////