public void OnImpact(NWPlayer oPC, NWObject oTarget) { int perkLevel = _perk.GetPCPerkLevel(oPC, PerkType.ExpulsionManeuver); float length; int ab; int chance; switch (perkLevel) { case 1: length = 12.0f; ab = 1; chance = 10; break; case 2: length = 12.0f; ab = 1; chance = 20; break; case 3: length = 12.0f; ab = 2; chance = 20; break; case 4: length = 12.0f; ab = 2; chance = 30; break; case 5: length = 12.0f; ab = 3; chance = 30; break; default: return; } int luck = _perk.GetPCPerkLevel(oPC, PerkType.Lucky) + oPC.EffectiveLuckBonus; chance += luck; if (_random.Random(100) + 1 <= chance) { _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), oPC.Object, length); oPC.SendMessage(_color.Combat("You perform a defensive maneuver.")); } }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); float length; int ab; int chance; switch (perkLevel) { case 1: length = 12.0f; ab = 1; chance = 10; break; case 2: length = 12.0f; ab = 1; chance = 20; break; case 3: length = 12.0f; ab = 2; chance = 20; break; case 4: length = 12.0f; ab = 2; chance = 30; break; case 5: length = 12.0f; ab = 3; chance = 30; break; default: return; } int luck = _perk.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; chance += luck; if (_random.Random(100) + 1 <= chance) { _.ApplyEffectToObject(NWScript.DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), player.Object, length); player.SendMessage(_color.Combat("You perform a defensive maneuver.")); } }