public void Initialize(TapSkill skill) { _skill = skill; tooltip.Initialize(skill); icon.sprite = skill.LoadSprite(); }
public void ExecuteSkill(TapSkill skill, float damage) { data.AccumulatedDamage += damage; // Do shield breaking check currentMonster.BreakShieldCheck(skill); }
public void BreakShieldCheck(TapSkill skill) { if (isShielded && monster.TapType == TapMonsterType.Unique) { // if the shield is of an opposite type then break it if (GameManager.IsElementACounter(skill.element, monster.Element)) { isShielded = false; } } }
public void Btn_SkillTap() { TapSkill skill = hero.tapSkill; bool canUseTapAbility = cooldown >= cooldownTotal && !controller.IsAbilityTypeInPlay(skill.type); if (!canUseTapAbility) { return; } switch (hero.tapSkill.type) { case TapSkillType.DamageSkill: controller.ExecuteSkill(hero.tapSkill, hero.GetCoreStat(CoreStats.Damage) * skill.DamageMultiplier); //tapBattleRef.data.AccumulatedDamage += hero.GetCoreStat(CoreStats.Damage) * hero.tapSkill.DamageMultiplier; fctInterface.SpawnText(hero.GetCoreStat(CoreStats.Damage).ToString("0"), Vector2.zero + new Vector2(0f, 300f), 110f, CombatHitType.Glancing); // replace with monster position // for now just cause damage and reset cooldown hero.lastUsedTapAbility = DateTime.Now; skill.lastUsedTapAbility = hero.lastUsedTapAbility; // Play animation for skill handler.Skill(); break; case TapSkillType.DPSBoost: case TapSkillType.TapDamageBoost: case TapSkillType.AutoTap: hero.lastUsedTapAbility = DateTime.Now; skill.lastUsedTapAbility = hero.lastUsedTapAbility; controller.activeSkills.Add(skill); break; } //Update TapAbility with the API: GameAPIManager.API.Heroes.SetTapAbility(hero, hero.lastUsedTapAbility) .Then(res => { Tracer.trace("Successfully updated hero Tap-Ability server-side."); }) .Catch(err => { Tracer.traceError("Could not update hero Tap-Ability server-side! " + err.Message); }); }
public void Initialize(TapSkill skill) { overlayContainer = GameObject.FindGameObjectWithTag("OverlayContainer").GetComponent <RectTransform>(); restContainer = gameObject.transform.parent.transform; SkillName.text = skill.Name; Cooldown.text = "Cooldown: " + skill.cooldown + " Minutes\n"; if (skill.type == TapSkillType.DamageSkill) { Cooldown.text += "Duration: Instant"; } else { Cooldown.text += "Duration: " + skill.duration + " Seconds"; } Description.text = skill.TooltipText; scaler.DOScale(0f, 0f); }
public bool IsAbilityTypeInPlay(TapSkillType type) { TapSkill remove = null; foreach (TapSkill skill in activeSkills) { if (skill.type == type && skill.isActive()) { return(true); } else if (skill.type == type && !skill.isActive()) { remove = skill; // will only remove 1 skill per check, but we are checking often enough for it not to matter } } activeSkills.Remove(remove); return(false); }
public Hero(HeroData data, int Seed, int QualityLevel = 0, Dictionary <string, int> skillLevelDictionary = null) { this.data = data; if (data == null) { Tracer.traceWarn("Testing dummy Hero object."); return; } // Hero Variance _heroVarianceSeed = Seed; Random.InitState(_heroVarianceSeed); // Hero Quality _quality = HeroQuality.Common + this.QualityLevel; float Qchance = Random.Range(0f, 1f); if (Qchance <= dataMan.globalData.GetGlobalAsFloat(GlobalProps.SUMMON_QUALITY_3STAR)) { _quality = HeroQuality.Legendary; } else if (Qchance <= (dataMan.globalData.GetGlobalAsFloat(GlobalProps.SUMMON_QUALITY_3STAR) + dataMan.globalData.GetGlobalAsFloat(GlobalProps.SUMMON_QUALITY_2STAR))) { _quality = HeroQuality.Rare + this.QualityLevel; } // Hero Personality HeroPersonality[] personalities = (HeroPersonality[])System.Enum.GetValues(typeof(HeroPersonality)); int personatlityIndex = Random.Range(0, personalities.Length); personality = personalities[personatlityIndex]; if (data.Skills != null && data.Skills.Count > 0) { if (data.Skills.Count > 4) { Debug.LogError("Too many skills on hero: " + data.Identity); for (int i = 0; i < (data.Skills.Count - 4); i++) { data.Skills.RemoveAt(data.Skills.Count - 1); Debug.Log("Remove skill on " + data.Identity + " at index [" + (data.Skills.Count - 1) + "]"); } } foreach (Skill skill in data.Skills) { Skills.Add((Skill)UnityEngine.Object.Instantiate(skill)); /*if (skillLevelDictionary != null && skillLevelDictionary.Count > 0) // skills exist on the server * SkillLevels.Add(skill.Identity, skillLevelDictionary[skill.Identity]); * else * SkillLevels.Add(skill.Identity, 1);*/ } ResetSkillsCooldown(); tapSkill = GameManager.Instance.GetRandomTapSkill(); if (tapSkill == null) { Tracer.traceCounter("TapSkill is null, probably because there was no TapSkills in the GameManager (yet?)"); } } else { Tracer.traceError("This hero has no skills: " + this.DebugID); } //Let's the GameManager know to check all heroes to run CheckHasWeapon() method. GameManager.Instance.checkHeroWeapons = true; }