示例#1
0
        public void Apply(NWCreature oCaster, NWObject oTarget)
        {
            Random random = new Random();

            Effect effect = _.EffectAbilityDecrease(ABILITY_STRENGTH, random.Next(1, 5));

            effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_CONSTITUTION, random.Next(1, 5)));
            effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_DEXTERITY, random.Next(1, 5)));
            effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_INTELLIGENCE, random.Next(1, 5)));
            effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_WISDOM, random.Next(1, 5)));
            effect = _.EffectLinkEffects(effect, _.EffectAbilityDecrease(ABILITY_CHARISMA, random.Next(1, 5)));

            effect = _.TagEffect(effect, "FOOD_DISEASE_EFFECT");
            _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, effect, oTarget.Object);

            _skill.ApplyStatChanges(NWPlayer.Wrap(oTarget.Object), null);
        }
示例#2
0
        public void OnImpact(NWPlayer oPC, NWObject oTarget)
        {
            int level = _perk.GetPCPerkLevel(oPC, PerkType.Aegis);
            int ticks;

            switch (level)
            {
            case 1:
            case 2:
                ticks = 10;
                break;

            case 3:
            case 4:
            case 5:
                ticks = 50;
                break;

            default: return;
            }

            int luck = _perk.GetPCPerkLevel(oPC, PerkType.Lucky) + oPC.EffectiveLuckBonus;

            if (_random.Random(100) + 1 <= luck)
            {
                ticks = ticks * 2;
            }

            int wisdom          = oPC.WisdomModifier;
            int intelligence    = oPC.IntelligenceModifier;
            int alterationBonus = oPC.EffectiveAlterationBonus / 2;

            ticks = ticks + intelligence + (wisdom * 2) + alterationBonus;

            _customEffect.ApplyCustomEffect(oPC, (NWPlayer)oTarget, CustomEffectType.Aegis, ticks, level);
            _skill.ApplyStatChanges((NWPlayer)oTarget, null);
            _skill.RegisterPCToAllCombatTargetsForSkill(oPC, SkillType.AlterationMagic);

            Effect vfx = _.EffectVisualEffect(VFX_IMP_AC_BONUS);

            _.ApplyEffectToObject(DURATION_TYPE_INSTANT, vfx, oTarget.Object);
        }
示例#3
0
 public void OnPurchased(NWPlayer oPC, int newLevel)
 {
     _skill.ApplyStatChanges(oPC, null);
 }
示例#4
0
        public void InitializePlayer(NWPlayer player)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }
            if (player.Object == null)
            {
                throw new ArgumentNullException(nameof(player.Object));
            }

            if (!player.IsPlayer)
            {
                return;
            }

            if (!player.IsInitializedAsPlayer)
            {
                player.DestroyAllInventoryItems();
                player.InitializePlayer();

                _.CreateItemOnObject("open_rest_menu", player.Object);
                _.AssignCommand(player.Object, () => _.TakeGoldFromCreature(_.GetGold(player.Object), player.Object, 1));

                NWItem knife = NWItem.Wrap(_.CreateItemOnObject("survival_knife", player.Object));
                knife.Name          = player.Name + "'s Survival Knife";
                knife.IsCursed      = true;
                knife.MaxDurability = 5;
                knife.Durability    = 5;

                NWItem hammer = NWItem.Wrap(_.CreateItemOnObject("basic_hammer", player.Object));
                hammer.Name          = player.Name + "'s Hammer";
                hammer.IsCursed      = true;
                hammer.MaxDurability = 5;
                hammer.Durability    = 5;

                NWItem darts = NWItem.Wrap(_.CreateItemOnObject("nw_wthdt001", player.Object, 50)); // 50x Dart
                darts.Name     = "Starting Darts";
                darts.IsCursed = true;

                NWItem book = NWItem.Wrap(_.CreateItemOnObject("player_guide", player.Object));
                book.Name     = player.Name + "'s Player Guide";
                book.IsCursed = true;

                NWItem dyeKit = NWItem.Wrap(_.CreateItemOnObject("tk_omnidye", player.Object));
                dyeKit.IsCursed = true;

                NWItem shovel = NWItem.Wrap(_.CreateItemOnObject("basic_shovel", player.Object));
                shovel.Name     = player.Name + "'s Shovel";
                shovel.IsCursed = true;

                int numberOfFeats = _nwnxCreature.GetFeatCount(player);
                for (int currentFeat = numberOfFeats; currentFeat >= 0; currentFeat--)
                {
                    _nwnxCreature.RemoveFeat(player, _nwnxCreature.GetFeatByIndex(player, currentFeat - 1));
                }

                _nwnxCreature.SetClassByPosition(player, 0, CLASS_TYPE_FIGHTER);
                _nwnxCreature.AddFeatByLevel(player, FEAT_ARMOR_PROFICIENCY_LIGHT, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_ARMOR_PROFICIENCY_MEDIUM, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_ARMOR_PROFICIENCY_HEAVY, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_SHIELD_PROFICIENCY, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_WEAPON_PROFICIENCY_EXOTIC, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_WEAPON_PROFICIENCY_MARTIAL, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_WEAPON_PROFICIENCY_SIMPLE, 1);

                for (int iCurSkill = 1; iCurSkill <= 27; iCurSkill++)
                {
                    _nwnxCreature.SetSkillRank(player, iCurSkill - 1, 0);
                }
                _.SetFortitudeSavingThrow(player.Object, 0);
                _.SetReflexSavingThrow(player.Object, 0);
                _.SetWillSavingThrow(player.Object, 0);

                int classID = _.GetClassByPosition(1, player.Object);

                for (int index = 0; index <= 255; index++)
                {
                    _nwnxCreature.RemoveKnownSpell(player, classID, 0, index);
                }

                using (DataContext context = new DataContext())
                {
                    PlayerCharacter entity = player.ToEntity();
                    context.PlayerCharacters.Add(entity);
                    context.SaveChanges();
                }

                _skill.ApplyStatChanges(player, null);

                _.DelayCommand(1000, () => _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(999), player.Object));

                InitializeHotBar(player);
            }
        }
示例#5
0
        private void ApplyBackgroundBonuses(NWPlayer oPC, int backgroundID)
        {
            string          pcName   = oPC.Name;
            PlayerCharacter pcEntity = _db.PlayerCharacters.Single(x => x.PlayerID == oPC.GlobalID);

            string item1Resref   = "";
            int    item1Quantity = 1;
            string item2Resref   = "";
            int    item2Quantity = 1;

            switch ((BackgroundType)backgroundID)
            {
            case BackgroundType.Weaponsmith:
                _perk.DoPerkUpgrade(oPC, PerkType.WeaponBlueprints);
                break;

            case BackgroundType.Armorsmith:
                _perk.DoPerkUpgrade(oPC, PerkType.ArmorBlueprints);
                break;

            case BackgroundType.Knight:
                item1Resref = "bkg_knightarmor";
                break;

            case BackgroundType.Wizard:
                _perk.DoPerkUpgrade(oPC, PerkType.FireBlast);
                break;

            case BackgroundType.Cleric:
                _perk.DoPerkUpgrade(oPC, PerkType.Recover);
                break;

            case BackgroundType.Gunslinger:
                item1Resref   = "bkg_gunblaster";
                item2Resref   = "blaster_bullets";
                item2Quantity = 99;
                break;

            case BackgroundType.Rifleman:
                item1Resref   = "bkg_rifleman";
                item2Resref   = "rifle_bullets";
                item2Quantity = 99;
                break;

            case BackgroundType.Chef:
                _perk.DoPerkUpgrade(oPC, PerkType.FoodRecipes);
                break;

            case BackgroundType.Engineer:
                _perk.DoPerkUpgrade(oPC, PerkType.EngineeringBlueprints);
                break;

            case BackgroundType.Vagabond:
                pcEntity.UnallocatedSP = pcEntity.UnallocatedSP + 3;
                _db.SaveChanges();
                break;

            case BackgroundType.Guard:
                item1Resref = "bkg_guardlgswd";
                item2Resref = "bkg_guardshld";
                break;

            case BackgroundType.Berserker:
                item1Resref = "bkg_bersgswd";
                break;

            case BackgroundType.TwinBladeSpecialist:
                item1Resref = "bkg_spectwinbld";
                break;

            case BackgroundType.MartialArtist:
                item1Resref   = "bkg_mrtlglove";
                item2Resref   = "bkg_mtlshuriken";
                item2Quantity = 50;
                break;

            case BackgroundType.Miner:
                _perk.DoPerkUpgrade(oPC, PerkType.Miner);
                _perk.DoPerkUpgrade(oPC, PerkType.Miner);
                break;

            case BackgroundType.Lumberjack:
                _perk.DoPerkUpgrade(oPC, PerkType.Lumberjack);
                _perk.DoPerkUpgrade(oPC, PerkType.Lumberjack);
                break;

            case BackgroundType.ConstructionBuilder:
                _perk.DoPerkUpgrade(oPC, PerkType.VanityBlueprints);
                break;

            case BackgroundType.Medic:
                _perk.DoPerkUpgrade(oPC, PerkType.HealingKitExpert);
                _perk.DoPerkUpgrade(oPC, PerkType.ImmediateImprovement);
                break;

            case BackgroundType.Farmer:
                _perk.DoPerkUpgrade(oPC, PerkType.ExpertFarmer);
                break;
            }

            if (!string.IsNullOrWhiteSpace(item1Resref))
            {
                NWItem oItem1 = NWItem.Wrap(_.CreateItemOnObject(item1Resref, oPC.Object, item1Quantity));
                oItem1.IsCursed = true;
                oItem1.Name     = pcName + "'s " + oItem1.Name;
            }
            if (!string.IsNullOrWhiteSpace(item2Resref))
            {
                NWItem oItem2 = NWItem.Wrap(_.CreateItemOnObject(item2Resref, oPC.Object, item2Quantity, ""));
                oItem2.IsCursed = true;
                oItem2.Name     = pcName + "'s " + oItem2.Name;
            }

            _skill.ApplyStatChanges(oPC, null);
        }
示例#6
0
        public void InitializePlayer(NWPlayer player)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }
            if (player.Object == null)
            {
                throw new ArgumentNullException(nameof(player.Object));
            }
            if (!player.IsPlayer)
            {
                return;
            }

            if (!player.IsInitializedAsPlayer)
            {
                player.DestroyAllInventoryItems();
                player.InitializePlayer();
                _.AssignCommand(player.Object, () => _.TakeGoldFromCreature(_.GetGold(player.Object), player.Object, 1));

                player.DelayCommand(() =>
                {
                    _.GiveGoldToCreature(player.Object, 100);
                }, 0.5f);


                NWItem knife = NWItem.Wrap(_.CreateItemOnObject("survival_knife", player.Object));
                knife.Name          = player.Name + "'s Survival Knife";
                knife.IsCursed      = true;
                knife.MaxDurability = 5;
                knife.Durability    = 5;

                NWItem darts = NWItem.Wrap(_.CreateItemOnObject("nw_wthdt001", player.Object, 50)); // 50x Dart
                darts.Name     = "Starting Darts";
                darts.IsCursed = true;

                NWItem book = NWItem.Wrap(_.CreateItemOnObject("player_guide", player.Object));
                book.Name     = player.Name + "'s Player Guide";
                book.IsCursed = true;

                NWItem dyeKit = NWItem.Wrap(_.CreateItemOnObject("tk_omnidye", player.Object));
                dyeKit.IsCursed = true;

                int numberOfFeats = _nwnxCreature.GetFeatCount(player);
                for (int currentFeat = numberOfFeats; currentFeat >= 0; currentFeat--)
                {
                    _nwnxCreature.RemoveFeat(player, _nwnxCreature.GetFeatByIndex(player, currentFeat - 1));
                }

                _nwnxCreature.SetClassByPosition(player, 0, CLASS_TYPE_FIGHTER);
                _nwnxCreature.AddFeatByLevel(player, FEAT_ARMOR_PROFICIENCY_LIGHT, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_ARMOR_PROFICIENCY_MEDIUM, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_ARMOR_PROFICIENCY_HEAVY, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_SHIELD_PROFICIENCY, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_WEAPON_PROFICIENCY_EXOTIC, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_WEAPON_PROFICIENCY_MARTIAL, 1);
                _nwnxCreature.AddFeatByLevel(player, FEAT_WEAPON_PROFICIENCY_SIMPLE, 1);
                _nwnxCreature.AddFeatByLevel(player, (int)CustomFeatType.StructureTool, 1);
                _nwnxCreature.AddFeatByLevel(player, (int)CustomFeatType.OpenRestMenu, 1);

                for (int iCurSkill = 1; iCurSkill <= 27; iCurSkill++)
                {
                    _nwnxCreature.SetSkillRank(player, iCurSkill - 1, 0);
                }
                _.SetFortitudeSavingThrow(player.Object, 0);
                _.SetReflexSavingThrow(player.Object, 0);
                _.SetWillSavingThrow(player.Object, 0);

                int classID = _.GetClassByPosition(1, player.Object);

                for (int index = 0; index <= 255; index++)
                {
                    _nwnxCreature.RemoveKnownSpell(player, classID, 0, index);
                }

                PlayerCharacter entity = player.ToEntity();
                _db.PlayerCharacters.Add(entity);
                _db.SaveChanges();

                _db.StoredProcedure("InsertAllPCSkillsByID",
                                    new SqlParameter("PlayerID", player.GlobalID));

                _skill.ApplyStatChanges(player, null, true);

                _.DelayCommand(1.0f, () => _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectHeal(999), player.Object));

                InitializeHotBar(player);
            }
        }
示例#7
0
 public void Apply(NWCreature oCaster, NWObject oTarget)
 {
     _skill.ApplyStatChanges((NWPlayer)oTarget, null);
 }