hedgewars/uStats.pas
changeset 1678 c8deca7b1e3c
parent 1669 b709e061577e
child 1723 430064bafa18
equal deleted inserted replaced
1677:0655bb13af01 1678:c8deca7b1e3c
    43 	FinishedTurnsTotal: LongInt = -1;
    43 	FinishedTurnsTotal: LongInt = -1;
    44 
    44 
    45 implementation
    45 implementation
    46 uses uTeams, uSound, uMisc;
    46 uses uTeams, uSound, uMisc;
    47 var DamageGiven : Longword = 0;
    47 var DamageGiven : Longword = 0;
    48     DamageClan  : Longword = 0;
    48 	DamageClan  : Longword = 0;
    49     DamageTotal : Longword = 0;
    49 	DamageTotal : Longword = 0;
    50     KillsClan   : LongWord = 0;
    50 	KillsClan   : LongWord = 0;
    51     Kills       : LongWord = 0;
    51 	Kills       : LongWord = 0;
    52     KillsTotal  : LongWord = 0;
    52 	KillsTotal  : LongWord = 0;
    53     AmmoUsedCount : Longword = 0;
    53 	AmmoUsedCount : Longword = 0;
    54     AmmoDamagingUsed : boolean = false;
    54 	AmmoDamagingUsed : boolean = false;
    55     SkippedTurns: LongWord = 0;
    55 	SkippedTurns: LongWord = 0;
    56     isTurnSkipped: boolean = false;
    56 	isTurnSkipped: boolean = false;
       
    57 	vpHurtSameClan: PVoicepack = nil;
       
    58 	vpHurtEnemy: PVoicepack = nil;
    57 
    59 
    58 procedure HedgehogDamaged(Gear: PGear);
    60 procedure HedgehogDamaged(Gear: PGear);
    59 begin
    61 begin
       
    62 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then
       
    63 	vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack
       
    64 else
       
    65 	vpHurtEnemy:= CurrentHedgehog^.Team^.voicepack;
       
    66 
    60 if bBetweenTurns then exit;
    67 if bBetweenTurns then exit;
       
    68 
       
    69 //////////////////////////
    61 
    70 
    62 if Gear <> CurrentHedgehog^.Gear then
    71 if Gear <> CurrentHedgehog^.Gear then
    63 	inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage);
    72 	inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage);
    64 
    73 
    65 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage);
    74 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage);
    95 
   104 
    96 	if (DamageGiven = DamageTotal) and (DamageTotal > 0) then
   105 	if (DamageGiven = DamageTotal) and (DamageTotal > 0) then
    97 		PlaySound(sndFirstBlood, false, CurrentTeam^.voicepack)
   106 		PlaySound(sndFirstBlood, false, CurrentTeam^.voicepack)
    98 
   107 
    99 	else if CurrentHedgehog^.stats.StepDamageRecv > 0 then
   108 	else if CurrentHedgehog^.stats.StepDamageRecv > 0 then
   100 		PlaySound(sndStupid, false, CurrentTeam^.voicepack)
   109 		PlaySound(sndStupid, false, PreviousTeam^.voicepack)
   101 
   110 
   102 	else if DamageClan <> 0 then
   111 	else if DamageClan <> 0 then
   103 		if DamageTotal > DamageClan then
   112 		if DamageTotal > DamageClan then
   104 			if random(2) = 0 then
   113 			if random(2) = 0 then
   105 				PlaySound(sndNutter, false, CurrentTeam^.voicepack)
   114 				PlaySound(sndNutter, false, CurrentTeam^.voicepack)
   106 			else
   115 			else
   107 				PlaySound(sndWatchIt, false, CurrentTeam^.voicepack)
   116 				PlaySound(sndWatchIt, false, vpHurtSameClan)
   108 		else
   117 		else
   109 			if random(2) = 0 then
   118 			if random(2) = 0 then
   110 				PlaySound(sndSameTeam, false, CurrentTeam^.voicepack)
   119 				PlaySound(sndSameTeam, false, vpHurtSameClan)
   111 			else
   120 			else
   112 				PlaySound(sndTraitor, false, CurrentTeam^.voicepack)
   121 				PlaySound(sndTraitor, false, vpHurtSameClan)
   113 
   122 
   114 	else if DamageGiven <> 0 then
   123 	else if DamageGiven <> 0 then
   115 		if Kills > 0 then
   124 		if Kills > 0 then
   116 			PlaySound(sndEnemyDown, false, CurrentTeam^.voicepack)
   125 			PlaySound(sndEnemyDown, false, CurrentTeam^.voicepack)
   117 		else
   126 		else
   118 			PlaySound(sndRegret, false, CurrentTeam^.voicepack)
   127 			PlaySound(sndRegret, false, vpHurtEnemy)
   119 
   128 
   120 	else if AmmoDamagingUsed then
   129 	else if AmmoDamagingUsed then
   121 		PlaySound(sndMissed, false, CurrentTeam^.voicepack)
   130 		PlaySound(sndMissed, false, PreviousTeam^.voicepack)
   122 	else if (AmmoUsedCount > 0) and not isTurnSkipped then
   131 	else if (AmmoUsedCount > 0) and not isTurnSkipped then
   123 		// nothing ?
   132 		// nothing ?
   124 	else if isTurnSkipped then
   133 	else if isTurnSkipped then
   125 		PlaySound(sndBoring, false, CurrentTeam^.voicepack)
   134 		PlaySound(sndBoring, false, PreviousTeam^.voicepack)
   126 	else
   135 	else
   127 		PlaySound(sndCoward, false, CurrentTeam^.voicepack);
   136 		PlaySound(sndCoward, false, PreviousTeam^.voicepack);
   128 	end;
   137 	end;
   129 
   138 
   130 
   139 
   131 for t:= 0 to Pred(TeamsCount) do // send even on zero turn
   140 for t:= 0 to Pred(TeamsCount) do // send even on zero turn
   132 	with TeamsArray[t]^ do
   141 	with TeamsArray[t]^ do