I'm running into trouble in the following areas.. Luck and Highest Damage
Luck:
Right now I noticed its using the killer's highest luck and distributing it to all players.
How do I find the player's luck during the battle?
Damage:
Lost here... How Do I find out if the person has the highest damage or not.
I know how to make the if statement, but I'm not sure how to get the highest damage player.
Here's a snippet of the code I have right now.
Luck:
Right now I noticed its using the killer's highest luck and distributing it to all players.
How do I find the player's luck during the battle?
Damage:
Lost here... How Do I find out if the person has the highest damage or not.
I know how to make the if statement, but I'm not sure how to get the highest damage player.
Here's a snippet of the code I have right now.
Code:
//ADDED FOR XML POINT/LUCK SYSTEM
public static void DistributePoints( BaseCreature creature)
{
double luck = LootPack.GetLuckChanceForKiller(creature);
double pointbonus;
List<DamageStore> rights = BaseCreature.GetLootingRights( creature.DamageEntries, creature.HitsMax );
DamageStore highest = null;
for ( int i = rights.Count - 1; i >= 0; --i )
{
DamageStore ds = rights[i];
if ( !ds.m_HasRight )
rights.RemoveAt( i );
else
{
XmlDoomPoints a = (XmlDoomPoints)XmlAttach.FindAttachment( rights[i].m_Mobile, typeof( XmlDoomPoints ));
if( a == null )
{
XmlAttach.AttachTo( rights[i].m_Mobile, new XmlDoomPoints());
}
else
{
if( creature.GetType() == typeof( DemonKnight ) )
{
pointbonus = ((luck / 3.424) / 1000) ;
pointbonus = Math.Round(pointbonus, 2);
Console.WriteLine("Calculated pointsbonus total is {0}", pointbonus);
a.Points += pointbonus;
a.Points += DoomPoints.DarkFatherPoints;
//IF Damage = Highest
//a.Points += DoomPoints.MostDamageDarkFatherPoints;
Console.WriteLine("Calculated a.Points total after Dark Father Calculation is {0}", a.Points);
//IF Damage = Highest
//a.TotalPoints += DoomPoints.MostDamageDarkFatherPoints;
a.TotalPoints += pointbonus;
a.TotalPoints += DoomPoints.DarkFatherPoints;
Console.WriteLine("Total {0}", a.TotalPoints);
}
else if (creature.GetType() == typeof(AbysmalHorror) || creature.GetType() == typeof(ShadowKnight) || creature.GetType() == typeof(DarknightCreeper) || creature.GetType() == typeof(Impaler) || creature.GetType() == typeof(FleshRenderer) )
{
pointbonus = ((luck / 3.424) / 10000);
pointbonus = Math.Round(pointbonus, 2);
Console.WriteLine("Calculated pointsbonus total is {0}", pointbonus);
a.Points += pointbonus;
a.Points += DoomPoints.GauntletBossPoints;
//IF Damage = Highest
//a.Points += DoomPoints.MostDamageBossPoints;
Console.WriteLine("Calculated a.Points total after Minions Calculation is {0}", a.Points);
//IF Damage = Highest
//a.TotalPoints += DoomPoints.MostDamageBossPoints;
a.TotalPoints += pointbonus;
a.TotalPoints += DoomPoints.GauntletBossPoints;
Console.WriteLine("Total {0}", a.TotalPoints);
}
if( a.Points >= DoomPoints.PointsPerArtifacts ) // if they have reached the points value, give them an artifact.
//if ( Utility.Random(100) < a.Points
{
// Mobile.SendMessage(
// "You have been awarded an artifact as a token of your valor. Your points have been reset.");
Console.WriteLine("You have been awarded an artifacts from the new system");
DistributeArtifact( rights[i].m_Mobile, CreateRandomArtifact() );
a.TotalArtifacts++;
a.Points -= DoomPoints.PointsPerArtifacts;
}
}
}
}
}