private void InitializeCombatSkills(int bonusSkills = 0) { var availableSkills = new List <CombatSkill>(HeroClass.CombatSkills); int skillsRequired = Mathf.Clamp(HeroClass.Generation.NumberOfRandomCombatSkills + bonusSkills, 0, HeroClass.CombatSkills.Count); CurrentCombatSkills = new CombatSkill[HeroClass.CombatSkills.Count]; foreach (var guaranteedSkill in availableSkills.FindAll(skill => skill.IsGenerationGuaranteed)) { CurrentCombatSkills[HeroClass.CombatSkills.IndexOf(guaranteedSkill)] = guaranteedSkill; availableSkills.Remove(guaranteedSkill); skillsRequired--; } for (int i = skillsRequired; i > 0; i--) { int generatedIndex = RandomSolver.Next(availableSkills.Count); CurrentCombatSkills[HeroClass.CombatSkills.IndexOf(availableSkills[generatedIndex])] = availableSkills[generatedIndex]; availableSkills.RemoveAt(generatedIndex); } SelectedCombatSkills = new List <CombatSkill>(); var selectionList = new List <CombatSkill>(CurrentCombatSkills); selectionList.RemoveAll(skill => skill == null); int selectedSkills = Mathf.Clamp(HeroClass.NumberOfSelectedCombatSkills, 0, selectionList.Count); for (int i = 0; i < selectedSkills; i++) { int selectedItem = RandomSolver.Next(selectionList.Count); SelectedCombatSkills.Add(selectionList[selectedItem]); selectionList.RemoveAt(selectedItem); } }
public void UpdateSkill(CombatSkill skill) { gameObject.SetActive(true); skillLabel.text = LocalizationManager.GetString("str_monster_skill_" + skill.Id); UpdateAttributes(skill); }
public void UpdateHeroSkill(Hero hero, CombatSkill skill) { gameObject.SetActive(true); skillLabel.text = LocalizationManager.GetString("combat_skill_name_" + hero.Class + "_" + skill.Id); UpdateAttributes(skill); }
public Hero(int heroIndex, PhotonPlayer player) : base(DarkestDungeonManager.Data.HeroClasses[(string)player.CustomProperties["HC" + heroIndex]]) { RandomSolver.SetRandomSeed((int)player.CustomProperties["HS" + heroIndex]); InitializeHeroInfo(0, (string)player.CustomProperties["HN" + heroIndex], (string)player.CustomProperties["HC" + heroIndex], 0, 30); InitializeEquipment(1, 1); InitializeQuirks(); CurrentCombatSkills = new CombatSkill[HeroClass.CombatSkills.Count]; for (int i = 0; i < CurrentCombatSkills.Length; i++) { CurrentCombatSkills[i] = HeroClass.CombatSkills[i]; } var playerSkillFlags = (PlayerSkillFlags)player.CustomProperties["HF" + heroIndex]; SelectedCombatSkills = new List <CombatSkill>(); for (int i = 0; i < CurrentCombatSkills.Length; i++) { if ((playerSkillFlags & (PlayerSkillFlags)Mathf.Pow(2, i + 1)) != PlayerSkillFlags.Empty) { SelectedCombatSkills.Add(CurrentCombatSkills[i]); } } CurrentCampingSkills = new CampingSkill[HeroClass.CampingSkills.Count]; SelectedCampingSkills = new List <CampingSkill>(); }
public RaidRuleInfo GetIdleUnitRules(FormationUnit unit) { IsRiposting = false; Unit = unit; Target = null; Skill = null; return(this); }
public RaidRuleInfo GetCombatUnitRules(FormationUnit unit, FormationUnit target, CombatSkill skill, bool riposte) { Unit = unit; Target = target; Skill = skill; IsRiposting = riposte; return(this); }
public void Reset() { Tree = null; Upgrade = null; Hero = null; Skill = null; }
void CalculateStrength() { teamStrCount = new int[5] { 0, 0, 0, 0, 0 }; targetStrCount = new int[5] { 0, 0, 0, 0, 0 }; friendlyCheck = new bool[5] { false, false, false, false, false }; for (int i = 0; i < currentHero.SelectedCombatSkills.Count; i++) { CombatSkill skill = currentHero.SelectedCombatSkills[i]; for (int j = 0; j < skill.LaunchRanks.Ranks.Count; j++) { teamStrCount[skill.LaunchRanks.Ranks[j]]++; } for (int j = 0; j < skill.TargetRanks.Ranks.Count; j++) { if (skill.TargetRanks.IsSelfFormation) { friendlyCheck[skill.TargetRanks.Ranks[j]] = true; } else { targetStrCount[skill.TargetRanks.Ranks[j]]++; } } } if (currentHero.SelectedCombatSkills.Count > 4) { for (int i = 0; i < 4; i++) { teamStrCount[i + 1] = Mathf.RoundToInt((float)teamStrCount[i + 1] * 4 / currentHero.SelectedCombatSkills.Count); targetStrCount[i + 1] = Mathf.RoundToInt((float)targetStrCount[i + 1] * 4 / currentHero.SelectedCombatSkills.Count); } } for (int i = 0; i < 4; i++) { if (friendlyCheck[i + 1]) { teamStrengthPips[i].state.SetAnimation(0, "skill_strength_friendly_" + Mathf.Clamp(teamStrCount[i + 1], 1, 4).ToString(), false); } else { teamStrengthPips[i].state.SetAnimation(0, "skill_strength_hero_" + Mathf.Clamp(teamStrCount[i + 1], 0, 4).ToString(), false); } targetStrengthPips[i].state.SetAnimation(0, "skill_strength_target_" + Mathf.Clamp(targetStrCount[i + 1], 0, 4).ToString(), false); } }
protected override bool IsValidSkill(FormationUnit performer, CombatSkill skill) { if (!base.IsValidSkill(performer, skill)) { return(false); } return(skill.Id == CombatSkillId); }
public void Initialize(Hero hero, UpgradeTree tree, HeroUpgrade upgrade, int skillIndex) { Hero = hero; Tree = tree; Upgrade = upgrade;; Skill = hero.HeroClass.CombatSkillVariants.Find(skill => skill.Id == hero.HeroClass.CombatSkills[skillIndex].Id && skill.Level == tree.Upgrades.IndexOf(upgrade)); }
protected override bool IsValidSkill(FormationUnit performer, CombatSkill skill) { if (!base.IsValidSkill(performer, skill)) { return(false); } return(skill.Effects.Any(effect => effect.SubEffects.Any(IsValidSubEffect))); }
public void SetUp() { GameTime.Reset(); herb = new UsableItem(); herb.Id = 0; herb.Name = "Herb"; herb.Description = "A common herb"; coin = new UsableItem(); coin.Id = 1; coin.Name = "Coin"; coin.Description = "A gold coin"; passiveMagicSkill = new PassiveMagicSkill(id: 0, name: "ShadowStrength", description: "A +10 Buff to the user's strength.", cooldownTime: 5, itemSequence: new int[] { herb.Id }, cost: 10, duration: 10, modifierValue: 10, modifiedAttributeName: "Body"); offensiveMagicSkill = new OffensiveMagicSkill(id: 1, name: "Fireball", description: "A ball of fire.", cooldownTime: 5, itemSequence: new int[] { coin.Id, herb.Id }, damage: 1, maximumTargets: 2, range: 2, cost: 1); meleeSkill = new GenericCombatSkill(id: 1, name: "SwordFighting", description: "Wield a sword effectively.", cooldownTime: 1, damage: 1, maximumTargets: 1, range: 1, itemSequence: new int[] { }); meleeMultiTargetsSkill = new GenericCombatSkill(id: 2, name: "MultiHit", description: "Wield a sword against multiple opponents.", cooldownTime: 1, damage: 1, maximumTargets: 2, range: 1, itemSequence: new int[] { }); rangedSkill = new GenericCombatSkill(id: 3, name: "Longbow", description: "Notch! Aim! Loose!", cooldownTime: 1, damage: 1, maximumTargets: 1, range: 10, itemSequence: new int[] { }); }
public void UpdateSkillRanks(CombatSkill skill) { for (int i = 0; i < launchRanks.Length; i++) { launchRanks[i].color = skill.LaunchRanks.Ranks.Contains(i + 1) ? launchColor : neutralColor; } if (skill.TargetRanks.IsSelfFormation || skill.TargetRanks.IsSelfTarget) { targetRanksObject.SetActive(false); } else { targetRanksObject.SetActive(true); int firstTargetIndex = -1; int lastTargetIndex = -1; for (int i = 0; i < targetRanks.Length; i++) { if (skill.TargetRanks.Ranks.Contains(i + 1)) { if (firstTargetIndex == -1) { firstTargetIndex = i; } targetRanks[i].color = targetColor; lastTargetIndex = i; } else { targetRanks[i].color = neutralColor; } } if (skill.TargetRanks.IsMultitarget) { if (firstTargetIndex == -1 || firstTargetIndex == lastTargetIndex) { connectorRect.gameObject.SetActive(false); } else { connectorRect.gameObject.SetActive(true); connectorRect.localPosition = new Vector3(startConnectorOffset + basicWidth * firstTargetIndex, 0, 0); connectorRect.sizeDelta = new Vector2(basicWidth * (skill.TargetRanks.Ranks.Count - 1), connectorRect.sizeDelta.y); } } else { connectorRect.gameObject.SetActive(false); } } }
public void ExperienceGain(CombatSkill skill, float experience) //skill, float { mySkillExperience[skill] += experience; if (mySkillExperience[skill] >= (100 * mySkillLevels[skill])) { mySkillLevels[skill]++; mySkillExperience[skill] = 0f; SkillGainCallback(); //Debug.Log("LEVEL UP: " + mySkillLevels[skill] + "!!!"); } }
public static TownHouseSlotType GetHouseTypeBySkill(CombatSkill skill) { switch (skill) { case CombatSkill.Ranged: return(TownHouseSlotType.Ranged); case CombatSkill.Magic: return(TownHouseSlotType.Magic); default: return(TownHouseSlotType.Melee); } }
protected override bool IsValidSkill(FormationUnit performer, CombatSkill skill) { if (!base.IsValidSkill(performer, skill)) { return(false); } var monster = (Monster)performer.Character; return(monster.Data.CombatSkills.IndexOf(skill) == monster.Data.PreferableSkill); }
public float GetExpBonusBySkill(CombatSkill skill) { var values = expBonus.Values .Where(x => GameMath.GetHouseTypeBySkill(skill) == x.SlotType) .ToList(); if (values.Count == 0) { return(1f); } return(1f + (values.Sum(x => x.Bonus) / 100f)); }
public Sprite GetCombatSkillIcon(Hero hero, CombatSkill combatSkill) { var spriteId = hero.HeroClass.SkillArtInfo.Find(art => art.SkillId == combatSkill.Id).IconId; if (spriteId != null) { return(HeroClassInfo[hero.ClassStringId].Skills[spriteId]); } else { return(null); } }
protected virtual bool IsValidSkill(FormationUnit performer, CombatSkill skill) { if (!BattleSolver.IsSkillUsable(performer, skill)) { return(false); } if (performer.CombatInfo.SkillCooldowns.Any(cooldown => cooldown.SkillId == skill.Id)) { return(false); } return(true); }
protected override bool IsValidSkill(FormationUnit performer, CombatSkill skill) { if (!base.IsValidSkill(performer, skill)) { return(false); } if (string.IsNullOrEmpty(CombatSkillId)) { return(skill.Id == CombatSkillId); } return(skill.Heal != null); }
public void SetUp() { Controller.Enemies = new List <Enemy>(); player = new Player("Player"); enemy = new Enemy("Enemy"); meleeSkill = new GenericCombatSkill(id: 0, name: "SwordFighting", description: "Wield a sword effectively.", cooldownTime: 1, damage: 1, maximumTargets: 1, range: 1, itemSequence: new int[] { }); passiveMagicSkill = new PassiveMagicSkill(id: 0, name: "ShadowStrength", description: "A +10 Buff to the user's strength.", cooldownTime: 5, itemSequence: new int[] { }, cost: 10, duration: 10, modifierValue: 10, modifiedAttributeName: "Body"); SkillDatabase.MagicSkills = new MagicSkill[] { passiveMagicSkill }; SkillDatabase.CombatSkills = new CombatSkill[] { meleeSkill }; sword = new WeaponItem(); sword.Id = 0; sword.Name = "Sword"; sword.Range = 1; sword.Damage = 1; sword.Speed = 0.5f; beretta = new WeaponItem(); sword.Id = 1; beretta.Name = "Beretta"; beretta.Range = 10; beretta.Damage = 10; beretta.Speed = 2; ItemDatabase.Items = new BaseItem[] { sword, beretta }; player.LearnCombatSkill(meleeSkill.Id); player.LearnMagicSkill(passiveMagicSkill.Id); enemy.Stats.Life.Value = 10; enemy.Stats.Experience.Value = 66; GameTime.Reset(); player.OnCombatSkillTriggered += CombatSkillTriggered; enemy.OnCombatSkillTriggered += CombatSkillTriggered; }
public void UpdateSkill(Hero hero, CombatSkill combatSkill) { Hero = hero; Skill = combatSkill; if (hero.SelectedCombatSkills.Contains(combatSkill)) { skillIcon.sprite = DarkestDungeonManager.Data.HeroSprites.GetCombatSkillIcon(hero, combatSkill); SetDisabledState(); } else { ResetSkill(); } }
public void SetUp() { GameTime.Reset(); Controller.Enemies.Clear(); player = new Player("John"); enemy1 = new Enemy("Zombie"); enemy2 = new Enemy("AxeZombie"); enemy3 = new Enemy("SwampZombie"); enemy1.Stats.Life.Value = 10; enemy2.Stats.Life.Value = 10; enemy3.Stats.Life.Value = 10; meleeSkill = new GenericCombatSkill(id: 0, name: "SwordFighting", description: "Wield a sword effectively.", cooldownTime: 1, damage: 1, maximumTargets: 1, range: 1, itemSequence: new int[] {}); meleeMultiTargetsSkill = new GenericCombatSkill(id: 1, name: "MultiHit", description: "Wield a sword against multiple opponents.", cooldownTime: 1, damage: 1, maximumTargets: 2, range: 1, itemSequence: new int[] {}); sword = new WeaponItem(); sword.Name = "Sword"; sword.Damage = 1; sword.Speed = 1; sword.Range = 1; player.Inventory.AddItem(sword.Id); player.EquippedWeapon = sword.Id; ItemDatabase.Items = new BaseItem[] { sword }; SkillDatabase.CombatSkills = new CombatSkill[] { meleeSkill, meleeMultiTargetsSkill }; player.OnCombatSkillTriggered += CombatSkillTriggered; enemy1.OnCombatSkillTriggered += CombatSkillTriggered; enemy2.OnCombatSkillTriggered += CombatSkillTriggered; enemy3.OnCombatSkillTriggered += CombatSkillTriggered; }
public SkillTargetInfo UpdateSkillInfo(FormationUnit performer, CombatSkill skill) { Mode = performer.Character.Mode; Skill = skill; SkillArtInfo = performer.Character.SkillArtInfo.Find(info => info.SkillId == skill.Id); if (skill.LimitPerBattle.HasValue) { performer.CombatInfo.SkillsUsedInBattle.Add(skill.Id); } if (skill.LimitPerTurn.HasValue) { performer.CombatInfo.SkillsUsedThisTurn.Add(skill.Id); } return(this); }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("CreatureType", true, out subEle); subEle.Value = CreatureType.ToString(); ele.TryPathTo("Skill/Combat", true, out subEle); subEle.Value = CombatSkill.ToString(); ele.TryPathTo("Skill/Magic", true, out subEle); subEle.Value = MagicSkill.ToString(); ele.TryPathTo("Skill/Stealth", true, out subEle); subEle.Value = StealthSkill.ToString(); ele.TryPathTo("Health", true, out subEle); subEle.Value = Health.ToString(); WriteUnusedXML(ele, master); ele.TryPathTo("Damage", true, out subEle); subEle.Value = Damage.ToString(); ele.TryPathTo("Strength", true, out subEle); subEle.Value = Strength.ToString(); ele.TryPathTo("Perception", true, out subEle); subEle.Value = Perception.ToString(); ele.TryPathTo("Endurance", true, out subEle); subEle.Value = Endurance.ToString(); ele.TryPathTo("Charisma", true, out subEle); subEle.Value = Charisma.ToString(); ele.TryPathTo("Intelligence", true, out subEle); subEle.Value = Intelligence.ToString(); ele.TryPathTo("Agility", true, out subEle); subEle.Value = Agility.ToString(); ele.TryPathTo("Luck", true, out subEle); subEle.Value = Luck.ToString(); }
public SkillStat GetCombatSkill(CombatSkill skill) { switch (skill) { case CombatSkill.Attack: return(Stats.Attack); case CombatSkill.Defense: return(Stats.Defense); case CombatSkill.Strength: return(Stats.Strength); case CombatSkill.Health: return(Stats.Health); case CombatSkill.Magic: return(Stats.Magic); case CombatSkill.Ranged: return(Stats.Ranged); } return(null); }
public void ShowSkillTooltip(string tip, CombatSkill combatSkill, RectTransform senderRect, ToolTipStyle style, ToolTipSize size) { if (CurrentTooltip == null) { CurrentTooltip = skillToolTip; } else if (CurrentTooltip != skillToolTip) { CurrentTooltip.Hide(); CurrentTooltip = skillToolTip; } UpdateToolTip(skillToolTip, senderRect, style); skillToolTip.UpdateSkillRanks(combatSkill); skillToolTip.CurrentTip = tip; skillToolTip.UpdateSize(size); skillToolTip.Show(senderRect); }
public static bool IsSkillUsable(FormationUnit performer, CombatSkill skill) { FormationParty friends; FormationParty enemies; if (performer.Team == Team.Heroes) { friends = RaidSceneManager.BattleGround.HeroParty; enemies = RaidSceneManager.BattleGround.MonsterParty; } else { friends = RaidSceneManager.BattleGround.MonsterParty; enemies = RaidSceneManager.BattleGround.HeroParty; } return(skill.LaunchRanks.IsLaunchableFrom(performer.Rank, performer.Size) && skill.HasAvailableTargets(performer, friends, enemies)); }
public void CombatSkillRepositoryTest() { // Arrange var combatSkill = new CombatSkill(1) { SkillName = "Melee", SkillAbility = new AbilityRepository().Retrieve(1), Description = "Hit people good" }; // Act var cmbSkillRepository = new CombatSkillRepository(); var cmbSkill = cmbSkillRepository.Retrieve(1); // Assert Assert.AreEqual(combatSkill.Description, cmbSkill.Description); Assert.AreEqual(combatSkill.SkillAbility.AbilityName, cmbSkill.SkillAbility.AbilityName); Assert.AreEqual(combatSkill.SkillAbility.Description, cmbSkill.SkillAbility.Description); Assert.AreEqual(combatSkill.SkillName, cmbSkill.SkillName); }
public void ShowSkillTooltip(Hero hero, CombatSkill combatSkill, PointerEventData eventData, RectTransform senderRect, ToolTipStyle style, ToolTipSize size) { if (CurrentTooltip == null) { CurrentTooltip = skillToolTip; } else if (CurrentTooltip != skillToolTip) { CurrentTooltip.Hide(); CurrentTooltip = skillToolTip; } skillToolTip.UpdateSize(size); UpdateToolTip(skillToolTip, eventData, senderRect, style); skillToolTip.UpdateSkillRanks(combatSkill); skillToolTip.CurrentTip = combatSkill.HeroSkillTooltip(hero); skillToolTip.Show(senderRect); }
public void setSkill(CombatSkill skill) { this.skill = skill; }
public void setDefault() { this.skill = CombatSkill.ACCURATE; this.style = CombatStyle.CRUSH; this.slot = 0; }
/// <summary> /// Will get combat skill details about the passed combat skill /// </summary> /// <param name="skill">Combat skill to get details about</param> /// <returns></returns> public SkillDetails GetCombatSkillDetails(CombatSkill skill) { // Get combat skill information from fface PlayerCombatSkills combatSkills = GetPlayerInformation().CombatSkills; // value of specific combat skill int value = 0; // see which skill is selected switch (skill) { case CombatSkill.Archery: value = combatSkills.Archery; break; case CombatSkill.Axe: value = combatSkills.Axe; break; case CombatSkill.Club: value = combatSkills.Club; break; case CombatSkill.Dagger: value = combatSkills.Dagger; break; case CombatSkill.Evasion: value = combatSkills.Evasion; break; case CombatSkill.GreatAxe: value = combatSkills.GreatAxe; break; case CombatSkill.GreatKatana: value = combatSkills.GreatKatana; break; case CombatSkill.GreatSword: value = combatSkills.GreatSword; break; case CombatSkill.Guarding: value = combatSkills.Guarding; break; case CombatSkill.HandToHand: value = combatSkills.HandToHand; break; case CombatSkill.Katana: value = combatSkills.Katana; break; case CombatSkill.Marksmanship: value = combatSkills.Marksmanship; break; case CombatSkill.Parrying: value = combatSkills.Parrying; break; case CombatSkill.Polearm: value = combatSkills.Polearm; break; case CombatSkill.Scythe: value = combatSkills.Scythe; break; case CombatSkill.Shield: value = combatSkills.Shield; break; case CombatSkill.Staff: value = combatSkills.Staff; break; case CombatSkill.Sword: value = combatSkills.Sword; break; case CombatSkill.Throwing: value = combatSkills.Throwing; break; default: throw new ArgumentException("Unknown combat skill passed to GetCombatSkillDetails()"); } // @ switch (skill) SkillDetails details = new SkillDetails(); details.Level = (value & 0xFFF); details.Capped = Convert.ToBoolean(((value & 0x8000) >> 15)); details.SkillType = MagicOrCombat.Combat; details.Skill = (int)skill; return details; }