private void ResetStats() { healthUI = EnemyUIControl.Instance.healthWhite.GetComponent <UIShake>(); ai._facement = new HorizontalFacement(); SetEnemyLevel(EnemyLevel.Boss); ForceAdjustAttackDelay(); }
protected virtual void UpdateTimeToHit() { timeSinceLastHit += Time.deltaTime; if (hitTimers.Count == 0) { fighter.activeAttack -= UpdateTimeToHit; return; } if (timeSinceLastHit >= maxTimeToHit) { hitTimers.Remove(hitTimers[0]); timeSinceLastHit = 0; // On deal damage, calculate current buffs and update next buffs float damage = CalculateDamage(); if (target.TakeDamage(damage, isCrit)) { shaker = target.GetComponent <UIShake>(); StartCoroutine(shaker.Shake(shakeDuration, shakeMagnitude, shakeCount)); player.DamageDealt(damage); CheckEffectActivation(true); } currentHitCount += 1; if (currentHitCount >= maxHitCount || hitTimers.Count == 0) { fighter.activeAttack -= UpdateTimeToHit; } else { timeSinceLastHit = 0; for (int i = 0; i < hitTimers.Count; i++) { hitTimers[i].SetFighter(fighter); hitTimers[i].SetMoveTime(.2f); } maxTimeToHit = GetStat(AttackStat.TimeToHit, currentHitCount); float atkSpeed = fighter.GetStat(Stat.AttackSpeed); atkSpeed = 1 / atkSpeed * 100; maxTimeToHit *= atkSpeed; hitTimers[0].SetFillTime(maxTimeToHit); } } }
public virtual void CalculateReflectDamage() { float total = 0; float atkPower = fighter.GetStat(Stat.AttackPower); float lastHitPower = GetStat(AttackStat.Power, (int)maxHitCount - 1); atkPower *= lastHitPower; if (GetStatBool(AttackStat.Bloodlust, (int)maxHitCount - 1)) { float hPercent = target.GetPercentage(); float mult = 100; if (hPercent < 50) { mult += 78 - Mathf.Floor(hPercent / 5) * 4; } else if (hPercent < 95) { mult += 76 - Mathf.Floor(hPercent / 5) * 4; } atkPower *= (mult / 100); } float enemyDef = targetStats.GetStat(Stat.Defense); float enemyReduction = targetStats.GetStat(Stat.DamageReduction) / 100; total = Mathf.Ceil(atkPower / enemyDef) * (1 - enemyReduction); // Reflect always crits float critPower = fighter.GetStat(Stat.CritDamage) / 100; total *= critPower; // Get player damage modifier float damageMod = 1 + fighter.GetStat(Stat.Damage) / 100; total *= damageMod; //Reflect is 40% damage total *= 0.4f; shaker = target.GetComponent <UIShake>(); StartCoroutine(shaker.Shake(shakeDuration, shakeMagnitude / 2, shakeCount)); target.TakeDamage(total, true); player.DamageDealt(total); }
void OnGUI() { EditorGUILayout.LabelField("Time", Time.time.ToString()); EditorGUILayout.BeginHorizontal(); { Time.timeScale = EditorGUILayout.Slider("TimeScale", Time.timeScale, 0, 16); if (GUILayout.Button("1")) { Time.timeScale = 1; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("StartRealTimeRound")) { GameManager.Instance.StartRealTimeRound(); } if (GUILayout.Button("UploadChallengeOk")) { GameData.LastChallengeMajorLevelID = 1; CommonData.MyUser.ExpCeil = 1000; CommonData.MyUser.Exp = 550; CommonData.MyUser.ExpFloor = 0; MainRoot.Goto(MainRoot.UIStateName.EndRound); Responder.Instance.Execute(TestData.UploadChallengeOk0); EndRoundUI.Instance.PlayEndRoundProcess(TestData.UploadChallengeOk0); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("Add Hp Prob")) { GameData.LastSubLevelData.HealthBottleProbability = 1000; GameData.LastSubLevelData.HealthBottleCapacity = 50; } if (GUILayout.Button("Energy Bottle")) { GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Item, 203)); } if (GUILayout.Button("MoneySack")) { GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Item, 204)); } if (GUILayout.Button("Stone")) { GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Stone, -1)); } if (GUILayout.Button("Chest")) { GameManager.Instance.MyGrid.AddItemToQueue(new CandyInfo(Candy.CandyType.Chest, -1)); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("AllHints(10s)")) { GameManager.Instance.PlaySkillEffect_AllHints(10); } if (GUILayout.Button("HideGenre(20s)")) { GameManager.Instance.PlaySkillEffect_HideGenre(20); } if (GUILayout.Button("Shake(0.05, 5)")) { UIShake.ShakeAUI(GameUI.Instance.gameObject, 0.05f, 5); } } EditorGUILayout.EndHorizontal(); }
public void SetTarget(Health _target) { target = _target; targetStats = target.GetComponentInParent <BaseStats>(); shaker = target.GetComponent <UIShake>(); }