sahisahi
Member
Im trying to set parry chance based on craft resource:
Is that the right way?
Also how to set the blocked damage to a 70%? because right now is 50% and that is way too much
i tried to add
But doesnt seem to work, i would like to block around 30% of the dmg or so
Thanks!!
Code:
public override int OnHit(BaseWeapon weapon, int damage)
{
Mobile owner = Parent as Mobile;
if (owner == null)
return damage;
double chance = (owner.Skills[SkillName.Parry].Value) / (15 / ((owner.Skills[SkillName.Parry].Value) / 100));
chance /= 100;
// if (chance < 0.1)
// chance = 0.1;
// if (this is BaseShield)
// {
if ( Resource == CraftResource.OldCopper )
{
chance = 0.05;
}
if ( Resource == CraftResource.ShadowIron )
{
chance = 0.06;
}
if ( Resource == CraftResource.Silver )
{
chance = 0.07;
}
if ( Resource == CraftResource.Verite )
{
chance = 0.08;
}
if ( Resource == CraftResource.Rose )
{
chance = 0.09;
}
if ( Resource == CraftResource.Gold )
{
chance = 0.10;
}
{
chance = 0.17;
}
if ( Resource == CraftResource.BloodRock )
{
chance = 0.20;
}
if ( Resource == CraftResource.BlackRock )
{
chance = 0.20;
}
//gains
owner.CheckSkill(SkillName.Parry, chance);
//double percent = 1;
if (Utility.RandomDouble() <= chance)
{
//double percent = 1;
damage /= 2;
//percent -= 0.4;
owner.SendAsciiMessage(0x18,"Bloqueas el ataque con el escudo!");
owner.FixedEffect(0x37B9, 10, 5);
}
if (Durability != ArmorDurabilityLevel.Indestructible && 3 > Utility.Random(100)) // 3%(1.5 due to code below) chance to lower durability if not invul
{
int wear = Utility.Random(2);
if (wear > 0)
{
if (HitPoints > wear)
{
HitPoints -= wear;
if (Parent is Mobile && HitPoints * 3 < MaxHitPoints) //Display message at 1/6th of the hp
((Mobile)Parent).LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "Tu escudo necesita ser reparado."); // Your equipment is severely damaged.
}
else
{
if (Parent is Mobile)
((Mobile)Parent).PublicOverheadMessage(MessageType.Emote, 0x22, true, string.Format("*{0} {1} se rompe", ((Mobile)Parent).Name, string.IsNullOrEmpty(Name) ? CliLoc.LocToString(LabelNumber) : Name));
Delete();
}
}
}
return damage;
}
Is that the right way?
Also how to set the blocked damage to a 70%? because right now is 50% and that is way too much
i tried to add
Code:
if (Utility.RandomDouble() <= chance)
{
double percent = 1;
percent -= 0.3;
owner.SendAsciiMessage(0x18,"You parry the blow!!");
owner.FixedEffect(0x37B9, 10, 5);
}
But doesnt seem to work, i would like to block around 30% of the dmg or so
Thanks!!
Last edited: