hay pro4never please take a look at my AccuracyCheck code and tell me if you no any ways to improve it.
its not 100% done i just kinda got the base of the code still need to add the if player have a Accuracy skill stuff
and what is the def between Accuracy(Xp Skill) and Accuracy(water tao skill)?
Code:
public static bool AccuracyCheck(IBaseEntity AttackerEntity, IBaseEntity OpponentEntity)
{
double ChanceToHit = 90;
ChanceToHit -= OpponentEntity.Dodge / 2;
if (AttackerEntity.EntityFlag == EntityFlag.Player)
{
GameClient Attacker = null;
Attacker = AttackerEntity.Owner as GameClient;
if ((Attacker.Entity.StatusFlag & StatusFlag.Superman) != StatusFlag.Superman)
{
ChanceToHit = 99;
}
else if ((Attacker.Entity.StatusFlag & StatusFlag.Cyclone) != StatusFlag.Cyclone)
{
ChanceToHit = 99;
}
ChanceToHit += Attacker.Stats.Agility / 10;
}
else if (AttackerEntity.EntityFlag == EntityFlag.Monster || AttackerEntity.EntityFlag == EntityFlag.Pet)
{
Monster Attacker = null;
Attacker = AttackerEntity.Owner as Monster;
}
if (OpponentEntity.EntityFlag == EntityFlag.Player)
{
GameClient Opponent = null;
Opponent = OpponentEntity.Owner as GameClient;
ChanceToHit -= Opponent.Stats.Agility / 10;
}
if (Kernel.ChanceSuccess(ChanceToHit))
return true;
else
return false;
}
and the content of my ChanceSuccess is
Code:
return ((double)Random.Next(1, 1000000)) / 10000 >= 100 - Chance;
Thank you