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 ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = NWPlayer.Wrap(user.Object); target.RemoveEffect(EFFECT_TYPE_REGENERATE); PCSkill skill = _skill.GetPCSkill(player, SkillType.FirstAid); int luck = _perk.GetPCPerkLevel(player, PerkType.Lucky); int perkDurationBonus = _perk.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (skill.Rank * 0.4f) + perkDurationBonus; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + player.EffectiveFirstAidBonus; int perkBlastBonus = _perk.GetPCPerkLevel(player, PerkType.ImmediateImprovement); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (_random.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(blastHeal), target.Object); } Effect regeneration = _.EffectRegenerate(restoreAmount, 6.0f); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, regeneration, target.Object, duration); player.SendMessage("You successfully treat " + target.Name + "'s wounds."); int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(100, item.RecommendedLevel, skill.Rank); _skill.GiveSkillXP(player, SkillType.FirstAid, xp); }
public void OnPlayerRespawn() { NWPlayer oPC = _.GetLastRespawnButtonPresser(); int amount = oPC.MaxHP / 2; _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), oPC.Object); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), oPC.Object); NWArea area = oPC.Area; TeleportPlayerToBindPoint(oPC); // If player is the last person in an instance, destroy the instance. if (area.IsInstance) { int playersInArea = NWModule.Get().Players.Count(x => x.Area == oPC.Area && x != oPC); if (playersInArea <= 0) { _.DelayCommand(12.0f, () => { _area.DestroyAreaInstance(area); }); } } }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = user.Object; var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); int skillRank = _skill.GetPCSkillRank(player, SkillType.Medicine); int perkLevel = _perk.GetPCPerkLevel(player, PerkType.ResuscitationDevices); int rank = item.GetLocalInt("RANK"); int baseHeal; switch (rank) { case 1: baseHeal = 1; break; case 2: baseHeal = 11; break; case 3: baseHeal = 31; break; case 4: baseHeal = 51; break; default: return; } baseHeal += perkLevel * 2; baseHeal += effectiveStats.Medicine / 2; baseHeal += item.MedicineBonus / 2; int delta = item.RecommendedLevel - skillRank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } baseHeal = (int)(baseHeal * effectivenessPercent); Player dbPlayer = _data.Single <Player>(x => x.ID == user.GlobalID); int hpRecover = (int)(target.MaxHP * (0.01f * baseHeal)); int fpRecover = (int)(dbPlayer.MaxFP * (0.01f * baseHeal)); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(hpRecover), target); dbPlayer.CurrentFP = fpRecover; _data.SubmitDataChange(dbPlayer, DatabaseActionType.Update); player.SendMessage("You successfully resuscitate " + target.Name + "!"); if (target.IsPlayer) { int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(600, item.RecommendedLevel, skillRank); _skill.GiveSkillXP(player, SkillType.Medicine, xp); } }
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 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.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 PlayerCharacter ApplyHungerPenalties(PlayerCharacter entity, NWPlayer pc) { int penalty = 0; if (entity.CurrentHunger >= 40 && entity.CurrentHunger <= 50) { pc.FloatingText("You are starving! You should eat soon."); } else if (entity.CurrentHunger >= 30 && entity.CurrentHunger < 40) { penalty = 1; pc.FloatingText("You are starving! You are suffering from starvation penalties."); } else if (entity.CurrentHunger >= 20 && entity.CurrentHunger < 30) { penalty = 2; pc.FloatingText("You are starving! You are suffering from starvation penalties."); } else if (entity.CurrentHunger >= 10 && entity.CurrentHunger < 20) { penalty = 3; pc.FloatingText("You are starving! You are suffering from starvation penalties."); } else if (entity.CurrentHunger < 10) { penalty = 4; pc.FloatingText(_color.Red("You are starving! You are about to starve to death!")); } var effects = pc.Effects; foreach (Effect effect in effects) { if (_.GetEffectTag(effect) == "EFFECT_HUNGER_PENALTIES") { _.RemoveEffect(pc.Object, effect); } } if (penalty > 0) { Effect effect = _.EffectAbilityDecrease(ABILITY_STRENGTH, penalty); effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_DEXTERITY, penalty)); effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_CONSTITUTION, penalty)); effect = _.TagEffect(effect, "EFFECT_HUNGER_PENALTIES"); _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, effect, pc.Object); } if (entity.CurrentHunger <= 0) { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectDeath(), pc.Object); entity.CurrentHunger = 20; pc.FloatingText("You starved to death!"); } return(entity); }
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 DoAction(NWPlayer user, params string[] args) { if (user.IsDead) { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), user.Object); } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(999), user.Object); }
/// <summary> /// Revives and heals user completely. /// </summary> /// <param name="user"></param> /// <param name="target"></param> /// <param name="targetLocation"></param> /// <param name="args"></param> public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { if (user.IsDead) { _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, _.EffectResurrection(), user.Object); } _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, _.EffectHeal(999), user.Object); }
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); }); }
private void DoHeal(NWObject target, int perkLevel, int minimum) { float percentage = perkLevel * 0.10f; int heal = (int)(target.MaxHP * percentage); heal = _random.Random(minimum, heal); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(heal), target); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_IMP_HEALING_G), target); }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = (user.Object); var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(player); target.RemoveEffect(EFFECT_TYPE_REGENERATE); int rank = _skill.GetPCSkillRank(player, SkillType.Medicine); int luck = _perk.GetPCPerkLevel(player, PerkType.Lucky); int perkDurationBonus = _perk.GetPCPerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2); float duration = 30.0f + (rank * 0.4f) + perkDurationBonus; int restoreAmount = 1 + item.GetLocalInt("HEALING_BONUS") + effectiveStats.Medicine + item.MedicineBonus; int delta = item.RecommendedLevel - rank; float effectivenessPercent = 1.0f; if (delta > 0) { effectivenessPercent = effectivenessPercent - (delta * 0.1f); } restoreAmount = (int)(restoreAmount * effectivenessPercent); int perkBlastBonus = _perk.GetPCPerkLevel(player, PerkType.ImmediateImprovement); if (perkBlastBonus > 0) { int blastHeal = restoreAmount * perkBlastBonus; if (_random.Random(100) + 1 <= luck / 2) { blastHeal *= 2; } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(blastHeal), target.Object); } float interval = 6.0f; BackgroundType background = (BackgroundType)player.Class1; if (background == BackgroundType.Medic) { interval *= 0.5f; } Effect regeneration = _.EffectRegenerate(restoreAmount, interval); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, regeneration, target.Object, duration); player.SendMessage("You successfully treat " + target.Name + "'s wounds. The healing kit will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The healing kit that you applied to " + target.Name + " has expired."); }); if (target.IsPlayer) { int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); _skill.GiveSkillXP(player, SkillType.Medicine, xp); } }
public void OnPlayerRespawn() { NWPlayer oPC = (_.GetLastRespawnButtonPresser()); int amount = oPC.MaxHP / 2; _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectResurrection(), oPC.Object); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), oPC.Object); TeleportPlayerToBindPoint(oPC); }
public void CraftItem(NWPlayer oPC, NWPlaceable device) { var model = GetPlayerCraftingData(oPC); CraftBlueprint blueprint = _db.CraftBlueprints.Single(x => x.CraftBlueprintID == model.BlueprintID); if (blueprint == null) { return; } if (oPC.IsBusy) { oPC.SendMessage("You are too busy right now."); return; } if (!model.CanBuildItem) { oPC.SendMessage("You are missing one or more components..."); return; } oPC.IsBusy = true; float modifiedCraftDelay = CalculateCraftingDelay(oPC, blueprint.SkillID); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectCutsceneImmobilize(), oPC.Object, modifiedCraftDelay + 0.1f); oPC.AssignCommand(() => { _.ClearAllActions(); _.ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0f, modifiedCraftDelay); }); device.DelayCommand(() => { _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_BLOOD_SPARK_MEDIUM), device.Object); }, 1.0f * (modifiedCraftDelay / 2.0f)); _nwnxPlayer.StartGuiTimingBar(oPC, modifiedCraftDelay, ""); oPC.DelayCommand(() => { try { RunCreateItem(oPC, device); oPC.IsBusy = false; } catch (Exception ex) { _error.LogError(ex); } }, modifiedCraftDelay); }
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 oPC, NWObject oTarget) { int perkLevel = _perk.GetPCPerkLevel(oPC, PerkType.Evasiveness); int damageBase; float length = 12.0f; int randomDamage; switch (perkLevel) { case 1: damageBase = 1; randomDamage = 6; // 6 = DAMAGE_BONUS_1d4 constant break; case 2: damageBase = 1; randomDamage = 8; // 8 = DAMAGE_BONUS_1d8 constant break; case 3: damageBase = 2; randomDamage = 10; // 10 = DAMAGE_BONUS_2d6 constant break; case 4: damageBase = 2; randomDamage = 11; // 11 = DAMAGE_BONUS_2d8 constant break; case 5: damageBase = 3; randomDamage = 15; // 15 = DAMAGE_BONUS_2d12 constant break; default: return; } Effect effect = _.EffectDamageShield(damageBase, randomDamage, DAMAGE_TYPE_MAGICAL); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, oPC.Object, length); effect = _.EffectVisualEffect(VFX_DUR_AURA_ORANGE); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, oPC.Object, length); effect = _.EffectVisualEffect(VFX_IMP_AC_BONUS); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oPC.Object); }
public void Tick(NWCreature oCaster, NWObject oTarget, int currentTick, int effectiveLevel, string data) { NWPlayer player = oTarget.Object; int restTick = oTarget.GetLocalInt("REST_TICK") + 1; // Pull original position from data string[] values = data.Split(','); Vector originalPosition = _.Vector ( Convert.ToSingle(values[0]), Convert.ToSingle(values[1]), Convert.ToSingle(values[2]) ); // Check position Vector position = player.Position; if ((Math.Abs(position.m_X - originalPosition.m_X) > 0.01f || Math.Abs(position.m_Y - originalPosition.m_Y) > 0.01f || Math.Abs(position.m_Z - originalPosition.m_Z) > 0.01f) || !CanRest(player) || !player.IsValid) { player.IsBusy = false; _customEffect.RemovePCCustomEffect(player, CustomEffectType.Rest); return; } player.IsBusy = true; player.AssignCommand(() => { _.ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0f, 6.1f); }); if (restTick >= 6) { int amount = CalculateAmount(player); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), player); Effect vfx = _.EffectVisualEffect(VFX_IMP_HEAD_HOLY); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, player); restTick = 0; } oTarget.SetLocalInt("REST_TICK", restTick); }
private void RunMeditate(NWPlayer oPC, Vector originalPosition, int amount) { Vector position = oPC.Position; if ((position.m_X != originalPosition.m_X || position.m_Y != originalPosition.m_Y || position.m_Z != originalPosition.m_Z) || !CanMeditate(oPC) || !oPC.IsValid) { oPC.SendMessage("You stop meditating."); oPC.IsBusy = false; return; } _ability.RestoreMana(oPC, amount); Effect vfx = _.EffectVisualEffect(VFX_IMP_HEAD_MIND); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oPC.Object); oPC.AssignCommand(() => { _.ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0f, 6.1f); }); oPC.DelayCommand(() => { RunMeditate(oPC, originalPosition, amount); }, 6.0f); }
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); }); }
private void HandleRegenerationTick(NWPlayer oPC, PlayerCharacter entity) { entity.RegenerationTick = entity.RegenerationTick - 1; int rate = 20; int amount = entity.HPRegenerationAmount; if (entity.RegenerationTick <= 0) { if (entity.CurrentHunger <= 20) { oPC.SendMessage("You are hungry and not recovering HP naturally. Eat food to start recovering again."); } else if (oPC.CurrentHP < oPC.MaxHP) { // CON bonus int con = oPC.ConstitutionModifier; if (con > 0) { amount += con; } entity = _food.DecreaseHungerLevel(entity, oPC, 3); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(amount), oPC.Object); } entity.RegenerationTick = rate; } }
public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData) { NWPlayer player = user.Object; int ability = item.GetLocalInt("ABILITY_TYPE"); int amount = item.GetLocalInt("AMOUNT") + item.MedicineBonus; int rank = player.IsPlayer ? _skill.GetPCSkillRank(player, SkillType.Medicine) : 0; int recommendedLevel = item.RecommendedLevel; float duration = 30.0f; int perkLevel = player.IsPlayer ? _perk.GetPCPerkLevel(player, PerkType.StimFiend) : 0; float percentIncrease = perkLevel * 0.25f; duration = duration + (duration * percentIncrease); Effect effect = _.EffectAbilityIncrease(ability, amount); effect = _.TagEffect(effect, "STIM_PACK_EFFECT"); _.ApplyEffectToObject(NWScript.DURATION_TYPE_TEMPORARY, effect, target, duration); user.SendMessage("You inject " + target.Name + " with a stim pack. The stim pack will expire in " + duration + " seconds."); _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The stim pack that you applied to " + target.Name + " has expired."); }); if (!Equals(user, target)) { NWCreature targetCreature = target.Object; targetCreature.SendMessage(user.Name + " injects you with a stim pack."); } int xp = (int)_skill.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank); _skill.GiveSkillXP(player, SkillType.Medicine, xp); }
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 OnImpact(NWPlayer oPC, NWObject oTarget) { int level = _perk.GetPCPerkLevel(oPC, PerkType.Purify); int luck = _perk.GetPCPerkLevel(oPC, PerkType.Lucky); bool luckBonus = _random.Random(100) + 1 <= luck; if (level >= 1 || luckBonus) { _customEffect.RemovePCCustomEffect((NWPlayer)oTarget, CustomEffectType.Bleeding); } if (level >= 2 || luckBonus) { _customEffect.RemovePCCustomEffect((NWPlayer)oTarget, CustomEffectType.Poison); } if (level >= 3 || luckBonus) { _customEffect.RemovePCCustomEffect((NWPlayer)oTarget, CustomEffectType.Burning); } Effect vfx = _.EffectVisualEffect(VFX_IMP_HEALING_S); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oTarget.Object); foreach (Effect effect in oTarget.Effects) { int effectType = _.GetEffectType(effect); if (effectType == EFFECT_TYPE_POISON || effectType == EFFECT_TYPE_DISEASE) { _.RemoveEffect(oTarget.Object, effect); } } _skill.RegisterPCToAllCombatTargetsForSkill(oPC, SkillType.AlterationMagic); }
public void OnImpact(NWPlayer player, NWObject target, int perkLevel) { int adjust = perkLevel * 10; _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, _.EffectVisualEffect(VFX_DUR_GHOSTLY_VISAGE), target, 3.0f); _enmity.AdjustPercentEnmityOnAllTaggedCreatures(player, -adjust, -adjust); }
public bool Run(params object[] args) { NWCreature attacker = (_.GetLastDamager(Object.OBJECT_SELF)); NWPlaceable tower = (Object.OBJECT_SELF); NWItem weapon = (_.GetLastWeaponUsed(attacker.Object)); int damage = _.GetTotalDamageDealt(); var structureID = tower.GetLocalString("PC_BASE_STRUCTURE_ID"); PCBaseStructure structure = _data.Single <PCBaseStructure>(x => x.ID == new Guid(structureID)); int maxShieldHP = _base.CalculateMaxShieldHP(structure); PCBase pcBase = _data.Get <PCBase>(structure.PCBaseID); pcBase.ShieldHP -= damage; if (pcBase.ShieldHP <= 0) { pcBase.ShieldHP = 0; } float hpPercentage = (float)pcBase.ShieldHP / (float)maxShieldHP * 100.0f; if (hpPercentage <= 25.0f && pcBase.ReinforcedFuel > 0) { pcBase.IsInReinforcedMode = true; pcBase.ShieldHP = (int)(maxShieldHP * 0.25f); } attacker.SendMessage("Tower Shields: " + hpPercentage.ToString("0.00") + "%"); if (pcBase.IsInReinforcedMode) { attacker.SendMessage("Control tower is in reinforced mode and cannot be damaged. Reinforced mode will be disabled when the tower runs out of fuel."); } _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(9999), tower.Object); var durability = _durability.GetDurability(weapon) - _random.RandomFloat(0.01f, 0.03f); _durability.SetDurability(weapon, durability); if (pcBase.ShieldHP <= 0) { pcBase.ShieldHP = 0; structure.Durability -= _random.RandomFloat(0.5f, 2.0f); if (structure.Durability < 0.0f) { structure.Durability = 0.0f; } attacker.SendMessage("Structure Durability: " + structure.Durability.ToString("0.00")); if (structure.Durability <= 0.0f) { structure.Durability = 0.0f; BlowUpBase(pcBase); return(true); } } _data.SubmitDataChange(pcBase, DatabaseActionType.Update); _data.SubmitDataChange(structure, DatabaseActionType.Update); return(true); }
private void HandleRegenerationTick(NWPlayer oPC, Data.Entity.Player entity) { entity.RegenerationTick = entity.RegenerationTick - 1; int rate = 20; int amount = entity.HPRegenerationAmount; if (entity.RegenerationTick <= 0) { if (oPC.CurrentHP < oPC.MaxHP) { var effectiveStats = _playerStat.GetPlayerItemEffectiveStats(oPC); // CON bonus int con = oPC.ConstitutionModifier; if (con > 0) { amount += con; } amount += effectiveStats.HPRegen; if (oPC.Chest.CustomItemType == CustomItemType.HeavyArmor) { int sturdinessLevel = _perk.GetPCPerkLevel(oPC, PerkType.Sturdiness); if (sturdinessLevel > 0) { amount += sturdinessLevel + 1; } } _.ApplyEffectToObject(NWScript.DURATION_TYPE_INSTANT, _.EffectHeal(amount), oPC.Object); } entity.RegenerationTick = rate; } }
public void OnImpact(NWPlayer oPC, NWObject oTarget) { int perkLevel = _perk.GetPCPerkLevel(oPC, PerkType.Evasiveness); int concealment; float length; switch (perkLevel) { case 1: concealment = 10; length = 12.0f; break; case 2: concealment = 15; length = 12.0f; break; case 3: concealment = 20; length = 12.0f; break; case 4: concealment = 25; length = 12.0f; break; case 5: concealment = 30; length = 18.0f; break; default: return; } Effect effect = _.EffectConcealment(concealment); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, oPC.Object, length); effect = _.EffectVisualEffect(VFX_DUR_AURA_CYAN); _.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, effect, oPC.Object, length); effect = _.EffectVisualEffect(VFX_IMP_AC_BONUS); _.ApplyEffectToObject(DURATION_TYPE_INSTANT, effect, oPC.Object); }