private void HandleWeaponStatBonuses() { DamageData data = _nwnxDamage.GetDamageEventData(); if (data.Total <= 0) { return; } NWPlayer player = data.Damager.Object; NWItem weapon = _.GetLastWeaponUsed(player); if (weapon.CustomItemType == CustomItemType.BlasterPistol || weapon.CustomItemType == CustomItemType.BlasterRifle) { int statBonus = (int)(player.DexterityModifier * 0.5f); data.Base += statBonus; } else if (weapon.CustomItemType == CustomItemType.Lightsaber || weapon.CustomItemType == CustomItemType.Saberstaff || weapon.GetLocalInt("LIGHTSABER") == TRUE) { int statBonus = (int)(player.CharismaModifier * 0.25f); data.Base += statBonus; } _nwnxDamage.SetDamageEventData(data); }
public void OnModuleApplyDamage() { DamageData data = _nwnxDamage.GetDamageEventData(); HandleApplySneakAttackDamage(data); HandleBattlemagePerk(data); }
public void OnModuleApplyDamage() { var data = _nwnxDamage.GetDamageEventData(); NWObject damager = data.Damager; NWItem weapon = NWItem.Wrap(_.GetLastWeaponUsed(damager.Object)); int damageBonus = weapon.DamageBonus; if (damager.IsPlayer) { NWPlayer player = NWPlayer.Wrap(damager.Object); int itemLevel = weapon.RecommendedLevel; SkillType skill = _skill.GetSkillTypeForItem(weapon); int rank = _skill.GetPCSkill(player, skill).Rank; int delta = itemLevel - rank; if (delta >= 1) { damageBonus--; } damageBonus = damageBonus - delta / 5; if (damageBonus <= 0) { damageBonus = 0; } } data.Base += damageBonus; _nwnxDamage.SetDamageEventData(data); }
private void HandleBattlemagePerk() { DamageData data = _nwnxDamage.GetDamageEventData(); NWObject target = (Object.OBJECT_SELF); if (!data.Damager.IsPlayer || !target.IsNPC) { return; } if (_.GetHasFeat((int)CustomFeatType.Battlemage, data.Damager.Object) == FALSE) { return; } NWPlayer player = (data.Damager.Object); NWItem weapon = (_.GetLastWeaponUsed(player.Object)); if (weapon.CustomItemType != CustomItemType.Baton) { return; } if (player.Chest.CustomItemType != CustomItemType.ForceArmor) { return; } int perkRank = _perk.GetPCPerkLevel(player, PerkType.Battlemage); int restoreAmount = 0; bool metRoll = _random.Random(100) + 1 <= 50; switch (perkRank) { case 1 when metRoll: restoreAmount = 1; break; case 2: restoreAmount = 1; break; case 3: restoreAmount = 1; if (metRoll) { restoreAmount++; } break; case 4: restoreAmount = 2; break; case 5: restoreAmount = 2; if (metRoll) { restoreAmount++; } break; case 6: restoreAmount = 3; break; } if (restoreAmount > 0) { RestoreFP(player, restoreAmount); } }