private void RecursiveInitializeSkill(UIPanel panel, Node <SkillDefinition> node, ref int yOffset) { SkillDefinition skill = node.Value; Texture2D texture = skill.SkillIcon; if (!CheckIfDraw(skill)) { return; } int xOffset = (int)skill.MenuPosition.X; yOffset = (int)skill.MenuPosition.Y; DrawSkill(panel, skill, texture, xOffset, yOffset); for (int i = 0; i < node.Children.Count; i++) { Node <SkillDefinition> child = node.Children[i]; RecursiveInitializeSkill(panel, child, ref yOffset); if (node.Children.Count > 1 && CheckIfDraw(child) && node.Children[node.Children.Count - 1] != child) { yOffset += texture.Height + SMALL_SPACE * 2; } } }
private void DrawInfoPanel(SkillDefinition def, UIMouseEvent evt, UIElement listeningElement) { InfoPanel.RemoveAllChildren(); DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>(); if (dbtPlayer.ActiveSkills.Contains(def)) { EquipButtonTexture = AuthorMod.GetTexture(UNEQUIP_BUTTON); } else { EquipButtonTexture = AuthorMod.GetTexture(EQUIP_BUTTON); } DrawEquipButton(def); bool hasAttackSpeed = false; if (def.Characteristics.BaseShootSpeed > 0) { hasAttackSpeed = true; } skillName = InitializeText(def.DisplayName, 12, 8, 0.8f, Color.White, InfoPanel); skillStats = InitializeText("Stats: \nBase Ki Damage: " + def.Characteristics.BaseDamage + (hasAttackSpeed ? "\nAttack Speed: " + def.Characteristics.BaseShootSpeed : "") + " \nKi Drain: " + def.Characteristics.ChargeCharacteristics.BaseCastKiDrain + " \n", 12, 28, 0.6f, Color.White, InfoPanel); skillUnlock = InitializeText("Unlock: \n" + def.UnlockDescription, 340, 8, 0.7f, Color.White, InfoPanel); skillDescription = InitializeText("Skill Description: \n" + def.Description, 160, 8, 0.7f, Color.White, InfoPanel); }
private static SupportSkillParser CreateSut(SkillDefinition activeSkillDefinition, SkillDefinition supportSkillDefinition) { var statParser = Mock.Of <IParser <UntranslatedStatParserParameter> >(p => p.Parse(It.IsAny <UntranslatedStatParserParameter>()) == ParseResult.Empty); return(CreateSut(activeSkillDefinition, supportSkillDefinition, _ => statParser)); }
private static AdditionalSkillLevelParser CreateSut(bool isSpell = false, Dictionary <int, SkillLevelDefinition>?supportLevelDefinitions = null) { supportLevelDefinitions ??= new Dictionary <int, SkillLevelDefinition>(); var skillDefinitions = new SkillDefinitions(new[] { SkillDefinition.CreateActive("a", 0, "", "b", Array.Empty <string>(), new SkillBaseItemDefinition("a", "a", ReleaseState.Released, new[] { "g1", "g2", isSpell ? "spell" : "attack" }), CreateActiveSkillDefinition("a"), new Dictionary <int, SkillLevelDefinition>()), SkillDefinition.CreateActive("b", 1, "", null, Array.Empty <string>(), null, CreateActiveSkillDefinition("b"), new Dictionary <int, SkillLevelDefinition>()), SkillDefinition.CreateSupport("s1", 2, "", "s2", Array.Empty <string>(), new SkillBaseItemDefinition("s1", "s1", ReleaseState.Released, new[] { "g2", "g3" }), CreateSupportSkillDefinition(), supportLevelDefinitions), SkillDefinition.CreateSupport("s2", 3, "", null, Array.Empty <string>(), null, CreateSupportSkillDefinition(), supportLevelDefinitions), SkillDefinition.CreateSupport("s3", 4, "", null, Array.Empty <string>(), null, CreateSupportSkillDefinition(), supportLevelDefinitions), }); var statFactory = new StatFactory(); return(new AdditionalSkillLevelParser(skillDefinitions, new GemStatBuilders(statFactory), new GemTagBuilders(), new ValueBuilders(), new MetaStatBuilders(statFactory), new SkillBuilders(statFactory, skillDefinitions))); }
public static List <SkillDefinition> LoadSkills(string xmlfile) { List <SkillDefinition> skills = new List <SkillDefinition>(); XPathDocument doc = new XPathDocument(xmlfile); XPathNavigator nav = doc.CreateNavigator(); foreach (XPathNavigator n in nav.Select("/battle/skills/skill")) { string name = n.GetAttribute("name", ""); string descr = n.GetAttribute("description", ""); string cost = n.GetAttribute("cost", ""); string baseattr = n.GetAttribute("base", ""); SkillDefinition skill = new SkillDefinition(); skill.Name = name; skill.Description = descr; skill.BaseAbility = AbilityDefinition.ParseAbility(baseattr); skill.Expcost = int.Parse(cost); foreach (XPathNavigator n2 in n.Select("provides")) { skill.Provide(n2.GetAttribute("value", "")); } foreach (XPathNavigator n3 in n.Select("requires")) { skill.Require(n3.GetAttribute("value", "")); } skills.Add(skill); } return(skills); }
SkillDefinition GetSkillTemplate(string templateName) { SkillDefinition result = null; Skills.TryGetValue(templateName, out result); return(result); }
private static SkillDefinition CreateSkillDefinition(SkillDefinition skill) { // Note: we hard code this for now, we should dynamically create instances based on the manifests. // For now, this code creates a strong typed version of the SkillDefinition based on the skill group // and copies the info from settings into it. SkillDefinition skillDefinition; switch (skill.Group) { case "Echo": skillDefinition = ObjectPath.Assign <EchoSkill>(new EchoSkill(), skill); break; case "Waterfall": skillDefinition = ObjectPath.Assign <WaterfallSkill>(new WaterfallSkill(), skill); break; case "Teams": skillDefinition = ObjectPath.Assign <TeamsSkill>(new TeamsSkill(), skill); break; default: throw new Exception($"Unable to find definition class for {skill.Id}."); } return(skillDefinition); }
private void drawSpawnProbabilities() { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("SkillSet spawn probabilities", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(5); //Adjust the probability, if all probabilities together exceeds 100%. if (percentagesAdded > 100) { asset.values[skillIndexToDecrease] -= valueToDecreaseBy; } this.percentagesAdded = 0; //Set the skill to be decreased, to the skill with the biggest percentage this.skillIndexToDecrease = asset.values.IndexOf(asset.values.Max()); //Calculate the second biggest probability, in case the biggest skillProbability is being modified. int secondBiggestPercentageSkillIndex = asset.values.IndexOf(asset.values.Min()); SkillDefinition lastModified = asset.keys[0]; for (int i = 0; i < asset.keys.Count; i++) { //Create a new slider for the percentage asset.values[i] = EditorGUILayout.Slider(asset.keys[i].skillName, asset.values[i], 0, 100); //Get the skill with the second biggest percentage if (base.asset.values[i] > base.asset.values[secondBiggestPercentageSkillIndex] && i != skillIndexToDecrease) { secondBiggestPercentageSkillIndex = i; } //Get the skill which was last modified if (lastValues != null && lastValues.Count > i && base.asset.values[i] != lastValues[i]) { lastModified = base.asset.keys[i]; } // Add all percentages together percentagesAdded += base.asset.values[i]; } if (percentagesAdded > 100) { //Make sure, that the Slider which is currently being modified, does not decrease. if (lastModified == base.asset.keys[skillIndexToDecrease]) { skillIndexToDecrease = secondBiggestPercentageSkillIndex; } //Set the amount to decrease; this.valueToDecreaseBy = percentagesAdded - 100; } this.lastValues = new List <float>(asset.values); }
public void AcquireSkill(SkillDefinition definition) { if (!HasAcquiredSkill(definition)) { AcquiredSkills.Add(definition); CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), new Color(145, 228, 255), definition.DisplayName + " Unlocked!", true, false); } }
private static string SelectBuffIdentity(SkillDefinition skillDefinition) { if (skillDefinition.IsSupport || !skillDefinition.ActiveSkill.ProvidesBuff) { throw new ParseException($"{skillDefinition.Id} does not provide a buff"); } return(skillDefinition.Id); }
private static string SelectBuffIdentity(SkillDefinition skillDefinition) { if (!skillDefinition.ProvidesBuff) { throw new ParseException(""); } return(skillDefinition.SkillName); }
private static string SelectBuffIdentity(SkillDefinition skillDefinition) { if (skillDefinition.IsSupport || !skillDefinition.ActiveSkill.ProvidesBuff) { return("dummy"); } return(skillDefinition.Id); }
/// <summary> /// Create a new <see cref="SkillDefinition"/> at the given path. /// </summary> /// <param name="path">Path where the <see cref="SkillDefinition"/> will be saved</param> /// <returns></returns> public static SkillDefinition Create(string path) { SkillDefinition asset = ScriptableObject.CreateInstance <SkillDefinition>(); AssetDatabase.CreateAsset(asset, path); AssetDatabase.SaveAssets(); return(asset); }
public Skill(SkillDefinition definition) { SkillDefinition = definition; Owner = null; SkillMaxUsage = definition.BaseUsage; SkillCurrentUsage = definition.BaseUsage; }
private static SupportSkillParser CreateSut( SkillDefinition activeSkillDefinition, SkillDefinition supportSkillDefinition, UntranslatedStatParserFactory statParserFactory) { var skillDefinitions = new SkillDefinitions(new[] { activeSkillDefinition, supportSkillDefinition }); var builderFactories = new BuilderFactories(skillDefinitions); return(new SupportSkillParser(skillDefinitions, builderFactories, statParserFactory)); }
private static IEnumerable <Skill> ParseSkills(Gem gem, SkillDefinition skillDefinition) { yield return(Skill.FromGem(gem, true)); if (skillDefinition.SecondarySkillId is string secondarySkillId) { var isEnabled = EnableSecondarySkill(skillDefinition.BaseItem?.GemTags); yield return(Skill.SecondaryFromGem(secondarySkillId, gem, isEnabled)); } }
// Used to create a skill from a template. Skill CreateSkill(string templateName) { SkillDefinition template = GetSkillTemplate(templateName); if (template == null) { return(null); } return(new Skill(template)); }
/// <summary> /// Create a SkillDefinition based on Skill Name and Skill Type. /// </summary> /// <param name="skillName">Skill Name.</param> /// <param name="skillType">Skill Type.</param> /// <returns>SkillDefinition.</returns> public SkillDefinition CreateSkillDefinition(string skillName, Type skillType) { var skillDefinition = new SkillDefinition { Assembly = skillType.AssemblyQualifiedName, Id = skillName, Name = skillName }; return(skillDefinition); }
public bool HasAcquiredSkill(SkillDefinition definition) { for (int i = 0; i < AcquiredSkills.Count; i++) { if (AcquiredSkills.Contains(definition)) { return(true); } } return(false); }
public SkillPreParseResult( SkillDefinition skillDefinition, SkillLevelDefinition levelDefinition, SkillDefinition mainSkillDefinition, ModifierSource.Local.Skill localSource, ModifierSource.Global globalSource, Entity modifierSourceEntity, IConditionBuilder isMainSkill, IConditionBuilder isActiveSkill) { SkillDefinition = skillDefinition; LevelDefinition = levelDefinition; MainSkillDefinition = mainSkillDefinition; LocalSource = localSource; GlobalSource = globalSource; ModifierSourceEntity = modifierSourceEntity; IsMainSkill = isMainSkill; IsActiveSkill = isActiveSkill; }
bool AddSkillTemplate(SkillDefinition template) { if (template == null) { return(false); } if (Skills.ContainsKey(template.InternalName)) { return(false); } Skills.Add(template.InternalName, template); return(true); }
/// <summary> /// This method calculates the mission progress for a given skill. /// The calculation can be manipulated and tuned with the <see cref="BASE_VALUE"/> and <see cref="RANDOM_FACTOR"/> constants. /// Calculation must be balanced for the entire length of a game. /// </summary> /// <param name="employee"></param> /// <param name="skill"></param> /// <param name="skillValue"></param> /// <param name="completedSkills"></param> /// <returns></returns> private float WorkOnSkill(EmployeeData employee, SkillDefinition skill, float skillValue, int completedSkills) { int employeeValue; employeeValue = employee.HasSkill(skill) ? employee.GetSkill(skill).Level // General Purpose should be weaker than a specific skill : employee.GetGeneralPurpose().Level / 2; var stepValue = Math.Max(employeeValue, 1) * (1f / (mission.SkillDifficulty[skill] * mission.Difficulty)) * (RandomUtils.mult_var(0.1f) * RANDOM_FACTOR) * 1f / mission.TotalTicks * BASE_VALUE * Math.Max(1f, (float)Math.Pow(SKILLS_COMPLETED_BOOST_FACTOR, completedSkills)); return(skillValue + stepValue * GetCricitalChanceFactor(employee)); }
public EmployeeFactory() { contentHub = ContentHub.Instance; teamManager = TeamManager.Instance; missionManager = MissionManager.Instance; gameTime = GameTime.GameTime.Instance; employeeManager = EmployeeManager.Instance; names = contentHub.GetNameLists(); skills = contentHub.GetSkillSet().keys; allPurpSkillDef = ContentHub.Instance.GeneralPurposeSkill; empMaterial = contentHub.DefaultEmpMaterial; empUiMaterial = contentHub.DefaultEmpUiMaterial; InitColorSwapTex(); spriteColors = new Color[colorSwapTex.width]; specialEmployeesToSpawn = new List <EmployeeDefinition>(); EmployeeSpecials.AddRange(ModHolder.Instance.GetCustomSpecials()); }
private void DrawSkill(UIPanel panel, SkillDefinition skill, Texture2D icon, int left, int top) { UIImageButton skillButton = null; UIImage lockedImage = null; skillButton = InitializeButton(icon, new MouseEvent((evt, element) => DrawInfoPanel(skill, evt, element)), left, top, panel); lockedImage = InitializeImage(LockedImageTexture, (skillButton.Width.Pixels / 2) - (LockedImageTexture.Width / 2), 0, skillButton); lockedImage.ImageScale = 0f; lockedImage.Width.Set(1, 0f); lockedImage.Height.Set(1, 0f); if (!_skillImagePairs.ContainsKey(skill)) { _skillImagePairs.Add(skill, new UIImagePair(new Point(left, top), skillButton, null, null, lockedImage)); } }
private void DrawEquipButton(SkillDefinition def) { DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>(); if (EquipButton != null) { EquipButton.Remove(); } EquipButton = InitializeButton(EquipButtonTexture, new MouseEvent((evt, element) => TrySelectingSkill(def, evt, element)), 550, 510, BackPanel); if (dbtPlayer.HasAcquiredSkill(def)) { EquipButton.SetVisibility(1f, 0.8f); } else { EquipButton.SetVisibility(0.3f, 0.1f); } }
private static AdditionalSkillQualityParser CreateSut(Dictionary <int, SkillLevelDefinition>?supportLevelDefinitions = null) { supportLevelDefinitions ??= new Dictionary <int, SkillLevelDefinition>(); var skillDefinitions = new SkillDefinitions(new[] { SkillDefinition.CreateActive("a", 0, "", null, Array.Empty <string>(), new SkillBaseItemDefinition("a", "a", ReleaseState.Released, Array.Empty <string>()), CreateActiveSkillDefinition("a"), new Dictionary <int, SkillLevelDefinition>()), SkillDefinition.CreateSupport("s1", 2, "", null, Array.Empty <string>(), new SkillBaseItemDefinition("s1", "s1", ReleaseState.Released, Array.Empty <string>()), CreateSupportSkillDefinition(), supportLevelDefinitions), }); var statFactory = new StatFactory(); return(new AdditionalSkillQualityParser(skillDefinitions, new GemStatBuilders(statFactory), new ValueBuilders(), new MetaStatBuilders(statFactory))); }
public void InitSkills() { // Add Fake Skill registration const string fakeSkillName = "FakeSkill"; var fakeSkillDefinition = new SkillDefinition(); var fakeSkillType = typeof(FakeSkill.FakeSkill); fakeSkillDefinition.Assembly = fakeSkillType.AssemblyQualifiedName; fakeSkillDefinition.Id = fakeSkillName; fakeSkillDefinition.Name = fakeSkillName; SkillConfigurations.Add(fakeSkillDefinition.Id, Services); // Options are passed to the SkillDialog SkillDialogOptions = new SkillDialogOptions(); SkillDialogOptions.SkillDefinition = fakeSkillDefinition; // Add the SkillDialog to the available dialogs passing the initialized FakeSkill Dialogs.Add(new SkillDialog(fakeSkillDefinition, Services, null, TelemetryClient)); }
/// <summary> /// Wire up each skill into the Virtual Assistant. /// </summary> /// <param name="skillName">Name of the skill.</param> /// <param name="skillType">Assembly reference to skill.</param> /// <param name="dispatchIntent">Dispatch Intent.</param> /// <param name="luisServiceIds">LUIS service IDs used by skill.</param> /// <param name="authConnections">Authentication connections.</param> /// <param name="localeConfiguration">Locale configuration.</param> /// <param name="supportedProviders">Supported Providers (optional).</param> private void InitialiseSkill(string skillName, Type skillType, string dispatchIntent, string[] luisServiceIds, string[] authConnections, Dictionary <string, LocaleConfiguration> localeConfiguration, string[] supportedProviders = null) { // Prepare skill configuration var skillConfiguration = new SkillConfiguration(); skillConfiguration.AuthenticationConnections.Add("DummyAuth", "DummyAuthConnection"); skillConfiguration.LocaleConfigurations = this.BotServices.LocaleConfigurations; this.BotServices.SkillConfigurations.Add(skillName, skillConfiguration); // Skill Registration var skillDefinition = new SkillDefinition { Assembly = skillType.AssemblyQualifiedName, Id = skillName, Name = skillName, DispatchIntent = dispatchIntent, LuisServiceIds = luisServiceIds, SupportedProviders = supportedProviders, }; this.BotServices.SkillDefinitions.Add(skillDefinition); }
public void InitSkills() { // Add Fake Skill registration const string fakeSkillName = "FakeSkill"; var fakeSkillDefinition = new SkillDefinition(); var fakeSkillType = typeof(FakeSkill.FakeSkill); fakeSkillDefinition.Id = fakeSkillName; fakeSkillDefinition.Name = fakeSkillName; // Set Assembly name to invalid value fakeSkillDefinition.Assembly = "FakeSkill.FakeSkil, Microsoft.Bot.Solutions.Tests, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null"; SkillConfigurations.Add(fakeSkillDefinition.Id, Services); // Options are passed to the SkillDialog SkillDialogOptions = new SkillDialogOptions(); SkillDialogOptions.SkillDefinition = fakeSkillDefinition; // Add the SkillDialog to the available dialogs passing the initialized FakeSkill Dialogs.Add(new SkillDialog(fakeSkillDefinition, Services, null, null, TelemetryClient, null)); }
public void EquipSkill(SkillDefinition definition) { if (!HasSkillActive(definition) && AcquiredSkills.Count < 4 && HasAcquiredSkill(definition)) { ActiveSkills.Add(definition); player.PutItemInInventory(mod.ItemType(definition.Item.Name)); } if (HasSkillActive(definition)) { ActiveSkills.Remove(definition); foreach (var item in player.inventory) { if (item == null) { continue; } if (item.type == mod.ItemType(definition.Item.Name)) { item.TurnToAir(); } } } }