示例#1
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer userPlayer = (user.Object);
            NWItem   targetItem = (target.Object);
            float    perkBonus  = 0.0f;

            if (GetLocalBool(targetItem, "LIGHTSABER") == true)
            {
                perkBonus = PerkService.GetCreaturePerkLevel(userPlayer, PerkType.SpeedyEngineering) * 0.1f;
            }
            else if (ArmorBaseItemTypes.Contains(targetItem.BaseItemType))
            {
                perkBonus = PerkService.GetCreaturePerkLevel(userPlayer, PerkType.SpeedyArmorsmith) * 0.1f;
            }
            else if (WeaponsmithBaseItemTypes.Contains(targetItem.BaseItemType))
            {
                perkBonus = PerkService.GetCreaturePerkLevel(userPlayer, PerkType.SpeedyWeaponsmith) * 0.1f;
            }
            else if (EngineeringBaseItemTypes.Contains(targetItem.BaseItemType))
            {
                perkBonus = PerkService.GetCreaturePerkLevel(userPlayer, PerkType.SpeedyEngineering) * 0.1f;
            }


            float seconds = 18.0f - (18.0f * perkBonus);

            if (seconds <= 0.1f)
            {
                seconds = 0.1f;
            }
            return(seconds);
        }
示例#2
0
        private void ApplyFeatChanges(NWCreature creature, NWItem oItem)
        {
            NWItem equipped = oItem ?? creature.RightHand;

            if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Baton)
            {
                NWNXCreature.RemoveFeat(creature, FEAT_POWER_ATTACK);
                NWNXCreature.RemoveFeat(creature, FEAT_IMPROVED_POWER_ATTACK);
                if (_.GetActionMode(creature, ACTION_MODE_POWER_ATTACK) == TRUE)
                {
                    _.SetActionMode(creature, ACTION_MODE_POWER_ATTACK, FALSE);
                }
                if (_.GetActionMode(creature, ACTION_MODE_IMPROVED_POWER_ATTACK) == TRUE)
                {
                    _.SetActionMode(creature, ACTION_MODE_IMPROVED_POWER_ATTACK, FALSE);
                }
                return;
            }

            int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.BluntPowerAttack);

            NWNXCreature.AddFeat(creature, FEAT_POWER_ATTACK);

            if (perkLevel >= 2)
            {
                NWNXCreature.AddFeat(creature, FEAT_IMPROVED_POWER_ATTACK);
            }
        }
示例#3
0
        public string IsValidTarget(NWCreature user, NWItem item, NWObject target, Location targetLocation)
        {
            NWArea area = user.Area;

            if (area.GetLocalInt("BUILDING_TYPE") != (int)Enumeration.BuildingType.Starship)
            {
                return("This repair kit may only be used inside a starship");
            }

            string structureID   = area.GetLocalString("PC_BASE_STRUCTURE_ID");
            Guid   structureGuid = new Guid(structureID);

            PCBaseStructure pcbs      = DataService.PCBaseStructure.GetByID(structureGuid);
            BaseStructure   structure = DataService.BaseStructure.GetByID(pcbs.BaseStructureID);

            if (structure.Durability == pcbs.Durability)
            {
                return("This starship is already fully repaired.");
            }

            bool   canRepair = (PerkService.GetCreaturePerkLevel(new NWPlayer(user), PerkType.CombatRepair) >= 1);
            PCBase pcBase    = DataService.PCBase.GetByID(pcbs.PCBaseID);

            if (!canRepair && SpaceService.IsLocationSpace(pcBase.ShipLocation))
            {
                return("You need the Combat Repair perk to repair ships in space.");
            }

            return("");
        }
示例#4
0
        private int CalculateAmount(NWPlayer player)
        {
            var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player);
            int perkLevel      = PerkService.GetCreaturePerkLevel(player, PerkType.Meditate);
            int amount;

            switch (perkLevel)
            {
            default:
                amount = 6;
                break;

            case 4:
            case 5:
            case 6:
                amount = 10;
                break;

            case 7:
                amount = 14;
                break;
            }
            amount += effectiveStats.Meditate;

            return(amount);
        }
示例#5
0
        public string IsValidTarget(NWCreature user, NWItem item, NWObject target, Location targetLocation)
        {
            if (!target.IsCreature || target.IsDM)
            {
                return("Only creatures may be targeted with this item.");
            }

            if (target.CurrentHP > -11)
            {
                return("Your target is not dead.");
            }

            if (user.IsInCombat)
            {
                return("You are in combat.");
            }

            int perkLevel     = PerkService.GetCreaturePerkLevel(user.Object, PerkType.ResuscitationDevices);
            int requiredLevel = item.GetLocalInt("RANK");

            if (perkLevel < requiredLevel)
            {
                return("You must have the Resuscitation Devices perk at level " + requiredLevel + " to use this item.");
            }

            return(null);
        }
示例#6
0
        private void ApplyFeatChanges(NWCreature creature, NWItem oItem)
        {
            NWItem equipped = oItem ?? creature.RightHand;

            if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Vibroblade)
            {
                NWNXCreature.RemoveFeat(creature, Feat.PowerAttack);
                NWNXCreature.RemoveFeat(creature, Feat.ImprovedPowerAttack);
                if (_.GetActionMode(creature, ActionMode.PowerAttack) == true)
                {
                    _.SetActionMode(creature, ActionMode.PowerAttack, false);
                }
                if (_.GetActionMode(creature, ActionMode.ImprovedPowerAttack) == true)
                {
                    _.SetActionMode(creature, ActionMode.ImprovedPowerAttack, false);
                }
                return;
            }

            int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.BladePowerAttack);

            NWNXCreature.AddFeat(creature, Feat.PowerAttack);

            if (perkLevel >= 2)
            {
                NWNXCreature.AddFeat(creature, Feat.ImprovedPowerAttack);
            }
        }
示例#7
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player           = user.Object;
            var      ability          = (AbilityType)item.GetLocalInt("ABILITY_TYPE");
            int      amount           = item.GetLocalInt("AMOUNT") + (item.MedicineBonus * 2);
            int      rank             = player.IsPlayer ? SkillService.GetPCSkillRank(player, SkillType.Medicine) : 0;
            int      recommendedLevel = item.RecommendedLevel;
            float    duration         = 30.0f * (rank / 10);
            int      perkLevel        = player.IsPlayer ? PerkService.GetCreaturePerkLevel(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(DurationType.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)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank);

            SkillService.GiveSkillXP(player, SkillType.Medicine, xp);
        }
示例#8
0
        private bool CheckValidity(NWPlaceable forge, NWPlayer pc, NWItem item)
        {
            if (pc.IsBusy)
            {
                ReturnItemToPC(pc, item, "You are too busy.");
                return(false);
            }

            if (_.GetIsObjectValid(forge.GetLocalObject("FORGE_USER")) == _.TRUE)
            {
                ReturnItemToPC(pc, item, "This forge is currently in use. Please wait...");
                return(false);
            }

            string[] allowed =
            {
                "power_core",
                "raw_veldite",
                "raw_scordspar",
                "raw_plagionite",
                "raw_keromber",
                "raw_jasioclase",
                "raw_hemorgite",
                "raw_ochne",
                "raw_croknor",
                "raw_arkoxit",
                "raw_bisteiss"
            };

            if (!allowed.Contains(item.Resref))
            {
                ReturnItemToPC(pc, item, "Only power cores and raw materials may be placed inside.");
                return(false);
            }

            int level = CraftService.GetIngotLevel(item.Resref);
            int rank  = SkillService.GetPCSkillRank(pc, SkillType.Harvesting);

            int delta = rank - level;

            if (delta <= -4)
            {
                ReturnItemToPC(pc, item, "You do not have enough skill to refine this material.");
                return(false);
            }

            int pcPerkLevel  = PerkService.GetCreaturePerkLevel(pc, PerkType.Refining);
            int orePerkLevel = CraftService.GetIngotPerkLevel(item.Resref);

            if (pcPerkLevel < orePerkLevel)
            {
                ReturnItemToPC(pc, item, "You do not have the perk necessary to refine this material.");
                return(false);
            }

            return(true);
        }
示例#9
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            if (PerkService.GetCreaturePerkLevel(new NWPlayer(user), PerkType.CombatRepair) >= 2)
            {
                return(6.0f);
            }

            return(12.0f);
        }
示例#10
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            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;
            }

            if (creature.IsPlayer)
            {
                var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(creature.Object);
                int luck           = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky) + effectiveStats.Luck;
                chance += luck;
            }

            if (RandomService.Random(100) + 1 <= chance)
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectAttackIncrease(ab), creature.Object, length);
                creature.SendMessage(ColorTokenService.Combat("You perform a defensive maneuver."));
            }
        }
示例#11
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player         = (user.Object);
            var      effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player);

            target.RemoveEffect(EffectTypeScript.Regenerate);
            int   rank = SkillService.GetPCSkillRank(player, SkillType.Medicine);
            int   luck = PerkService.GetCreaturePerkLevel(player, PerkType.Lucky);
            int   perkDurationBonus    = PerkService.GetCreaturePerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2);
            float duration             = 30.0f + (rank * 0.4f) + perkDurationBonus + item.MedicineBonus;
            int   restoreAmount        = 1 + item.GetLocalInt("HEALING_BONUS") + effectiveStats.Medicine + (rank / 10);
            int   delta                = item.RecommendedLevel - rank;
            float effectivenessPercent = 1.0f;

            if (delta > 0)
            {
                effectivenessPercent = effectivenessPercent - (delta * 0.1f);
            }

            restoreAmount = (int)(restoreAmount * effectivenessPercent);

            int perkBlastBonus = PerkService.GetCreaturePerkLevel(player, PerkType.ImmediateImprovement);

            if (perkBlastBonus > 0)
            {
                int blastHeal = restoreAmount * perkBlastBonus;
                if (RandomService.Random(100) + 1 <= luck / 2)
                {
                    blastHeal *= 2;
                }
                _.ApplyEffectToObject(DurationType.Instant, _.EffectHeal(blastHeal), target.Object);
            }

            float          interval   = 6.0f;
            BackgroundType background = (BackgroundType)player.Class1;

            if (background == BackgroundType.Medic)
            {
                interval *= 0.5f;
            }

            _.PlaySound("use_bacta");
            Effect regeneration = _.EffectRegenerate(restoreAmount, interval);

            _.ApplyEffectToObject(DurationType.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)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank);
                SkillService.GiveSkillXP(player, SkillType.Medicine, xp);
            }
        }
示例#12
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float percent = 0.0f;

            switch (spellTier)
            {
            case 1:
                percent = 0.10f;
                break;

            case 2:
                percent = 0.20f;
                break;

            case 3:
                percent = 0.35f;
                break;

            case 4:
                percent = 0.50f;
                break;
            }

            int recovery = (int)(target.CurrentHP * percent);

            if (recovery < 1)
            {
                recovery = 1;
            }

            // Damage user.
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectDamage(recovery), creature);

            // Check lucky chance.
            int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);

            if (RandomService.D100(1) <= luck)
            {
                recovery *= 2;
                creature.SendMessage("Lucky Force Body!");
            }

            // Recover FP on target.
            AbilityService.RestorePlayerFP(target.Object, recovery);

            // Play VFX
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_IMP_HEAD_ODD), target);

            // Grant XP, if player.
            if (creature.IsPlayer)
            {
                SkillService.GiveSkillXP(creature.Object, SkillType.ForceControl, recovery * 2);
            }
        }
示例#13
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float duration = 0.0f;

            switch (spellTier)
            {
            case 1:
                duration = 6f;
                break;

            case 2:
                duration = 12f;
                break;

            case 3:
                duration = 18f;
                break;

            case 4:
                duration = 24f;
                break;
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal);


            // Resisted - Only apply slow for six seconds
            if (result.IsResisted)
            {
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectSlow(), target, 6.0f);
            }

            // Not resisted - Apply knockdown for the specified duration
            else
            {
                // Check lucky chance.
                int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);
                if (RandomService.D100(1) <= luck)
                {
                    duration *= 2;
                    creature.SendMessage("Lucky Force Push!");
                }

                _.ApplyEffectToObject(DurationType.Temporary, AbilityService.EffectKnockdown(target, 3.0f), target, 3.0f);
                _.ApplyEffectToObject(DurationType.Temporary, _.EffectSlow(), target, duration);
            }

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceAlter, target.Object);
            }

            _.ApplyEffectToObject(DurationType.Instant, _.EffectVisualEffect(VisualEffect.Vfx_Com_Blood_Spark_Small), target);
        }
示例#14
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel((NWPlayer)user, PerkType.SpeedyFirstAid) * 10)
            {
                return(0.1f);
            }

            int rank = SkillService.GetPCSkillRank((NWPlayer)user, SkillType.Medicine);

            return(12.0f - (rank * 0.1f));
        }
示例#15
0
        public static void grenadeAoe(NWObject oTarget, string grenadeType)
        {
            if (oTarget.ObjectType != ObjectType.Creature)
            {
                return;
            }
            NWCreature user           = GetAreaOfEffectCreator(_.OBJECT_SELF);
            int        perkLevel      = PerkService.GetCreaturePerkLevel(user, PerkType.GrenadeProficiency);
            int        duration       = 1;
            Effect     impactEffect   = null;
            Effect     durationEffect = null;

            //Console.WriteLine("In grenadeAoe for grenade type " + grenadeType + " on " + GetName(oTarget));

            switch (grenadeType)
            {
            case "SMOKE":
                durationEffect = EffectInvisibility(InvisibilityType.Normal);
                break;

            case "BACTABOMB":
                durationEffect = EffectRegenerate(perkLevel * 2 + 1, 6.0f);
                break;

            case "INCENDIARY":
                impactEffect = EffectDamage(perkLevel + 1 + RandomService.D6(perkLevel), DamageType.Fire);
                duration     = RandomService.D6(1);
                break;

            case "GAS":
                impactEffect = EffectDamage(perkLevel + 1 + RandomService.D6(perkLevel), DamageType.Acid);
                duration     = RandomService.D6(1);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(grenadeType));
            }

            if (GetIsObjectValid(oTarget) == true)
            {
                if (impactEffect != null)
                {
                    ApplyEffectToObject(DurationType.Instant, impactEffect, oTarget);
                }
                if (durationEffect != null)
                {
                    ApplyEffectToObject(DurationType.Temporary, durationEffect, oTarget, duration * 6.0f);
                }
                if (!oTarget.IsPlayer)
                {
                    SkillService.RegisterPCToNPCForSkill(user.Object, oTarget, SkillType.Throwing);
                }
            }
        }
示例#16
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            const float BaseHarvestingTime = 16.0f;
            float       harvestingTime     = BaseHarvestingTime;

            if (user.IsPlayer)
            {
                var player = (user.Object);
                harvestingTime = BaseHarvestingTime - BaseHarvestingTime * (PerkService.GetCreaturePerkLevel(player, PerkType.SpeedyHarvester) * 0.1f);
            }
            return(harvestingTime);
        }
示例#17
0
        public void ApplyEffects(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player               = (user.Object);
            var      effectiveStats       = PlayerStatService.GetPlayerItemEffectiveStats(player);
            int      rank                 = SkillService.GetPCSkillRank(player, SkillType.Medicine);
            int      luck                 = PerkService.GetCreaturePerkLevel(player, PerkType.Lucky);
            int      perkDurationBonus    = PerkService.GetCreaturePerkLevel(player, PerkType.HealingKitExpert) * 6 + (luck * 2);
            float    duration             = 30.0f + (rank * 0.4f) + perkDurationBonus + effectiveStats.Medicine;
            int      restoreAmount        = 1 + item.GetLocalInt("HEALING_BONUS") + (rank / 10);
            int      delta                = item.RecommendedLevel - rank;
            float    effectivenessPercent = 1.0f;

            if (delta > 0)
            {
                effectivenessPercent = effectivenessPercent - (delta * 0.1f);
            }

            restoreAmount = (int)(restoreAmount * effectivenessPercent) + item.MedicineBonus;

            int perkBlastBonus = PerkService.GetCreaturePerkLevel(player, PerkType.ImmediateForcePack);

            if (perkBlastBonus > 0)
            {
                int blastHeal = restoreAmount * perkBlastBonus;
                if (RandomService.Random(100) + 1 <= luck / 2)
                {
                    blastHeal *= 2;
                }

                AbilityService.RestorePlayerFP(target.Object, blastHeal);
            }

            float          interval   = 6.0f;
            BackgroundType background = (BackgroundType)player.Class1;

            if (background == BackgroundType.Medic)
            {
                interval *= 0.5f;
            }

            string data = (int)interval + ", " + restoreAmount;

            CustomEffectService.ApplyCustomEffect(user, target.Object, CustomEffectType.ForcePack, (int)duration, restoreAmount, data);

            player.SendMessage("You successfully apply a force pack to " + target.Name + ". The force pack will expire in " + duration + " seconds.");

            _.DelayCommand(duration + 0.5f, () => { player.SendMessage("The force pack that you applied to " + target.Name + " has expired."); });

            int xp = (int)SkillService.CalculateRegisteredSkillLevelAdjustedXP(300, item.RecommendedLevel, rank);

            SkillService.GiveSkillXP(player, SkillType.Medicine, xp);
        }
示例#18
0
        public bool ReducesItemCharge(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            int            consumeChance = PerkService.GetCreaturePerkLevel((NWPlayer)user, PerkType.FrugalMedic) * 10;
            BackgroundType background    = (BackgroundType)user.Class1;

            if (background == BackgroundType.Medic)
            {
                consumeChance += 5;
            }


            return(RandomService.Random(100) + 1 > consumeChance);
        }
示例#19
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            // Mark the player as performing a recovery blast.
            // This is later picked up in the OnApplyDamage event to reduce all damage to 0.
            creature.SetLocalInt("RECOVERY_BLAST_ACTIVE", 1);

            var members = creature.PartyMembers.Where(x => _.GetDistanceBetween(x, target) <= 10.0f);
            int luck    = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);

            foreach (var member in members)
            {
                HealTarget(member, perkLevel, luck);
            }
        }
示例#20
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            float duration = 0.0f;

            switch (spellTier)
            {
                case 1:
                    duration = 6f;
                    break;
                case 2:
                    duration = 12f;
                    break;
                case 3:
                    duration = 18f;
                    break;
                case 4:
                    duration = 24f;
                    break;
            }

            var result = CombatService.CalculateAbilityResistance(creature, target.Object, SkillType.ForceAlter, ForceBalanceType.Universal);


            // Resisted - Only apply slow for six seconds
            if (result.IsResisted)
            {
                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectSlow(), target, 6.0f);
            }

            // Not resisted - Apply knockdown for the specified duration
            else
            {
                // Check lucky chance.
                int luck = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky);
                if (RandomService.D100(1) <= luck)
                {
                    duration *= 2;
                    creature.SendMessage("Lucky Force Push!");
                }

                _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectKnockdown(), target, duration);
            }

            if (creature.IsPlayer)
            {
                SkillService.RegisterPCToAllCombatTargetsForSkill(creature.Object, SkillType.ForceAlter, target.Object);
            }
            
            _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, _.EffectVisualEffect(_.VFX_COM_BLOOD_SPARK_SMALL), target);
        }
示例#21
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer player         = (user.Object);
            var      effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(player);

            if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(player, PerkType.SpeedyFirstAid) * 10)
            {
                return(0.1f);
            }

            int rank = SkillService.GetPCSkillRank(player, SkillType.Medicine);

            return(12.0f - (rank + effectiveStats.Medicine / 2) * 0.1f);
        }
示例#22
0
        public void OnImpact(NWCreature creature, NWObject target, int perkLevel, int spellTier)
        {
            int chance;
            int amount;

            switch (perkLevel)
            {
            case 1:
                chance = 50;
                amount = 1;
                break;

            case 2:
                chance = 50;
                amount = 2;
                break;

            case 3:
                chance = 50;
                amount = 3;
                break;

            case 4:
                chance = 75;
                amount = 3;
                break;

            case 5:
                chance = 75;
                amount = 4;
                break;

            default:
                return;
            }

            if (creature.IsPlayer)
            {
                var effectiveStats = PlayerStatService.GetPlayerItemEffectiveStats(creature.Object);
                int luck           = PerkService.GetCreaturePerkLevel(creature, PerkType.Lucky) + effectiveStats.Luck;
                chance += luck;
            }

            if (RandomService.Random(100) + 1 <= chance)
            {
                Effect heal = _.EffectHeal(amount);
                _.ApplyEffectToObject(_.DURATION_TYPE_INSTANT, heal, creature.Object);
            }
        }
示例#23
0
        private void StartSmelt(NWPlaceable forge, NWPlayer pc, NWItem item)
        {
            int charges = forge.GetLocalInt("FORGE_CHARGES");

            if (item.Resref == "power_core")
            {
                item.Destroy();
                charges += 10 + CalculatePerkCoalBonusCharges(pc) + GetPowerCoreDurability(item) * 2;
                forge.SetLocalInt("FORGE_CHARGES", charges);

                NWPlaceable flames = (forge.GetLocalObject("FORGE_FLAMES"));
                if (!flames.IsValid)
                {
                    Vector   flamePosition = BiowarePosition.GetChangedPosition(forge.Position, 0.36f, forge.Facing);
                    Location flameLocation = _.Location(forge.Area.Object, flamePosition, 0.0f);
                    flames = (_.CreateObject(_.OBJECT_TYPE_PLACEABLE, "forge_flame", flameLocation));
                    forge.SetLocalObject("FORGE_FLAMES", flames.Object);
                }

                return;
            }
            else if (charges <= 0)
            {
                ReturnItemToPC(pc, item, "You must power the refinery with a power unit before refining.");
                return;
            }

            // Ready to smelt
            float baseCraftDelay = 18.0f - (18.0f * PerkService.GetCreaturePerkLevel(pc, PerkType.SpeedyRefining) * 0.1f);

            pc.IsBusy = true;
            NWNXPlayer.StartGuiTimingBar(pc, baseCraftDelay, string.Empty);

            // Any component bonuses on the ore get applied to the end product.
            var itemProperties = item.ItemProperties.Where(x =>
                                                           _.GetItemPropertyType(x) == (int)CustomItemPropertyType.ComponentBonus ||
                                                           _.GetItemPropertyType(x) == (int)CustomItemPropertyType.RecommendedLevel).ToList();

            string itemResref = item.Resref;

            var @event = new OnCompleteSmelt(pc, itemResref, itemProperties);

            pc.DelayEvent(baseCraftDelay, @event);

            _.ApplyEffectToObject(_.DURATION_TYPE_TEMPORARY, _.EffectCutsceneImmobilize(), pc.Object, baseCraftDelay);
            pc.AssignCommand(() => _.ActionPlayAnimation(_.ANIMATION_LOOPING_GET_MID, 1.0f, baseCraftDelay));
            item.Destroy();
        }
示例#24
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            NWPlayer userPlayer = (user.Object);
            NWItem   targetItem = (target.Object);
            float    perkBonus  = 0.0f;

            perkBonus = PerkService.GetCreaturePerkLevel(userPlayer, PerkType.SpeedyCrafting) * 0.1f;

            float seconds = 18.0f - (18.0f * perkBonus);

            if (seconds <= 0.1f)
            {
                seconds = 0.1f;
            }
            return(seconds);
        }
示例#25
0
        public float CooldownTime(NWCreature oPC, float baseCooldownTime, int spellTier)
        {
            int   perkRank = PerkService.GetCreaturePerkLevel(oPC, PerkType.SneakAttack);
            float cooldown = baseCooldownTime;

            if (perkRank == 2)
            {
                cooldown -= 30f;
            }
            else if (perkRank > 2)
            {
                cooldown -= 60f;
            }

            return(cooldown);
        }
示例#26
0
        public float Seconds(NWCreature user, NWItem item, NWObject target, Location targetLocation, CustomData customData)
        {
            if (RandomService.Random(100) + 1 <= PerkService.GetCreaturePerkLevel(user.Object, PerkType.SpeedyFirstAid) * 10)
            {
                return(0.1f);
            }

            int   rank    = SkillService.GetPCSkillRank(user.Object, SkillType.Medicine);
            float seconds = 6.0f - (rank * 0.2f);

            if (seconds < 1.0f)
            {
                seconds = 1.0f;
            }
            return(seconds);
        }
示例#27
0
        private void ApplyFeatChanges(NWCreature creature, NWItem oItem)
        {
            NWItem mainEquipped = oItem ?? creature.RightHand;
            NWItem offEquipped  = oItem ?? creature.LeftHand;

            // oItem was unequipped.
            if (Equals(mainEquipped, oItem) || Equals(offEquipped, oItem))
            {
                RemoveFeats(creature);
                return;
            }

            // Main or offhand was invalid (i.e not equipped)
            if (!mainEquipped.IsValid || !offEquipped.IsValid)
            {
                RemoveFeats(creature);
                return;
            }

            // Main or offhand is not acceptable item type.
            if (mainEquipped.CustomItemType != CustomItemType.Vibroblade &&
                mainEquipped.CustomItemType != CustomItemType.Baton &&
                mainEquipped.CustomItemType != CustomItemType.FinesseVibroblade ||
                offEquipped.CustomItemType != CustomItemType.Vibroblade &&
                offEquipped.CustomItemType != CustomItemType.Baton &&
                offEquipped.CustomItemType != CustomItemType.FinesseVibroblade)
            {
                RemoveFeats(creature);
                return;
            }


            int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.OneHandedDualWielding);

            NWNXCreature.AddFeat(creature, Feat.TwoWeaponFighting);

            if (perkLevel >= 2)
            {
                NWNXCreature.AddFeat(creature, Feat.Ambidexterity);
            }
            if (perkLevel >= 3)
            {
                NWNXCreature.AddFeat(creature, Feat.ImprovedTwoWeaponFighting);
            }
        }
示例#28
0
        private void ApplyFeatChanges(NWCreature creature, NWItem oItem)
        {
            NWItem mainEquipped = oItem ?? creature.RightHand;
            NWItem offEquipped  = oItem ?? creature.LeftHand;

            // oItem was unequipped.
            if (Equals(mainEquipped, oItem) || Equals(offEquipped, oItem))
            {
                RemoveFeats(creature);
                return;
            }

            // Main or offhand was invalid (i.e not equipped)
            if (!mainEquipped.IsValid || !offEquipped.IsValid)
            {
                RemoveFeats(creature);
                return;
            }

            // Main or offhand is not acceptable item type.
            if (mainEquipped.CustomItemType != CustomItemType.Vibroblade &&
                mainEquipped.CustomItemType != CustomItemType.Baton &&
                mainEquipped.CustomItemType != CustomItemType.FinesseVibroblade ||
                offEquipped.CustomItemType != CustomItemType.Vibroblade &&
                offEquipped.CustomItemType != CustomItemType.Baton &&
                offEquipped.CustomItemType != CustomItemType.FinesseVibroblade)
            {
                RemoveFeats(creature);
                return;
            }


            int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.OneHandedDualWielding);

            NWNXCreature.AddFeat(creature, FEAT_TWO_WEAPON_FIGHTING);

            if (perkLevel >= 2)
            {
                NWNXCreature.AddFeat(creature, FEAT_AMBIDEXTERITY);
            }
            if (perkLevel >= 3)
            {
                NWNXCreature.AddFeat(creature, FEAT_IMPROVED_TWO_WEAPON_FIGHTING);
            }
        }
示例#29
0
        public float CooldownTime(NWCreature oPC, float baseCooldownTime, int spellTier)
        {
            int perkRank = PerkService.GetCreaturePerkLevel(oPC, PerkType.Provoke);

            if (perkRank == 2)
            {
                baseCooldownTime -= 5.0f;
            }
            else if (perkRank == 3)
            {
                baseCooldownTime -= 10.0f;
            }
            else if (perkRank == 4)
            {
                baseCooldownTime -= 15.0f;
            }

            return(baseCooldownTime);
        }
示例#30
0
        private void ApplyFeatChanges(NWCreature creature, NWItem oItem)
        {
            NWItem mainEquipped = oItem ?? creature.RightHand;
            NWItem offEquipped  = oItem ?? creature.LeftHand;

            // oItem was unequipped.
            if (Equals(mainEquipped, oItem) || Equals(offEquipped, oItem))
            {
                RemoveFeats(creature);
                return;
            }

            // Main or offhand was invalid (i.e not equipped)
            if (!mainEquipped.IsValid || !offEquipped.IsValid)
            {
                RemoveFeats(creature);
                return;
            }

            // Main or offhand is not acceptable item type.
            if ((mainEquipped.CustomItemType != CustomItemType.Lightsaber &&
                 GetLocalBool(mainEquipped, "LIGHTSABER") == false) ||
                (offEquipped.CustomItemType != CustomItemType.Lightsaber &&
                 GetLocalBool(offEquipped, "LIGHTSABER") == false))
            {
                RemoveFeats(creature);
                return;
            }


            int perkLevel = PerkService.GetCreaturePerkLevel(creature, PerkType.LightsaberDualWielding);

            NWNXCreature.AddFeat(creature, Feat.TwoWeaponFighting);

            if (perkLevel >= 2)
            {
                NWNXCreature.AddFeat(creature, Feat.Ambidexterity);
            }
            if (perkLevel >= 3)
            {
                NWNXCreature.AddFeat(creature, Feat.ImprovedTwoWeaponFighting);
            }
        }