public void OnImpact(NWPlayer player, NWObject target, int level) { int damage; float duration; switch (level) { case 1: damage = _random.D4(1); duration = 6; break; case 2: damage = _random.D8(1); duration = 6; break; case 3: damage = _random.D8(2); duration = 6; break; case 4: damage = _random.D8(2); duration = 12; break; case 5: damage = _random.D8(3); duration = 12; break; case 6: damage = _random.D8(4); duration = 12; break; case 7: damage = _random.D8(5); duration = 12; break; case 8: damage = _random.D8(5); duration = 18; break; case 9: damage = _random.D8(6); duration = 24; break; default: return; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_PIERCING), target); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectCutsceneImmobilize(), target, duration); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_IMP_ACID_L), target, duration); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { int damage = 0; switch (effectiveLevel) { case 2: case 3: case 4: damage = 1; break; case 5: case 6: case 7: damage = 2; break; case 8: case 9: case 10: case 11: damage = 4; break; } oCaster.AssignCommand(() => { Effect effect = _.EffectDamage(damage, DAMAGE_TYPE_SONIC); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oTarget); }); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { if (currentTick % 2 == 0) { return; } Location location = oTarget.Location; NWPlaceable oBlood = (_.CreateObject(NWScript.OBJECT_TYPE_PLACEABLE, "plc_bloodstain", location)); oBlood.Destroy(48.0f); int amount = 1; if (!string.IsNullOrWhiteSpace(data)) { amount = Convert.ToInt32(data); } oCaster.AssignCommand(() => { Effect damage = _.EffectDamage(amount); _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, damage, oTarget.Object); }); }
public void LoadCharacter(NWPlayer player) { PlayerCharacter entity = GetPlayerEntity(player.GlobalID); if (entity == null) { return; } int hp = player.CurrentHP; int damage; if (entity.HitPoints < 0) { damage = hp + Math.Abs(entity.HitPoints); } else { damage = hp - entity.HitPoints; } if (damage != 0) { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage), player.Object); } player.IsBusy = false; // Just in case player logged out in the middle of an action. }
public void OnImpact(NWPlayer oPC, NWObject oTarget) { int level = _perk.GetPCPerkLevel(oPC, PerkType.HolyShot); int damage; int alterationBonus = oPC.EffectiveAlterationBonus; switch (level) { case 1: damage = _random.Random(8 + alterationBonus) + 1; break; case 2: damage = _random.Random(6 + alterationBonus) + 1; damage += _random.Random(6 + alterationBonus) + 1; break; case 3: damage = _random.Random(6 + alterationBonus) + 1; damage += _random.Random(6 + alterationBonus) + 1; break; case 4: damage = _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; break; case 5: damage = _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; damage += _random.Random(4 + alterationBonus) + 1; break; default: return; } int wisdom = oPC.WisdomModifier; int intelligence = oPC.IntelligenceModifier; float damageMultiplier = 1.0f + (intelligence * 0.4f) + (wisdom * 0.2f); damage = (int)(damage * damageMultiplier); Effect vfx = _.EffectBeam(VFX_BEAM_SILENT_HOLY, oPC.Object, BODY_NODE_CHEST); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, vfx, oTarget.Object, 1.5f); _skill.RegisterPCToNPCForSkill(oPC, NWCreature.Wrap(oTarget.Object), SkillType.AlterationMagic); oPC.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage), oTarget.Object); }); }
public void OnImpact(NWPlayer oPC, NWObject oTarget) { int level = _perk.GetPCPerkLevel(oPC, PerkType.FireBlast); int damage; int ticks = 0; switch (level) { case 1: damage = _random.Random(6) + 1; break; case 2: damage = _random.Random(6) + 1; ticks = 3; break; case 3: damage = _random.Random(6) + 1; damage += _random.Random(6) + 1; ticks = 4; break; case 4: damage = _random.Random(4) + 1; damage += _random.Random(4) + 1; damage += _random.Random(4) + 1; damage += _random.Random(4) + 1; ticks = 4; break; case 5: damage = _random.Random(8) + 1; damage += _random.Random(8) + 1; damage += _random.Random(8) + 1; ticks = 5; break; default: return; } int wisdom = oPC.WisdomModifier; int intelligence = oPC.IntelligenceModifier; float damageMultiplier = 1.0f + (intelligence * 0.2f) + (wisdom * 0.1f); damage = (int)(damage * damageMultiplier); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_HIT_FIRE), oTarget.Object); if (ticks > 0) { _customEffect.ApplyCustomEffect(oPC, (NWCreature)oTarget, CustomEffectType.Burning, ticks, level); } _skill.RegisterPCToNPCForSkill(oPC, (NWCreature)oTarget, SkillType.EvocationMagic); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_FIRE), oTarget.Object); }
public void OnImpact(NWPlayer oPC, NWObject oTarget) { int level = _perk.GetPCPerkLevel(oPC, PerkType.GraspingIce); int damage; float slowLength = 0.0f; switch (level) { case 1: damage = _random.Random(6) + 1; break; case 2: damage = _random.Random(6) + 1; slowLength = 3.0f; break; case 3: damage = _random.Random(6) + 1; damage += _random.Random(6) + 1; slowLength = 3.0f; break; case 4: damage = _random.Random(4) + 1; damage += _random.Random(4) + 1; damage += _random.Random(4) + 1; damage += _random.Random(4) + 1; slowLength = 3.0f; break; case 5: damage = _random.Random(8) + 1; damage += _random.Random(8) + 1; damage += _random.Random(8) + 1; slowLength = 3.0f; break; default: return; } int wisdom = oPC.WisdomModifier; int intelligence = oPC.IntelligenceModifier; float damageMultiplier = 1.0f + (intelligence * 0.2f) + (wisdom * 0.1f); damage = (int)(damage * damageMultiplier); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_FNF_HOWL_MIND), oTarget.Object); if (slowLength > 0.0f) { _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectSlow(), oTarget.Object, slowLength + 0.1f); } _skill.RegisterPCToNPCForSkill(oPC, (NWCreature)oTarget, SkillType.EvocationMagic); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage), oTarget.Object); }
public void OnImpact(NWPlayer player, NWObject target, int level) { var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); int luck = _perk.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; int lightBonus = effectiveStats.LightAbility; int min = 1; float length; int damage; int wisdom = player.WisdomModifier; int intelligence = player.IntelligenceModifier; min += lightBonus / 4 + wisdom / 3 + intelligence / 4; switch (level) { case 1: damage = _random.D4(1, min); length = 3; break; case 2: damage = _random.D4(1, min); length = 6; break; case 3: damage = _random.D6(1, min); length = 6; break; case 4: damage = _random.D8(1, min); length = 6; break; case 5: damage = _random.D8(1, min); length = 9; break; case 6: // Only available with background perk damage = _random.D12(1, min); length = 9; break; default: return; } if (_random.Random(100) + 1 <= luck) { length = length * 2; player.SendMessage("Lucky force push!"); } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_POSITIVE), target); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target, length); _skill.RegisterPCToNPCForSkill(player, target, SkillType.LightSideAbilities); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { if (currentTick % 2 != 0) return; int damage = _random.D4(1); oCaster.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_FIRE), oTarget); }); }
public void OnImpact(NWPlayer oPC, NWObject oTarget) { int level = _perk.GetPCPerkLevel(oPC, PerkType.LightningShock); int damage; int evocationBonus = oPC.EffectiveEvocationBonus; switch (level) { case 1: damage = _random.Random(8 + evocationBonus) + 1; break; case 2: damage = _random.Random(6 + evocationBonus) + 1; damage += _random.Random(6 + evocationBonus) + 1; break; case 3: damage = _random.Random(6 + evocationBonus) + 1; damage += _random.Random(6 + evocationBonus) + 1; break; case 4: damage = _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; break; case 5: damage = _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; break; default: return; } int wisdom = oPC.WisdomModifier; int intelligence = oPC.IntelligenceModifier; float damageMultiplier = 1.0f + (intelligence * 0.2f) + (wisdom * 0.1f); damage = (int)(damage * damageMultiplier); _skill.RegisterPCToNPCForSkill(oPC, (NWCreature)oTarget, SkillType.EvocationMagic); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_DOOM), oTarget.Object); oPC.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage), oTarget.Object); }); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { int damage = Convert.ToInt32(data); oCaster.AssignCommand(() => { Effect effect = _.EffectDamage(damage, DAMAGE_TYPE_ELECTRICAL); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oTarget); }); }
public void Tick(NWCreature oCaster, NWObject oTarget) { Location location = oTarget.Location; NWPlaceable oBlood = NWPlaceable.Wrap(_.CreateObject(OBJECT_TYPE_PLACEABLE, "plc_bloodstain", location)); oBlood.Destroy(48.0f); oCaster.AssignCommand(() => { Effect damage = _.EffectDamage(1); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, oTarget.Object); }); }
public void Tick(NWCreature oCaster, NWObject oTarget) { Random random = new Random(); int amount = random.Next(1, 2); oCaster.AssignCommand(() => { Effect damage = _.EffectDamage(amount, DAMAGE_TYPE_FIRE); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, oTarget.Object); }); Effect vfx = _.EffectVisualEffect(VFX_COM_HIT_FIRE); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oTarget.Object); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { Random random = new Random(); int amount = random.Next(1, 2); oCaster.AssignCommand(() => { Effect damage = _.EffectDamage(amount, NWScript.DAMAGE_TYPE_FIRE); _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, damage, oTarget.Object); }); Effect vfx = _.EffectVisualEffect(NWScript.VFX_COM_HIT_FIRE); _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, vfx, oTarget.Object); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int damage; float length; switch (perkLevel) { case 1: damage = _random.D4(1); length = 6.0f; break; case 2: damage = _random.D4(2); length = 6.0f; break; case 3: damage = _random.D6(2); length = 6.0f; break; case 4: damage = _random.D6(2); length = 9.0f; break; case 5: damage = _random.D6(3); length = 9.0f; break; case 6: damage = _random.D8(3); length = 9.0f; break; default: return; } _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target.Object, length); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_BLUDGEONING), target); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { Random random = new Random(); int amount = random.Next(3, 7); oCaster.AssignCommand(() => { Effect damage = _.EffectDamage(amount); _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, damage, oTarget.Object); }); Effect decreaseAC = _.EffectACDecrease(2); oCaster.AssignCommand(() => { _.ApplyEffectToObject(NWScript.DURATION_TYPE_TEMPORARY, decreaseAC, oTarget.Object, 1.0f); }); _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, _.EffectVisualEffect(NWScript.VFX_IMP_ACID_S), oTarget.Object); }
public void Tick(NWCreature oCaster, NWObject oTarget) { Random random = new Random(); int amount = random.Next(3, 7); oCaster.AssignCommand(() => { Effect damage = _.EffectDamage(amount); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, oTarget.Object); }); Effect decreaseAC = _.EffectACDecrease(2); oCaster.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, decreaseAC, oTarget.Object, 6.1f); }); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_ACID_S), oTarget.Object); }
private void DeathFunction(NWPlayer oPC, int nDC) { if (!oPC.IsValid) { return; } int iHP = oPC.CurrentHP; //Player Rolls a random number between 1 and 20+ConMod int iRoll = 20 + oPC.ConstitutionModifier; iRoll = _random.Random(iRoll) + 1; //Sanity Check if (nDC > 30) { nDC = 30; } else if (nDC < 4) { nDC = 4; } if (iHP <= 0) { if (iRoll >= nDC) //Stabilize { nDC -= 2; _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(1), oPC.Object); oPC.DelayCommand(() => { DeathFunction(oPC, nDC); }, 3.0f); } else //Failed! { if (_random.Random(2) + 1 == 1) { nDC++; } Effect eResult = _.EffectDamage(1); //Death! if (iHP <= -9) { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_DEATH), oPC.Object); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDeath(), oPC.Object); return; } else { oPC.SendMessage(_color.Orange("You failed to stabilize this round.")); } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, eResult, oPC.Object); oPC.DelayCommand(() => { DeathFunction(oPC, nDC); }, 3.0f); } } }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int damage = 0; float duration = 0.0f; switch (perkLevel) { case 1: damage = _random.D4(1); duration = 6; break; case 2: damage = _random.D4(2); duration = 6; break; case 3: damage = _random.D4(2); duration = 9; break; case 4: damage = _random.D8(2); duration = 9; break; case 5: damage = _random.D8(2); duration = 12; break; case 6: damage = _random.D6(3); duration = 15; break; case 7: damage = _random.D8(3); duration = 15; break; case 8: damage = _random.D8(3); duration = 18; break; case 9: damage = _random.D8(4); duration = 18; break; case 10: damage = _random.D8(4); duration = 21; break; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_SLASHING), target); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectACDecrease(3), target, duration); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_HEAD_EVIL), target); player.SendMessage("Your target's armor has been breached."); }
public void OnImpact(NWPlayer player, NWObject target, int level) { var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); int lightBonus = effectiveStats.LightAbility; int amount; int length; int dotAmount; int min = 1; int wisdom = player.WisdomModifier; int intelligence = player.IntelligenceModifier; min += lightBonus / 3 + wisdom / 2 + intelligence / 3; switch (level) { case 1: amount = _random.D6(2, min); length = 0; dotAmount = 0; break; case 2: amount = _random.D6(2, min); length = 6; dotAmount = 1; break; case 3: amount = _random.D12(2, min); length = 6; dotAmount = 1; break; case 4: amount = _random.D12(2, min); length = 12; dotAmount = 1; break; case 5: amount = _random.D12(2, min); length = 6; dotAmount = 2; break; case 6: amount = _random.D12(2, min); length = 12; dotAmount = 2; break; case 7: amount = _random.D12(3, min); length = 12; dotAmount = 2; break; case 8: amount = _random.D12(3, min); length = 6; dotAmount = 4; break; case 9: amount = _random.D12(4, min); length = 6; dotAmount = 4; break; case 10: amount = _random.D12(4, min); length = 12; dotAmount = 4; break; case 11: // Only attainable with background bonus amount = _random.D12(5, min); length = 12; dotAmount = 4; break; default: return; } int luck = _perk.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; if (_random.Random(100) + 1 <= luck) { length = length * 2; player.SendMessage("Lucky force breach!"); } Effect damage = _.EffectDamage(amount); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, target.Object); if (length > 0.0f && dotAmount > 0) { _customEffect.ApplyCustomEffect(player, target.Object, CustomEffectType.ForceBreach, length, level, null); } _skill.RegisterPCToAllCombatTargetsForSkill(player, SkillType.LightSideAbilities, target.Object); Effect vfx = _.EffectVisualEffect(VFX_IMP_DOMINATE_S); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, target.Object); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int damage; float recoveryPercent; var effectiveStats = _stat.GetPlayerItemEffectiveStats(player); int darkBonus = effectiveStats.DarkAbility; int min = 1; int wisdom = player.WisdomModifier; int intelligence = player.IntelligenceModifier; min += darkBonus / 3 + intelligence / 2 + wisdom / 3; switch (perkLevel) { case 1: damage = _random.D6(3, min); recoveryPercent = 0.2f; break; case 2: damage = _random.D6(5, min); recoveryPercent = 0.2f; break; case 3: damage = _random.D6(5, min); recoveryPercent = 0.4f; break; case 4: damage = _random.D6(6, min); recoveryPercent = 0.4f; break; case 5: damage = _random.D6(6, min); recoveryPercent = 0.5f; break; case 6: // Only available with background bonus damage = _random.D6(7, min); recoveryPercent = 0.5f; break; default: return; } _.AssignCommand(player, () => { int heal = (int)(damage * recoveryPercent); if (heal > target.CurrentHP) { heal = target.CurrentHP; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(heal), player); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_MIND), target, 1.0f); }); _skill.RegisterPCToAllCombatTargetsForSkill(player, SkillType.DarkSideAbilities, target.Object); }
public void ApplyStatChanges(NWPlayer player, NWItem ignoreItem, bool isInitialization = false) { if (!player.IsPlayer) { return; } if (!player.IsInitializedAsPlayer) { return; } // Don't fire for ammo as it reapplies bonuses **just** removed from blasters. if (ignoreItem != null && (ignoreItem.BaseItemType == BASE_ITEM_BOLT || ignoreItem.BaseItemType == BASE_ITEM_ARROW || ignoreItem.BaseItemType == BASE_ITEM_BULLET)) { return; } Player pcEntity = _data.Get <Player>(player.GlobalID); List <PCSkill> skills = _data.Where <PCSkill>(x => x.PlayerID == player.GlobalID && x.Rank > 0).ToList(); EffectiveItemStats itemBonuses = GetPlayerItemEffectiveStats(player, ignoreItem); float strBonus = 0.0f; float dexBonus = 0.0f; float conBonus = 0.0f; float intBonus = 0.0f; float wisBonus = 0.0f; float chaBonus = 0.0f; using (new Profiler("PlayerStatService::ApplyStatChanges::AttributeApplication")) { foreach (PCSkill pcSkill in skills) { Skill skill = _data.Get <Skill>(pcSkill.SkillID); CustomAttribute primary = (CustomAttribute)skill.Primary; CustomAttribute secondary = (CustomAttribute)skill.Secondary; CustomAttribute tertiary = (CustomAttribute)skill.Tertiary; // Primary Bonuses if (primary == CustomAttribute.STR) { strBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.DEX) { dexBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.CON) { conBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.INT) { intBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.WIS) { wisBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.CHA) { chaBonus += PrimaryIncrease * pcSkill.Rank; } // Secondary Bonuses if (secondary == CustomAttribute.STR) { strBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.DEX) { dexBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.CON) { conBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.INT) { intBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.WIS) { wisBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.CHA) { chaBonus += SecondaryIncrease * pcSkill.Rank; } // Tertiary Bonuses if (tertiary == CustomAttribute.STR) { strBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.DEX) { dexBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.CON) { conBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.INT) { intBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.WIS) { wisBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.CHA) { chaBonus += TertiaryIncrease * pcSkill.Rank; } } } // Check caps. if (strBonus > MaxAttributeBonus) { strBonus = MaxAttributeBonus; } if (dexBonus > MaxAttributeBonus) { dexBonus = MaxAttributeBonus; } if (conBonus > MaxAttributeBonus) { conBonus = MaxAttributeBonus; } if (intBonus > MaxAttributeBonus) { intBonus = MaxAttributeBonus; } if (wisBonus > MaxAttributeBonus) { wisBonus = MaxAttributeBonus; } if (chaBonus > MaxAttributeBonus) { chaBonus = MaxAttributeBonus; } // Apply item bonuses strBonus += itemBonuses.Strength; dexBonus += itemBonuses.Dexterity; conBonus += itemBonuses.Constitution; wisBonus += itemBonuses.Wisdom; intBonus += itemBonuses.Intelligence; chaBonus += itemBonuses.Charisma; // Check final caps if (strBonus > 100) { strBonus = 100; } if (dexBonus > 100) { dexBonus = 100; } if (conBonus > 100) { conBonus = 100; } if (intBonus > 100) { intBonus = 100; } if (wisBonus > 100) { wisBonus = 100; } if (chaBonus > 100) { chaBonus = 100; } // Apply attributes _nwnxCreature.SetRawAbilityScore(player, ABILITY_STRENGTH, (int)strBonus + pcEntity.STRBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_DEXTERITY, (int)dexBonus + pcEntity.DEXBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_CONSTITUTION, (int)conBonus + pcEntity.CONBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_INTELLIGENCE, (int)intBonus + pcEntity.INTBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_WISDOM, (int)wisBonus + pcEntity.WISBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_CHARISMA, (int)chaBonus + pcEntity.CHABase); // Apply AC using (new Profiler("PlayerStatService::ApplyStatChanges::CalcAC")) { int ac = EffectiveArmorClass(itemBonuses, player); _nwnxCreature.SetBaseAC(player, ac); } // Apply BAB using (new Profiler("PlayerStatService::ApplyStatChanges::CalcBAB")) { int bab = CalculateBAB(player, ignoreItem, itemBonuses); _nwnxCreature.SetBaseAttackBonus(player, bab); } // Apply HP using (new Profiler("PlayerStatService::ApplyStatChanges::CalcHP")) { int hp = EffectiveMaxHitPoints(player, itemBonuses); for (int level = 1; level <= 5; level++) { hp--; _nwnxCreature.SetMaxHitPointsByLevel(player, level, 1); } for (int level = 1; level <= 5; level++) { if (hp > 255) // Levels can only contain a max of 255 HP { _nwnxCreature.SetMaxHitPointsByLevel(player, level, 255); hp = hp - 255; } else // Remaining value gets set to the level. (<255 hp) { _nwnxCreature.SetMaxHitPointsByLevel(player, level, hp + 1); break; } } } if (player.CurrentHP > player.MaxHP) { int amount = player.CurrentHP - player.MaxHP; Effect damage = _.EffectDamage(amount); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, player.Object); } // Apply FP using (new Profiler("PlayerStatService::ApplyStatChanges::CalcFP")) { pcEntity.MaxFP = EffectiveMaxFP(player, itemBonuses); if (isInitialization) { pcEntity.CurrentFP = pcEntity.MaxFP; } _data.SubmitDataChange(pcEntity, DatabaseActionType.Update); } }
public void OnImpact(NWPlayer player, NWObject target, int level) { int damage; int seconds; int dotDamage; switch (level) { case 1: damage = _random.D4(1); seconds = 6; dotDamage = 1; break; case 2: damage = _random.D8(1); seconds = 6; dotDamage = 1; break; case 3: damage = _random.D8(2); seconds = 6; dotDamage = 1; break; case 4: damage = _random.D8(2); seconds = 12; dotDamage = 2; break; case 5: damage = _random.D8(3); seconds = 12; dotDamage = 2; break; case 6: damage = _random.D8(4); seconds = 12; dotDamage = 2; break; case 7: damage = _random.D8(5); seconds = 12; dotDamage = 3; break; case 8: damage = _random.D8(5); seconds = 18; dotDamage = 3; break; case 9: damage = _random.D8(6); seconds = 24; dotDamage = 3; break; default: return; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_PIERCING), target); _customEffect.ApplyCustomEffect(player, target.Object, CustomEffectType.Bleeding, seconds, level, Convert.ToString(dotDamage)); }
public void OnImpact(NWPlayer oPC, NWObject oTarget) { int level = _perk.GetPCPerkLevel(oPC, PerkType.CrushingEarth); int damage; float stunLength = 0.0f; int evocationBonus = oPC.EffectiveEvocationBonus; switch (level) { case 1: damage = _random.Random(6 + evocationBonus) + 1; break; case 2: damage = _random.Random(6 + evocationBonus) + 1; stunLength = 3.0f; break; case 3: damage = _random.Random(6 + evocationBonus) + 1; damage += _random.Random(6 + evocationBonus) + 1; stunLength = 3.0f; break; case 4: damage = _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; damage += _random.Random(4 + evocationBonus) + 1; stunLength = 3.0f; break; case 5: damage = _random.Random(8 + evocationBonus) + 1; damage += _random.Random(8 + evocationBonus) + 1; damage += _random.Random(8 + evocationBonus) + 1; stunLength = 3.0f; break; default: return; } int wisdom = oPC.WisdomModifier; int intelligence = oPC.IntelligenceModifier; float damageMultiplier = 1.0f + (intelligence * 0.2f) + (wisdom * 0.1f); damage = (int)(damage * damageMultiplier); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_CHUNK_STONE_SMALL), oTarget.Object); if (stunLength > 0.0f) { _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectStunned(), oTarget.Object, stunLength + 0.1f); } _skill.RegisterPCToNPCForSkill(oPC, (NWCreature)oTarget, SkillType.EvocationMagic); oPC.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage), oTarget.Object); }); }
public void OnImpact(NWPlayer player, NWObject target, int level) { var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); int darkBonus = effectiveStats.DarkAbility; int amount; int length; int dotAmount; int min = 1; int wisdom = player.WisdomModifier; int intelligence = player.IntelligenceModifier; min += darkBonus / 3 + intelligence / 2 + wisdom / 3; switch (level) { case 1: amount = _random.D6(2, min); length = 0; dotAmount = 0; break; case 2: amount = _random.D6(2, min); length = 6; dotAmount = 1; break; case 3: amount = _random.D12(2, min); length = 6; dotAmount = 1; break; case 4: amount = _random.D12(2, min); length = 12; dotAmount = 1; break; case 5: amount = _random.D12(2, min); length = 6; dotAmount = 2; break; case 6: amount = _random.D12(2, min); length = 12; dotAmount = 2; break; case 7: amount = _random.D12(3, min); length = 12; dotAmount = 2; break; case 8: amount = _random.D12(3, min); length = 6; dotAmount = 4; break; case 9: amount = _random.D12(4, min); length = 6; dotAmount = 4; break; case 10: amount = _random.D12(4, min); length = 12; dotAmount = 4; break; case 11: // Only attainable with background bonus amount = _random.D12(5, min); length = 12; dotAmount = 4; break; default: return; } int luck = _perk.GetPCPerkLevel(player, PerkType.Lucky) + effectiveStats.Luck; if (_random.Random(100) + 1 <= luck) { length = length * 2; player.SendMessage("Lucky force lightning!"); } player.AssignCommand(() => { Effect damage = _.EffectDamage(amount, DAMAGE_TYPE_ELECTRICAL); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, target); }); if (length > 0.0f && dotAmount > 0) { _customEffect.ApplyCustomEffect(player, target.Object, CustomEffectType.ForceShock, length, level, dotAmount.ToString()); } _skill.RegisterPCToAllCombatTargetsForSkill(player, SkillType.DarkSideAbilities, target.Object); player.AssignCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_BEAM_LIGHTNING), target, 1.0f); }); }
public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { var damage = _.EffectDamage(target.MaxHP + 11); _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, damage, target); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int damage; float duration; switch (perkLevel) { case 1: damage = _random.D8(1); duration = 3; break; case 2: damage = _random.D8(2); duration = 3; break; case 3: damage = _random.D8(3); duration = 3; break; case 4: damage = _random.D8(3); duration = 6; break; case 5: damage = _random.D8(4); duration = 6; break; case 6: damage = _random.D8(5); duration = 6; break; case 7: damage = _random.D8(6); duration = 6; break; case 8: damage = _random.D8(7); duration = 6; break; case 9: damage = _random.D8(7); duration = 9; break; case 10: damage = _random.D8(8); duration = 9; break; default: return; } _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectParalyze(), target, duration); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDamage(damage, DAMAGE_TYPE_ELECTRICAL), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_SUNSTRIKE), target); }
public void ApplyStatChanges(NWPlayer player, NWItem ignoreItem) { if (!player.IsPlayer) { return; } if (!player.IsInitializedAsPlayer) { return; } PlayerCharacter pcEntity = _db.PlayerCharacters.Single(x => x.PlayerID == player.GlobalID); List <PCSkill> skills = _db.PCSkills.Where(x => x.PlayerID == player.GlobalID && x.Skill.IsActive).ToList(); float strBonus = 0.0f; float dexBonus = 0.0f; float conBonus = 0.0f; float intBonus = 0.0f; float wisBonus = 0.0f; float chaBonus = 0.0f; foreach (PCSkill pcSkill in skills) { Skill skill = pcSkill.Skill; CustomAttribute primary = (CustomAttribute)skill.Primary; CustomAttribute secondary = (CustomAttribute)skill.Secondary; CustomAttribute tertiary = (CustomAttribute)skill.Tertiary; // Primary Bonuses if (primary == CustomAttribute.STR) { strBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.DEX) { dexBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.CON) { conBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.INT) { intBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.WIS) { wisBonus += PrimaryIncrease * pcSkill.Rank; } else if (primary == CustomAttribute.CHA) { chaBonus += PrimaryIncrease * pcSkill.Rank; } // Secondary Bonuses if (secondary == CustomAttribute.STR) { strBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.DEX) { dexBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.CON) { conBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.INT) { intBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.WIS) { wisBonus += SecondaryIncrease * pcSkill.Rank; } else if (secondary == CustomAttribute.CHA) { chaBonus += SecondaryIncrease * pcSkill.Rank; } // Tertiary Bonuses if (tertiary == CustomAttribute.STR) { strBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.DEX) { dexBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.CON) { conBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.INT) { intBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.WIS) { wisBonus += TertiaryIncrease * pcSkill.Rank; } else if (tertiary == CustomAttribute.CHA) { chaBonus += TertiaryIncrease * pcSkill.Rank; } } // Check caps. if (strBonus > MaxAttributeBonus) { strBonus = MaxAttributeBonus; } if (dexBonus > MaxAttributeBonus) { dexBonus = MaxAttributeBonus; } if (conBonus > MaxAttributeBonus) { conBonus = MaxAttributeBonus; } if (intBonus > MaxAttributeBonus) { intBonus = MaxAttributeBonus; } if (wisBonus > MaxAttributeBonus) { wisBonus = MaxAttributeBonus; } if (chaBonus > MaxAttributeBonus) { chaBonus = MaxAttributeBonus; } if (pcEntity.BackgroundID == (int)BackgroundType.Archer || pcEntity.BackgroundID == (int)BackgroundType.Crossbowman) { dexBonus++; wisBonus++; } if (pcEntity.BackgroundID == (int)BackgroundType.Guard || pcEntity.BackgroundID == (int)BackgroundType.Berserker) { strBonus++; conBonus++; } if (pcEntity.BackgroundID == (int)BackgroundType.TwinBladeSpecialist) { dexBonus++; conBonus++; } if (pcEntity.BackgroundID == (int)BackgroundType.MartialArtist) { strBonus++; dexBonus++; } // Apply attributes _nwnxCreature.SetRawAbilityScore(player, ABILITY_STRENGTH, (int)strBonus + pcEntity.STRBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_DEXTERITY, (int)dexBonus + pcEntity.DEXBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_CONSTITUTION, (int)conBonus + pcEntity.CONBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_INTELLIGENCE, (int)intBonus + pcEntity.INTBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_WISDOM, (int)wisBonus + pcEntity.WISBase); _nwnxCreature.SetRawAbilityScore(player, ABILITY_CHARISMA, (int)chaBonus + pcEntity.CHABase); // Apply AC int ac = CalculateItemAC(player, ignoreItem) + _customEffect.CalculateEffectAC(player); _nwnxCreature.SetBaseAC(player, ac); // Apply BAB int bab = CalculateBAB(player, ignoreItem); _nwnxCreature.SetBaseAttackBonus(player, bab); int equippedItemHPBonus = 0; int equippedItemManaBonus = 0; for (int slot = 0; slot < NUM_INVENTORY_SLOTS; slot++) { NWItem item = NWItem.Wrap(_.GetItemInSlot(slot, player.Object)); if (item.Equals(ignoreItem)) { continue; } equippedItemHPBonus += item.HPBonus; equippedItemManaBonus += item.ManaBonus; } // Apply HP int hp = 30 + player.ConstitutionModifier * 5; hp += _perk.GetPCPerkLevel(player, PerkType.Health) * 5; hp += equippedItemHPBonus; if (pcEntity.BackgroundID == (int)BackgroundType.Knight) { hp += 10; } if (hp > 255) { hp = 255; } if (hp < 20) { hp = 20; } _nwnxCreature.SetMaxHitPointsByLevel(player, 1, hp); if (player.CurrentHP > player.MaxHP) { int amount = player.CurrentHP - player.MaxHP; Effect damage = _.EffectDamage(amount); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, damage, player.Object); } // Apply Mana int mana = 20; mana += (player.IntelligenceModifier + player.WisdomModifier + player.CharismaModifier) * 5; mana += _perk.GetPCPerkLevel(player, PerkType.Mana) * 5; mana += equippedItemManaBonus; if (pcEntity.BackgroundID == (int)BackgroundType.Wizard || pcEntity.BackgroundID == (int)BackgroundType.Cleric) { mana += 10; } if (mana < 0) { mana = 0; } pcEntity.MaxMana = mana; _db.SaveChanges(); }