private void ApplyAurasFromTree(TalentTree _tree) { switch (_tree.classID) { case CHAMPION.PALADIN: { myAura[(int)AURA.HAND_OF_LIGHT] = new Aura(_tree.GetTalentByName("Hand of Light")); myAura[(int)AURA.IRON_FAITH] = new Aura(_tree.GetTalentByName("Iron Faith")); myAura[(int)AURA.SPIRIT_BOND] = new Aura(_tree.GetTalentByName("Spirit Bond")); myAura[(int)AURA.AURA_OF_LIGHT] = new Aura(_tree.GetTalentByName("Aura of Light")); myAura[(int)AURA.CONSECRATION] = new Aura(_tree.GetTalentByName("Consecration")); myAura[(int)AURA.ROYALTY] = new Aura(_tree.GetTalentByName("Royalty")); myAura[(int)AURA.DIVINITY] = new Aura(_tree.GetTalentByName("Divinity")); myAura[(int)AURA.EMPATHY] = new Aura(_tree.GetTalentByName("Empathy")); myAura[(int)AURA.GENEROUSITY] = new Aura(_tree.GetTalentByName("Generousity")); myAura[(int)AURA.MODESTY] = new Aura(_tree.GetTalentByName("Modesty")); myAura[(int)AURA.VISIONS_OF_ANCIENT_KINGS] = new Aura(_tree.GetTalentByName("Visions of Ancient Kings")); myAura[(int)AURA.GUIDANCE_OF_RAELA] = new Aura(_tree.GetTalentByName("Guidance of Raela")); myAura[(int)AURA.FLASH_OF_FUTURE] = new Aura(_tree.GetTalentByName("Flash of Future")); } break; case CHAMPION.SHADOWMANCER: { } break; } }
public void LoadTalentTree() { string path = "Assets/TalentTree/Data/talenttree.json"; string dataAsJson; if (File.Exists(path)) { // Read the json from the file into a string dataAsJson = File.ReadAllText(path); // Pass the json to JsonUtility, and tell it to create a SkillTree object from it TalentTree loadedData = JsonUtility.FromJson <TalentTree>(dataAsJson); // Store the SkillTree as an array of Skill _talentTree = new Talent[loadedData.talenttree.Length]; _talentTree = loadedData.talenttree; // Populate a dictionary with the skill id and the skill data itself for (int i = 0; i < _talentTree.Length; ++i) { _talents.Add(_talentTree[i].Talent_ID, _talentTree[i]); } } else { Debug.LogError("Cannot load game data!"); } }
public void UpgradeTalent() { TalentTree tree = GetCurrentTree(); tree?.Root.UpgradeTalent(Tower.PlayerSelectedTower.NumTalents); ShowTalentButton(); }
public void Test_MergeTalentTrees_TrueResult_WithOrderBy() { TalentTree objTalentTree = new TalentTree(); TalentTree objTalentTree2 = new TalentTree(); List <TalentTree> lstTalentTreeList = new List <TalentTree>(); List <TalentTree> lstTalentTreeList2 = new List <TalentTree>(); bool blnTalentTreeIsInList, blnTalentTreeIsInList2, blnAlterFirst; objTalentTree.GetTalentTree(1); lstTalentTreeList.Add(objTalentTree); objTalentTree2.GetTalentTree(2); lstTalentTreeList2.Add(objTalentTree2); List <TalentTree> lstMergedTalentTrees = new List <TalentTree>(); lstMergedTalentTrees = TalentTree.MergeTalentTrees(lstTalentTreeList, lstTalentTreeList2, "TalentTreeName"); blnTalentTreeIsInList = TalentTree.IsTalentTreeInList(objTalentTree, lstMergedTalentTrees); blnTalentTreeIsInList2 = TalentTree.IsTalentTreeInList(objTalentTree2, lstMergedTalentTrees); if (lstMergedTalentTrees.IndexOf(objTalentTree2) == 0) { blnAlterFirst = true; } else { blnAlterFirst = false; } Assert.IsTrue(blnTalentTreeIsInList && blnTalentTreeIsInList2 && lstMergedTalentTrees.Count == 2 && blnAlterFirst); }
public void LoadTemplates() { if (File.Exists("TalentTreesTemplates.dat")) { string _content = File.ReadAllText("TalentTreesTemplates.dat"); string[] _records = _content.Split('|'); for (int c = 1; c < 3; c++) { treeTemplate[c] = GetTalentTreeFromCode(_records[c - 1]); treeTemplate[c].PointsCap = level - 1; if (treeTemplate[c].CheckTotalPoints() > treeTemplate[c].PointsCap) { treeTemplate[c].Reset(); } } Debug.Log("Talent Tree Templates loaded"); } else { for (int c = 0; c < 3; c++) { treeTemplate[c] = new TalentTree(GameCore.chosenChampion); treeTemplate[c].DefaultTree(); } } }
public void Test_IsTalentTreeInListList_FalseResult() { TalentTree objTalentTree = new TalentTree(); TalentTree objTalentTree2 = new TalentTree(); List <TalentTree> lstTalentTreeList = new List <TalentTree>(); List <TalentTree> lstNeedList = new List <TalentTree>(); bool blnTalentTreeIsInList; objTalentTree.GetTalentTree(1); objTalentTree2.GetTalentTree(2); for (int i = 0; i < 3; i++) { lstTalentTreeList.Add(objTalentTree); } for (int i = 0; i < 1; i++) { lstNeedList.Add(objTalentTree2); } blnTalentTreeIsInList = TalentTree.IsTalentTreeInList(lstNeedList, lstTalentTreeList); Assert.IsFalse(blnTalentTreeIsInList); }
public void LoadAccData() { if (File.Exists("AccData.dat")) { string _content = File.ReadAllText("AccData.dat"); string[] _records = _content.Split('|'); level = int.Parse(_records[0]); experience = int.Parse(_records[1]); maxExperience = int.Parse(_records[2]); basestatINT = int.Parse(_records[3]); basestatKNG = int.Parse(_records[4]); basestatWSD = int.Parse(_records[5]); basestatFCS = int.Parse(_records[6]); basestatPWR = int.Parse(_records[7]); myTalentTree = GetTalentTreeFromCode(_records[8]); myTalentTree.PointsCap = level - 1; if (myTalentTree.CheckTotalPoints() > myTalentTree.PointsCap) { myTalentTree.Reset(); } Debug.Log("Account Loaded"); } LoadTemplates(); myTalentTree = GetTemplate(CHAMPION.PALADIN); }
public static Spell CreateSpell(string name, Stats stats, TalentTree talents) { switch (name) { case "Vampiric Embrace": return(new VampiricEmbrace(stats, talents)); case "Vampiric Touch": return(new VampiricTouch(stats, talents)); case "Shadow Word: Pain": return(new ShadowWordPain(stats, talents)); case "Devouring Plague": return(new DevouringPlague(stats, talents)); case "Starshards": return(new Starshards(stats, talents)); case "Mind Blast": return(new MindBlast(stats, talents)); case "Shadow Word: Death": return(new ShadowWordDeath(stats, talents)); case "Mind Flay": return(new MindFlay(stats, talents)); default: return(null); } }
protected void Calculate(Stats stats, TalentTree talents) { MinDamage = MaxDamage = (MinDamage + (stats.SpellDamageRating + stats.SpellArcaneDamageRating) * DamageCoef); ManaCost = (int)Math.Round(ManaCost * (1 - talents.GetTalent("Mental Agility").PointsInvested * 0.02f)); }
protected void Calculate(Stats stats, TalentTree talents, int rank) { Rank = rank; MinHeal = MaxHeal = (baseSpellTable[Rank - 1].MinHeal + stats.Healing * HealingCoef) * (1 + talents.GetTalent("Spiritual Healing").PointsInvested * 0.02f); }
public Caster(TalentTree _tree, Account _acc) { myTalentTree = _tree; ApplyAurasFromTree(_tree); CopyStats(_acc); RefreshStats(); }
public void InitMainScene() { ManaMax = 500f + chosenAccount.statKNG * 40; ManaCurrent = ManaMax; buffSystem = new BuffHandler(GameObject.Find("GCDBar").transform.position); chosenAccount.RefreshStats(); myBlackScreen = GameObject.Find("BlackScreen"); mySpellIcon = GameObject.Find("MySpellIcon"); recount = new Recount(); myEnemy = WorldMapCore.WMCore.adventureInfoHandler.GetEncounter(GameCore.Core.chosenAdventure, GameCore.difficulty); myEnemy.InitEncounter(); chosenChampion = DescendantPanelCore.DPCore.pickedChampion; _mytip = GameObject.Find("Tooltip"); if (chosenAccount.myTalentTree != null) { myTree = chosenAccount.myTalentTree; } else { myTree = new TalentTree(chosenChampion); myTree.DefaultTree(); } GameObject.Find("ChampionPortrait").GetComponent <Image>().sprite = Champion.GetPortrait(chosenChampion); myCaster = new Caster(myTree); InitSpells(); InitItems(); UpdateStats(); ApplyAuras(); }
public void ShowTalentTree(TalentTree _tree) { tree = _tree; int actualTier = -1; int myNum = 0; float xOff = 0; GameObject[] myLinks = new GameObject[40]; GameObject[] myIcons = new GameObject[13]; int linksAmount = 0; int[] myTars = new int[40]; for (int i = 0; i < 13; i++) { if (actualTier != _tree.talents[i].tier) { actualTier = _tree.talents[i].tier; myNum = 0; xOff = _tree.GetSpellsAmountFromTier(actualTier) * (-gridSize / 2f); } else { myNum++; } myIcons[i] = Object.Instantiate(Resources.Load("TalentIcon"), new Vector3(xOff + (myNum * gridSize), 5f - gridSize - _tree.talents[i].tier * gridSize, -1), Quaternion.Euler(0, 0, 0)) as GameObject; myIcons[i].transform.SetParent(GameObject.Find("Canvas").transform); myIcons[i].transform.localScale = new Vector3(1, 1, 1); myIcons[i].transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Talent.GetSpriteByTalent(_tree.talents[i]); myIcons[i].GetComponent <scrTalentIcon>().myTalent = _tree.talents[i]; for (int j = 0; j < _tree.talents[i].linkAmount; j++) { if (_tree.talents[i].linkedWith[j] > -1) { myLinks[linksAmount] = Object.Instantiate(Resources.Load("Link"), new Vector3(xOff + (myNum * gridSize), 5f - gridSize - _tree.talents[i].tier * gridSize, 0), Quaternion.Euler(0, 0, 0)) as GameObject; myLinks[linksAmount].transform.SetParent(GameObject.Find("Canvas").transform); myLinks[linksAmount].transform.localScale = new Vector3(1, 1, 1); myLinks[linksAmount].transform.SetSiblingIndex(1); myTars[linksAmount] = _tree.talents[i].linkedWith[j]; linksAmount++; } } } for (int j = 0; j < linksAmount; j++) { if (myLinks[j] != null) { Vector3 vectorToTarget = myIcons[myTars[j]].transform.position - myLinks[j].transform.position; float distance = vectorToTarget.magnitude; float angle = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg; Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward); myLinks[j].transform.rotation = Quaternion.Slerp(myLinks[j].transform.rotation, q, 100f); myLinks[j].GetComponent <Image>().rectTransform.sizeDelta = new Vector2(distance * 100, 20); } } }
public void Test_GetTalentTree_ByName_BadResult() { string strTalentTreeName = "blah blah"; TalentTree objTalentTree = new TalentTree(); objTalentTree.GetTalentTree(strTalentTreeName); Assert.IsNull(objTalentTree.TalentTreeName); }
public void Test_GetCoreForceTalentTrees() { TalentTree objTalentTree = new TalentTree(); List <TalentTree> lstTalentTrees = new List <TalentTree>(); lstTalentTrees = objTalentTree.GetCoreForceTalentTrees(); Assert.IsTrue(lstTalentTrees.Count > 0); }
public Solver(Stats playerStats, TalentTree playerTalentTree, CalculationOptionsShadowPriest calculationOptions) { PlayerStats = playerStats; PlayerTalentTree = playerTalentTree; CalculationOptions = calculationOptions; SpellPriority = new List <Spell>(CalculationOptions.SpellPriority.Count); foreach (string spellname in calculationOptions.SpellPriority) { SpellPriority.Add(SpellFactory.CreateSpell(spellname, playerStats, playerTalentTree)); } HitChance = PlayerStats.SpellHitRating / 12.6f; ShadowHitChance = 83.0f + (PlayerStats.SpellHitRating + playerTalentTree.GetTalent("Shadow Focus").PointsInvested * 12.6f * 2.0f) / 12.6f; if (ShadowHitChance > 99.0f) { ShadowHitChance = 99.0f; } Trinkets = new List <Trinket>(); ShadowCritChance = PlayerStats.SpellCrit + playerTalentTree.GetTalent("Shadow Power").PointsInvested * 3; Sequence = new Dictionary <float, Spell>(); if (playerStats.SpellDamageFor15SecOnUse2Min > 0.0f) { Trinkets.Add(new Trinket() { Cooldown = 120.0f, DamageBonus = playerStats.SpellDamageFor15SecOnUse2Min, UpTime = 15.0f }); } if (playerStats.SpellDamageFor15SecOnUse90Sec > 0.0f) { Trinkets.Add(new Trinket() { Cooldown = 90.0f, DamageBonus = playerStats.SpellDamageFor15SecOnUse90Sec, UpTime = 15.0f }); } if (playerStats.SpellDamageFor20SecOnUse2Min > 0.0f) { Trinkets.Add(new Trinket() { Cooldown = 120.0f, DamageBonus = playerStats.SpellDamageFor20SecOnUse2Min, UpTime = 20.0f }); } if (playerStats.SpellHasteFor20SecOnUse2Min > 0.0f) { Trinkets.Add(new Trinket() { Cooldown = 120.0f, HasteBonus = playerStats.SpellHasteFor20SecOnUse2Min, UpTime = 20.0f }); } if (playerStats.SpellHasteFor20SecOnUse5Min > 0.0f) { Trinkets.Add(new Trinket() { Cooldown = 300.0f, HasteBonus = playerStats.SpellHasteFor20SecOnUse5Min, UpTime = 20.0f }); } }
public void Test_GetTalentTree_ByName_GoodResult() { string strTalentTreeName = "Alter"; TalentTree objTalentTree = new TalentTree(); objTalentTree.GetTalentTree(strTalentTreeName); Assert.AreEqual(strTalentTreeName, objTalentTree.TalentTreeName); }
public void SetTalentTree(Player p) { player = p; tree = player.talentTree; foreach (TalentTreeBranchUI branch in treeBranches) { Destroy(branch.gameObject); } treeBranches.Clear(); foreach (TalentTreeBranch branch in tree.branches) { TalentTreeBranchUI temp; temp = Instantiate <TalentTreeBranchUI>(branchPrefab, talentContainer.transform); temp.SetBranch(branch, this); treeBranches.Add(temp); } /* * foreach (Talent talent in tree.talents) * { * * TalentTreeNodeUI temp; * temp = Instantiate<TalentTreeNodeUI>(prefab, talentContainer.transform); * * Navigation customNav = temp.GetComponent<Button>().navigation; * Navigation upNav; * * if (talentNodes.Count == 0) * { * customNav.selectOnUp = interactableUp; * upNav = interactableUp.navigation; * upNav.selectOnDown = temp.GetComponent<Button>(); * interactableUp.navigation = upNav; * } * else * { * customNav.selectOnUp = talentNodes[talentNodes.Count-1].GetComponent<Button>(); * upNav = talentNodes[talentNodes.Count - 1].GetComponent<Button>().navigation; * upNav.selectOnDown = temp.GetComponent<Button>(); * talentNodes[talentNodes.Count - 1].GetComponent<Button>().navigation = upNav; * } * * temp.GetComponent<Button>().navigation = customNav; * * temp.SetTalent(talent, this); * * talentNodes.Add(temp); * } * */ defaultSelection = treeBranches[0].gameObject; SetNavigation(); }
public void Test_GetTalentTree_ByID_GoodResult() { int intTalentTreeID = 1; TalentTree objTalentTree = new TalentTree(); objTalentTree.GetTalentTree(intTalentTreeID); Assert.AreEqual(intTalentTreeID, objTalentTree.TalentTreeID); }
public void Test_GetTalentTree_ByID_BadResult() { int intTalentTreeID = 0; TalentTree objTalentTree = new TalentTree(); objTalentTree.GetTalentTree(intTalentTreeID); Assert.IsNull(objTalentTree.TalentTreeName); }
void Start() { _uiButton = this.gameObject.GetComponent <UIButton>(); _talentTree = GameObject.Find("Controller").GetComponent <TalentTree>(); if (_talentTree == null) { Debug.Log("Controller-TalentTree not found."); } }
protected void Calculate(Stats stats, TalentTree talents) { MinDamage = MaxDamage = (MinDamage + (stats.SpellDamageRating + stats.SpellShadowDamageRating) * DamageCoef) * (1 + talents.GetTalent("Improved Power Word: Shield").PointsInvested * 0.05f); ManaCost = (int)Math.Round(ManaCost * (1 - talents.GetTalent("Mental Agility").PointsInvested * 0.02f)); CastTime = CastTime * (1 - stats.SpellHasteRating / 15.7f / 100f); }
protected void Calculate(Stats stats, TalentTree talents, int rank) { Rank = rank; MinHeal = (baseSpellTable[Rank - 1].MinHeal + stats.Healing * HealingCoef * (1 - baseSpellTable[Rank - 1].RankCoef)) * (1 + talents.GetTalent("Improved Power Word: Shield").PointsInvested * 0.05f); MaxHeal = MinHeal; ManaCost = (int)Math.Round(baseSpellTable[Rank - 1].ManaCost * (1 - talents.GetTalent("Mental Agility").PointsInvested * 0.02f)); }
public static List <Spell> GetAllRanks(Stats stats, TalentTree talents, int targets) { List <Spell> list = new List <Spell>(baseSpellTable.Count); for (int i = 1; i <= baseSpellTable.Count; i++) { list.Add(new PrayerOfMending(stats, talents, i, targets)); } return(list); }
protected void Calculate(Stats stats, TalentTree talents) { MinDamage = MaxDamage = (MinDamage + (stats.SpellDamageRating + stats.SpellShadowDamageRating) * DamageCoef) * (1 + talents.GetTalent("Darkness").PointsInvested * 0.02f) * (1 + talents.GetTalent("Shadow Form").PointsInvested * 0.15f); ManaCost = (int)Math.Round(ManaCost * (1 - talents.GetTalent("Mental Agility").PointsInvested * 0.02f)); Range = (int)Math.Round(Range * (1 + talents.GetTalent("Shadow Reach").PointsInvested * 0.1f)); }
public static List <Spell> GetAllRanks(Stats stats, TalentTree talents) { List <Spell> list = new List <Spell>(baseSpellTable.Count); for (int i = 1; i <= baseSpellTable.Count; i++) { list.Add(new PowerWordShield(stats, talents, i)); } return(list); }
private TalentTree GetTalentTreeFromCode(string _code) { string[] temp = _code.Split(','); TalentTree tree = new TalentTree((CHAMPION)int.Parse(temp[0])); for (int i = 0; i < 13; i++) { tree.talents[i].Points = int.Parse(temp[i + 1]); } return(tree); }
public void Test_GetTalentTreesPrestigeClass_WithOutOrderBy_NoResult() { string strWhere = "ClassID=1"; string strOrderBy = ""; TalentTree objTalentTree = new TalentTree(); List <TalentTree> lstTalentTrees = new List <TalentTree>(); lstTalentTrees = objTalentTree.GetTalentTreesPrestigeClass(strWhere, strOrderBy); Assert.IsTrue(lstTalentTrees.Count == 0); }
public void Test_GetTalentTrees_WithOutOrderBy_NoResult() { string strWhere = "TalentTreeName Like '%Toad%'"; string strOrderBy = ""; TalentTree objTalentTree = new TalentTree(); List <TalentTree> lstTalentTrees = new List <TalentTree>(); lstTalentTrees = objTalentTree.GetTalentTrees(strWhere, strOrderBy); Assert.IsTrue(lstTalentTrees.Count == 0); }
public void Test_GetForceTalentTrees() { string strWhere = "TalentTreeName Like '%Jedi%'"; string strOrderBy = ""; TalentTree objTalentTree = new TalentTree(); List <TalentTree> lstTalentTrees = new List <TalentTree>(); lstTalentTrees = objTalentTree.GetTalentTrees(strWhere, strOrderBy); Assert.IsTrue(lstTalentTrees.Count > 0); }