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); } }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Vibroblade) { 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.BladePowerAttack); NWNXCreature.AddFeat(creature, FEAT_POWER_ATTACK); if (perkLevel >= 2) { NWNXCreature.AddFeat(creature, FEAT_IMPROVED_POWER_ATTACK); } }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equipped = oItem ?? oPC.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Baton) { NWNXCreature.RemoveFeat(oPC, FEAT_POWER_ATTACK); NWNXCreature.RemoveFeat(oPC, FEAT_IMPROVED_POWER_ATTACK); if (_.GetActionMode(oPC, ACTION_MODE_POWER_ATTACK) == TRUE) { _.SetActionMode(oPC, ACTION_MODE_POWER_ATTACK, FALSE); } if (_.GetActionMode(oPC, ACTION_MODE_IMPROVED_POWER_ATTACK) == TRUE) { _.SetActionMode(oPC, ACTION_MODE_IMPROVED_POWER_ATTACK, FALSE); } return; } int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.BluntPowerAttack); NWNXCreature.AddFeat(oPC, FEAT_POWER_ATTACK); if (perkLevel >= 2) { NWNXCreature.AddFeat(oPC, FEAT_IMPROVED_POWER_ATTACK); } }
private void InitializeSkills(NWGameObject player) { for (int iCurSkill = 1; iCurSkill <= 27; iCurSkill++) { NWNXCreature.SetSkillRank(player, iCurSkill - 1, 0); } }
public static void Apply(NWGameObject player) { var playerID = _.GetGlobalID(player); var jobType = _.GetClassByPosition(ClassPosition.First, player); var jobDefinition = JobRegistry.Get(jobType); var job = JobRepo.Get(playerID, jobType); var abilityList = jobDefinition.GetAbilityListByLevel(job.Level); var allFeats = new List <Feat>(DefaultFeats); allFeats.AddRange(abilityList); // Remove any feats the player shouldn't have. var featCount = NWNXCreature.GetFeatCount(player); for (int x = featCount; x >= 0; x--) { var feat = NWNXCreature.GetFeatByIndex(player, x - 1); if (!allFeats.Contains(feat)) { NWNXCreature.RemoveFeat(player, feat); } } // Add any feats the player needs. foreach (var feat in allFeats) { if (_.GetHasFeat(feat, player)) { continue; } NWNXCreature.AddFeatByLevel(player, feat, 1); } }
private void ApplyFeatChanges(NWPlayer oPC, NWItem unequippingItem) { NWItem mainHand = oPC.RightHand; NWItem offHand = oPC.LeftHand; CustomItemType mainType = mainHand.CustomItemType; CustomItemType offType = offHand.CustomItemType; bool receivesFeat = true; if (unequippingItem != null && Equals(unequippingItem, mainHand)) { mainHand = (new Object()); } else if (unequippingItem != null && Equals(unequippingItem, offHand)) { offHand = (new Object()); } if ((!mainHand.IsValid && !offHand.IsValid) || (mainType != CustomItemType.MartialArtWeapon || offType != CustomItemType.MartialArtWeapon)) { receivesFeat = false; } if (receivesFeat) { NWNXCreature.AddFeat(oPC, _.FEAT_CIRCLE_KICK); } else { NWNXCreature.RemoveFeat(oPC, _.FEAT_CIRCLE_KICK); } }
private void RemovePerkFeat(Data.Entity.Perk perk) { var feats = DataService.PerkFeat.GetAllByPerkID(perk.ID); foreach (var feat in feats) { NWNXCreature.RemoveFeat(GetPC(), feat.FeatID); } }
private void RemovePerkFeat(Data.Entity.Perk perk) { var feats = DataService.Where <PerkFeat>(x => x.PerkID == perk.ID); foreach (var feat in feats) { NWNXCreature.RemoveFeat(GetPC(), feat.FeatID); } }
private void RemoveNWNSpells(NWGameObject player) { var @class = GetClassByPosition(ClassPosition.First, player); for (int index = 0; index <= 255; index++) { NWNXCreature.RemoveKnownSpell(player, @class, 0, index); } }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || (equipped.CustomItemType != CustomItemType.Lightsaber && equipped.CustomItemType != CustomItemType.Saberstaff && equipped.GetLocalInt("LIGHTSABER") == FALSE)) { NWNXCreature.RemoveFeat(creature, _.FEAT_WEAPON_FINESSE); return; } NWNXCreature.AddFeat(creature, _.FEAT_WEAPON_FINESSE); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || (equipped.CustomItemType != CustomItemType.Lightsaber && equipped.CustomItemType != CustomItemType.Saberstaff && equipped.GetLocalBool("LIGHTSABER") == false)) { NWNXCreature.RemoveFeat(creature, Feat.WeaponFinesse); return; } NWNXCreature.AddFeat(creature, Feat.WeaponFinesse); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.Chest; if (equipped.Equals(oItem) || equipped.CustomItemType != CustomItemType.HeavyArmor) { NWNXCreature.RemoveFeat(creature, _.FEAT_EXPERTISE); return; } NWNXCreature.AddFeat(creature, _.FEAT_EXPERTISE); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.Chest; if (equipped.Equals(oItem) || equipped.CustomItemType != CustomItemType.HeavyArmor) { NWNXCreature.RemoveFeat(creature, (int)CustomFeatType.Provoke); return; } NWNXCreature.AddFeat(creature, (int)CustomFeatType.Provoke); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equipped = oItem ?? oPC.Chest; if (equipped.Equals(oItem) || equipped.CustomItemType != CustomItemType.LightArmor) { NWNXCreature.RemoveFeat(oPC, _.FEAT_DODGE); return; } NWNXCreature.AddFeat(oPC, _.FEAT_DODGE); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equipped = oItem ?? oPC.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.FinesseVibroblade) { NWNXCreature.RemoveFeat(oPC, FEAT_CALLED_SHOT); return; } NWNXCreature.AddFeat(oPC, FEAT_CALLED_SHOT); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equipped = oItem ?? oPC.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.HeavyVibroblade) { NWNXCreature.RemoveFeat(oPC, _.FEAT_CLEAVE); return; } NWNXCreature.AddFeat(oPC, _.FEAT_CLEAVE); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.Chest; if (equipped.Equals(oItem) || equipped.CustomItemType != CustomItemType.LightArmor) { NWNXCreature.RemoveFeat(creature, Feat.Mobility); return; } NWNXCreature.AddFeat(creature, Feat.Mobility); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.FinesseVibroblade) { NWNXCreature.RemoveFeat(creature, Feat.CalledShot); return; } NWNXCreature.AddFeat(creature, Feat.CalledShot); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Throwing) { NWNXCreature.RemoveFeat(creature, Feat.ZenArchery); return; } NWNXCreature.AddFeat(creature, Feat.ZenArchery); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equippedWeapon = oItem ?? creature.RightHand; if (Equals(equippedWeapon, oItem) || equippedWeapon.CustomItemType != CustomItemType.Throwing) { NWNXCreature.RemoveFeat(creature, Feat.RapidShot); return; } NWNXCreature.AddFeat(creature, Feat.RapidShot); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equipped = oItem ?? oPC.RightHand; if (Equals(equipped, oItem) || equipped.CustomItemType != CustomItemType.Throwing) { NWNXCreature.RemoveFeat(oPC, _.FEAT_ZEN_ARCHERY); return; } NWNXCreature.AddFeat(oPC, _.FEAT_ZEN_ARCHERY); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equipped = oItem ?? creature.RightHand; if (equipped.Equals(oItem) || (equipped.CustomItemType != CustomItemType.BlasterPistol && equipped.CustomItemType != CustomItemType.BlasterRifle)) { NWNXCreature.RemoveFeat(creature, _.FEAT_ZEN_ARCHERY); return; } NWNXCreature.AddFeat(creature, _.FEAT_ZEN_ARCHERY); }
/// <summary> /// Looks at the creature's feats and if any of them are Perks, stores the highest /// level as a local variable on the creature. This variable is later used when the /// creature actually uses the feat. /// Also registers all of the available PerkFeats (highest tier) on the creature's Data. /// This data is also used in the AI to make decisions quicker. /// </summary> /// <param name="self">The creature whose perks we're registering.</param> private static void RegisterCreaturePerks(NWCreature self) { var perkFeatCache = new Dictionary <int, AIPerkDetails>(); var featIDs = new List <int>(); // Add all feats the creature has to the list. int featCount = NWNXCreature.GetFeatCount(self); for (int x = 0; x <= featCount - 1; x++) { var featID = NWNXCreature.GetFeatByIndex(self, x); featIDs.Add((int)featID); } bool hasPerkFeat = false; // Retrieve perk feat information for only those feats registered as a perk. var perkFeats = DataService.PerkFeat.GetAllByIDs(featIDs); // Mark the highest perk level on the creature. foreach (var perkFeat in perkFeats) { int level = self.GetLocalInt("PERK_LEVEL_" + perkFeat.PerkID); if (level >= perkFeat.PerkLevelUnlocked) { continue; } var perk = DataService.Perk.GetByID(perkFeat.PerkID); self.SetLocalInt("PERK_LEVEL_" + perkFeat.PerkID, perkFeat.PerkLevelUnlocked); perkFeatCache[perkFeat.PerkID] = new AIPerkDetails(perkFeat.FeatID, perk.ExecutionTypeID); hasPerkFeat = true; } // If a builder sets a perk feat but forgets to set the FP, do it automatically. if (hasPerkFeat && self.GetLocalInt("MAX_FP") <= 0) { int fp = 50; fp += (self.IntelligenceModifier + self.WisdomModifier + self.CharismaModifier) * 5; SetMaxFP(self, fp); SetCurrentFP(self, fp); } if (hasPerkFeat) { // Store a new dictionary containing PerkID and FeatID onto the creature's data. // This is later used in the AI processing for decision making. self.Data["PERK_FEATS"] = perkFeatCache; } }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem equippedArmor = oItem ?? creature.Chest; NWItem equippedWeapon = oItem ?? creature.RightHand; if (equippedArmor.Equals(oItem) || equippedWeapon.Equals(oItem) || equippedArmor.CustomItemType != CustomItemType.LightArmor || equippedWeapon.CustomItemType != CustomItemType.BlasterPistol) { NWNXCreature.RemoveFeat(creature, _.FEAT_RAPID_SHOT); return; } NWNXCreature.AddFeat(creature, _.FEAT_RAPID_SHOT); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem equippedArmor = oItem ?? oPC.Chest; NWItem equippedWeapon = oItem ?? oPC.RightHand; if (Equals(equippedArmor, oItem) || Equals(equippedWeapon, oItem) || equippedArmor.CustomItemType != CustomItemType.LightArmor || equippedWeapon.CustomItemType != CustomItemType.Throwing) { NWNXCreature.RemoveFeat(oPC, _.FEAT_RAPID_SHOT); return; } NWNXCreature.AddFeat(oPC, _.FEAT_RAPID_SHOT); }
public static void Main() { var data = Script.GetScriptData <JobChanged>(); var newJob = data.NewJob; var player = data.Player; var playerID = GetGlobalID(player); var playerEntity = PlayerRepo.Get(playerID); var jobEntity = JobRepo.Get(playerID, newJob); playerEntity.CurrentJob = newJob; NWNXCreature.SetClassByPosition(player, ClassPosition.First, newJob); NWNXCreature.SetLevelByPosition(player, ClassPosition.First, jobEntity.Level); SetXP(player, jobEntity.XP); PlayerRepo.Set(playerEntity); }
private void ApplyFeatChanges(NWCreature creature, NWItem oItem) { NWItem armor = oItem ?? creature.Chest; if (armor.BaseItemType != BASE_ITEM_ARMOR) { return; } if (Equals(armor, oItem) || armor.CustomItemType != CustomItemType.LightArmor) { NWNXCreature.RemoveFeat(creature, FEAT_POINT_BLANK_SHOT); return; } NWNXCreature.AddFeat(creature, FEAT_POINT_BLANK_SHOT); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem armor = oItem ?? oPC.Chest; if (armor.BaseItemType != _.BASE_ITEM_ARMOR) { return; } if (Equals(armor, oItem) || armor.CustomItemType != CustomItemType.LightArmor) { NWNXCreature.RemoveFeat(oPC, _.FEAT_RAPID_RELOAD); return; } NWNXCreature.AddFeat(oPC, _.FEAT_RAPID_RELOAD); }
private void ApplyFeatChanges(NWPlayer oPC, NWItem oItem) { NWItem mainEquipped = oItem ?? oPC.RightHand; NWItem offEquipped = oItem ?? oPC.LeftHand; // oItem was unequipped. if (Equals(mainEquipped, oItem) || Equals(offEquipped, oItem)) { RemoveFeats(oPC); return; } // Main or offhand was invalid (i.e not equipped) if (!mainEquipped.IsValid || !offEquipped.IsValid) { RemoveFeats(oPC); 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(oPC); return; } int perkLevel = PerkService.GetPCPerkLevel(oPC, PerkType.OneHandedDualWielding); NWNXCreature.AddFeat(oPC, FEAT_TWO_WEAPON_FIGHTING); if (perkLevel >= 2) { NWNXCreature.AddFeat(oPC, FEAT_AMBIDEXTERITY); } if (perkLevel >= 3) { NWNXCreature.AddFeat(oPC, FEAT_IMPROVED_TWO_WEAPON_FIGHTING); } }
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); } }