//============STATISTICS_SCRIPT============//
//==============BY_ARMADYL5============//
//================ENJOY===============//



//============PREPERATIONS============//

List <IPlayer> Blocks = new List<IPlayer>();
List <IPlayer> Blocks1 = new List<IPlayer>();
List <IPlayer> Blocks2 = new List<IPlayer>();
List <IPlayer> Damages = new List<IPlayer>();
List <IPlayer> Damages1 = new List<IPlayer>();
List <IPlayer> Damages2 = new List<IPlayer>();
List <IPlayer> FDamages = new List<IPlayer>();
List <IPlayer> FDamages1 = new List<IPlayer>();
List <IPlayer> FDamages2 = new List<IPlayer>();
List <IPlayer> FDamages3 = new List<IPlayer>();
List <IPlayer> FireI = new List<IPlayer>();
List <IPlayer> MDamages = new List<IPlayer>();
List <IPlayer> MDamages1 = new List<IPlayer>();
List <IPlayer> MDamages2 = new List<IPlayer>();
List <IPlayer> EXPDamages = new List<IPlayer>();
List <IPlayer> EXPDamages1 = new List<IPlayer>();
List <IPlayer> EXPDamages2 = new List<IPlayer>();

int TotalBlockedAttacks = 0;

public void OnStartup(){
IObjectTimerTrigger Timer0 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer0.SetIntervalTime(100);
Timer0.SetRepeatCount(0);
Timer0.SetScriptMethod("FireImmunity");
Timer0.Trigger();
IObjectTimerTrigger Timer1 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer1.SetIntervalTime(100);
Timer1.SetRepeatCount(0);
Timer1.SetScriptMethod("Block");
Timer1.Trigger();
IObjectTimerTrigger Timer1A = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer1A.SetIntervalTime(100);
Timer1A.SetRepeatCount(0);
Timer1A.SetScriptMethod("Block1");
Timer1A.Trigger();
IObjectTimerTrigger Timer1B = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer1B.SetIntervalTime(100);
Timer1B.SetRepeatCount(0);
Timer1B.SetScriptMethod("Block2");
Timer1B.Trigger();
IObjectTimerTrigger Timer2 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer2.SetIntervalTime(100);
Timer2.SetRepeatCount(0);
Timer2.SetScriptMethod("Damage");
Timer2.Trigger();
IObjectTimerTrigger Timer2A = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer2A.SetIntervalTime(100);
Timer2A.SetRepeatCount(0);
Timer2A.SetScriptMethod("Damage1");
Timer2A.Trigger();
IObjectTimerTrigger Timer2B = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer2B.SetIntervalTime(100);
Timer2B.SetRepeatCount(0);
Timer2B.SetScriptMethod("Damage2");
Timer2B.Trigger();
IObjectTimerTrigger Timer3 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer3.SetIntervalTime(100);
Timer3.SetRepeatCount(0);
Timer3.SetScriptMethod("EXPDamage");
Timer3.Trigger();
IObjectTimerTrigger Timer3A = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer3A.SetIntervalTime(100);
Timer3A.SetRepeatCount(0);
Timer3A.SetScriptMethod("EXPDamage1");
Timer3A.Trigger();
IObjectTimerTrigger Timer3B = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer3B.SetIntervalTime(100);
Timer3B.SetRepeatCount(0);
Timer3B.SetScriptMethod("EXPDamage2");
Timer3B.Trigger();
IObjectTimerTrigger Timer4 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer4.SetIntervalTime(100);
Timer4.SetRepeatCount(0);
Timer4.SetScriptMethod("MDamage");
Timer4.Trigger();
IObjectTimerTrigger Timer4A = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer4A.SetIntervalTime(100);
Timer4A.SetRepeatCount(0);
Timer4A.SetScriptMethod("MDamage1");
Timer4A.Trigger();
IObjectTimerTrigger Timer4B = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer4B.SetIntervalTime(100);
Timer4B.SetRepeatCount(0);
Timer4B.SetScriptMethod("MDamage2");
Timer4B.Trigger();
IObjectTimerTrigger Timer5 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer5.SetIntervalTime(100);
Timer5.SetRepeatCount(0);
Timer5.SetScriptMethod("FDamage");
Timer5.Trigger();
IObjectTimerTrigger Timer6 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer6.SetIntervalTime(100);
Timer6.SetRepeatCount(0);
Timer6.SetScriptMethod("FDamage1");
Timer6.Trigger();
IObjectTimerTrigger Timer7 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer7.SetIntervalTime(100);
Timer7.SetRepeatCount(0);
Timer7.SetScriptMethod("FDamage2");
Timer7.Trigger();
IObjectTimerTrigger Timer8 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer8.SetIntervalTime(100);
Timer8.SetRepeatCount(0);
Timer8.SetScriptMethod("FDamage3");
Timer8.Trigger();
foreach(IPlayer ply in Game.GetPlayers()){
if(ply.IsUser){
Blocks.Add(ply);
Blocks1.Add(ply);
Blocks2.Add(ply);
Damages.Add(ply);
Damages1.Add(ply);
Damages2.Add(ply);
EXPDamages.Add(ply);
EXPDamages1.Add(ply);
EXPDamages2.Add(ply);
MDamages.Add(ply);
MDamages1.Add(ply);
MDamages2.Add(ply);
FDamages.Add(ply);
FDamages1.Add(ply);
FDamages2.Add(ply);
FDamages3.Add(ply);
}
}
}


//============STATISTICS============//


public void Block(TriggerArgs args){
for (int i = Blocks.Count-1;i>=0;i--){
IPlayer ply = Blocks[i];
TotalBlockedAttacks = ply.Statistics.TotalBlockedAttacks;
if(TotalBlockedAttacks == 10){
Vector2 Here = ply.GetWorldPosition();
Game.PlayEffect("CFTXT",Here,"Block Pro (10 Blocks)");
ply.GiveWeaponItem(WeaponItem.PILLS);
Blocks.Remove(ply);
}
}
}


public void Block1(TriggerArgs args){
for (int i = Blocks1.Count-1;i>=0;i--){
IPlayer ply = Blocks1[i];
TotalBlockedAttacks = ply.Statistics.TotalBlockedAttacks;
if(TotalBlockedAttacks == 20){
Vector2 Here = ply.GetWorldPosition();
Game.PlayEffect("CFTXT",Here,"Block Master (20 Blocks)");
Blocks1.Remove(ply);
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.MACHETE);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.UZI);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.REVOLVER);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.AXE);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.CARBINE);
}
}
}



public void Block2(TriggerArgs args){
for (int i = Blocks2.Count-1;i>=0;i--){
IPlayer ply = Blocks2[i];
TotalBlockedAttacks = ply.Statistics.TotalBlockedAttacks;
if(TotalBlockedAttacks == 30){
Vector2 Here = ply.GetWorldPosition();
Game.PlayEffect("CFTXT",Here,"Block Legend (30 Blocks)");
ply.GiveWeaponItem(WeaponItem.KATANA);
ply.GiveWeaponItem(WeaponItem.MEDKIT);
Blocks2.Remove(ply);
}
}
}



public void Damage(TriggerArgs args){
for (int i = Damages.Count-1;i>=0;i--){
IPlayer ply = Damages[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalDamageTaken >= 200 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Survivor Pro (200 Damage Taken)");
Damages.Remove(ply);
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.PILLS);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.PILLS);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.PISTOL);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.CARBINE);
}
}
}


public void Damage1(TriggerArgs args){
for (int i = Damages1.Count-1;i>=0;i--){
IPlayer ply = Damages1[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalDamageTaken >= 300 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Survivor Master (300 Damage Taken)");
Damages1.Remove(ply);
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.PILLS);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.REVOLVER);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.SMG);
}
}
}



public void Damage2(TriggerArgs args){
for (int i = Damages2.Count-1;i>=0;i--){
IPlayer ply = Damages2[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalDamageTaken >= 400 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Survivor Legend (400 Damage Taken)");
Damages2.Remove(ply);
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.MAGNUM);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.ASSAULT);
}
}
}





public void MDamage(TriggerArgs args){
for (int i = MDamages.Count-1;i>=0;i--){
IPlayer ply = MDamages[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalMeleeDamageTaken >= 80 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Punching Bag (80 Melee Damage)");
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.PIPE);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.BATON);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.HAMMER);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.PILLS);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.BAT);
MDamages.Remove(ply);
}
}
}


public void MDamage1(TriggerArgs args){
for (int i = MDamages1.Count-1;i>=0;i--){
IPlayer ply = MDamages1[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalMeleeDamageTaken >= 110 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Rock Skin (110 Melee Damage)");
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.MACHETE);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.PILLS);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.PILLS);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.PISTOL);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.HAMMER);
MDamages1.Remove(ply);
}
}
}


public void MDamage2(TriggerArgs args){
for (int i = MDamages2.Count-1;i>=0;i--){
IPlayer ply = MDamages2[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalMeleeDamageTaken >= 140 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Steel Skin (140 Melee Damage)");
Random rand = new Random();
int randomNumber = rand.Next(5);
if(randomNumber == 0) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 1) ply.GiveWeaponItem(WeaponItem.MEDKIT);
if(randomNumber == 2) ply.GiveWeaponItem(WeaponItem.AXE);
if(randomNumber == 3) ply.GiveWeaponItem(WeaponItem.AXE);
if(randomNumber == 4) ply.GiveWeaponItem(WeaponItem.KATANA);
MDamages2.Remove(ply);
}
}
}


public void EXPDamage(TriggerArgs args){
for (int i = EXPDamages.Count-1;i>=0;i--){
IPlayer ply = EXPDamages[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalExplosionDamageTaken >= 80 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"KABOOM (80 Explosion Damage)");
ply.GiveWeaponItem(WeaponItem.GRENADES);
EXPDamages.Remove(ply);
}
}
}


public void EXPDamage1(TriggerArgs args){
for (int i = EXPDamages1.Count-1;i>=0;i--){
IPlayer ply = EXPDamages1[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalExplosionDamageTaken >= 140 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"KABOOM Pro(140 Explosion Damage)");
ply.GiveWeaponItem(WeaponItem.GRENADE_LAUNCHER);
EXPDamages1.Remove(ply);
}
}
}


public void EXPDamage2(TriggerArgs args){
for (int i = EXPDamages2.Count-1;i>=0;i--){
IPlayer ply = EXPDamages2[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalExplosionDamageTaken >= 180 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"KABOOM Psycho(180 Explosion Damage)");
ply.GiveWeaponItem(WeaponItem.BAZOOKA);
EXPDamages2.Remove(ply);
}
}
}




public void FDamage(TriggerArgs args){
for (int i = FDamages.Count-1;i>=0;i--){
IPlayer ply = FDamages[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalFireDamageTaken >= 80 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Burn Baby Burn ! (80 Fire Damage)");
ply.GiveWeaponItem(WeaponItem.MOLOTOVS);
FDamages.Remove(ply);
}
}
}



public void FDamage1(TriggerArgs args){
for (int i = FDamages1.Count-1;i>=0;i--){
IPlayer ply = FDamages1[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalFireDamageTaken >= 120 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Barbeque (120 Fire Damage)");
ply.GiveWeaponItem(WeaponItem.FLAREGUN);
FDamages1.Remove(ply);
}
}
}



public void FDamage2(TriggerArgs args){
for (int i = FDamages2.Count-1;i>=0;i--){
IPlayer ply = FDamages2[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalFireDamageTaken >= 160 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Fire Psycho(160 Fire Damage)");
ply.GiveWeaponItem(WeaponItem.FLAMETHROWER);
FDamages2.Remove(ply);
}
}
}


public void FDamage3(TriggerArgs args){
for (int i = FDamages3.Count-1;i>=0;i--){
IPlayer ply = FDamages3[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.Statistics.TotalFireDamageTaken >= 250 && !ply.IsDead){
Game.PlayEffect("CFTXT",Here,"Fire God (Fire Immunity Achieved)");
FireI.Add(ply);
FDamages3.Remove(ply);
}
}
}



//============ABILITIES============//

public void FireImmunity(TriggerArgs args){
foreach(IPlayer ply in FireI){
ply.ClearFire();
}
}