private void AddDamageToTarget(Poring poring, Poring targetPoring, float damage) { if (EffectOnHit != null) { InstantiateParticleEffect.CreateFx(EffectOnHit, targetPoring.transform.localPosition); } foreach (var s in StrongerList) { if (targetPoring.CheckHasStatus(s.Status)) { damage *= s.DamageMultiple; } } bool isAlive = targetPoring.TakeDamage(poring, damage); if (isAlive) { isAlive = targetPoring.OnReceiverEffect(SetEffectOwnerIdAndDamage(poring)); } if (!isAlive) { targetPoring.Behavior.Respawn(); } }
public bool TakeDamage(Poring ownerDamage, float damageResult, bool ignoreUltimate = false, GameObject particle = null) { if (!ignoreUltimate && damageResult != 0) { PrototypeGameMode.Instance.AddPoringCanGetUltimatePoint(this); PrototypeGameMode.Instance.AddPoringCanGetUltimatePoint(ownerDamage); } Property.CurrentHp -= damageResult; if (particle != null) { InstantiateParticleEffect.CreateFx(particle, transform.position); } if (Property.CurrentHp > 0) { Animator.Play((damageResult == 0) ? "Dodge" : "take_damage"); return(true); } else { Animator.Play("die"); if (ownerDamage != null) { ownerDamage.Property.CurrentPoint += Property.CurrentPoint / 2; ownerDamage.WinCondition += 1; } m_currentEffects.Clear(); m_currentIconEffects.ForEach(icon => Destroy(icon.image.gameObject)); m_currentIconEffects.Clear(); PrototypeGameMode.Instance.CheckEndGame(); return(false); } }
public List <EffectReceiver> OnEnter(Node node) { InstantiateParticleEffect.CreateFx(EffectOnTrigger, transform.position); if (DestroyOnTrigger) { node.effectsOnTile.Remove(this); Destroy(gameObject); } return(EffectsDetail); }
public override void OnFinish(Poring poring, Node node) { var e = new EffectReceiver() { EffectDuration = 1, Status = SkillStatus.Ambursh }; InstantiateParticleEffect.CreateFx(particle, poring.transform.position); poring.OnReceiverEffect(new List <EffectReceiver>() { e }); }
public override void OnEnter(Poring poring, Node node) { var e = new EffectReceiver() { OwnerId = -1, Damage = tileDamage, EffectDuration = 5, Status = SkillStatus.Posion, Particle = particle }; InstantiateParticleEffect.CreateFx(particle, poring.transform.position); poring.OnReceiverEffect(new List <EffectReceiver>() { e }); }
private IEnumerator WaitForAnimation(Poring poring, Poring targetPoring = null, Node targetNode = null) { // Magnum Break poring.Animator.Play(AnimationStateName); yield return(new WaitForSeconds(2)); if (EffectOnSelf != null) { InstantiateParticleEffect.CreateFx(EffectOnSelf, poring.transform.position); } AOESkillActivate(poring, poring.Node, AOEValue); if (!MoveToTarget && gameMode.IsMineTurn()) { TurnActiveUIController.Instance.SetActivePanel(true, poring.Node.TileProperty.Type); } else { TurnActiveUIController.Instance.NotMyTurn(); } }
private IEnumerator WaitForAnimation(Poring poring, Node targetNode) { poring.Animator.Play(AnimationStateName); p = poring; yield return(new WaitForSeconds(0.5f)); InstantiateParticleEffect.CreateFx(EffectOnSelf, poring.transform.position); CurrentCD = TurnCD; CheckAOEToCreate(targetNode, AOEValue); if (PrototypeGameMode.Instance.IsMineTurn()) { TurnActiveUIController.Instance.SetActivePanel(true, poring.Node.TileProperty.Type); } else { TurnActiveUIController.Instance.NotMyTurn(); } PrototypeGameMode.Instance.CurrentGameState = (poring.Property.UltimateSkill.name == name) ? eStateGameMode.EndTurn : PrototypeGameMode.Instance.CurrentGameState; }
private IEnumerator WaitForDiceResult() { yield return(new WaitUntil(() => Poring.OffensiveResultList.Count > 0 && Poring.Target.DeffensiveResultList.Count > 0)); TurnFaceTo(Poring.Target.transform.position); hasAttack = true; OnAttackSkillResult attackerDiceResult = CalculateAtackerDiceResult(Poring); OnDefenseSkillResult defenderDiceResult = CalculateDefenderDiceResult(Poring, Poring.Target); EffectReceiver maximizePower; switch (defenderDiceResult.Type) { case DefenseTypeResult.None: break; case DefenseTypeResult.Counter: Poring.Target.Animator.Play("Skill"); yield return(waitSecond); maximizePower = Poring.Target.GetStatus(SkillStatus.MaximizePower); defenderDiceResult.DamageResult *= (maximizePower != null) ? maximizePower.Damage : 1; Poring.Property.CurrentHp -= defenderDiceResult.DamageResult; if (defenderDiceResult.EffectOnTarget != null) { InstantiateParticleEffect.CreateFx(defenderDiceResult.EffectOnTarget, Poring.transform.localPosition); } if (Poring.TakeDamage(Poring.Target, defenderDiceResult.DamageResult)) { yield return(waitSecond); Poring.OnReceiverEffect(defenderDiceResult.EffectStatusResults); if (!Poring.Target.Behavior.hasAttack && Poring.Node == Poring.Target.Node) { Poring.Target.Target = Poring; Poring.Target.Behavior.AttackTarget(); yield break; } else { Poring.Target.Behavior.hasAttack = hasAttack = false; Poring.Target.Target = Poring.Target = null; m_gameMode.CurrentGameState = eStateGameMode.EndTurn; yield break; } } else { yield return(waitSecond); Poring.Behavior.Respawn(); Poring.Target.Behavior.hasAttack = hasAttack = false; Poring.Target.Target = Poring.Target = null; m_gameMode.CurrentGameState = eStateGameMode.EndTurn; yield break; } case DefenseTypeResult.Dodge: break; } float damageResult = AdaptiveDamageCalculate(Poring); damageResult = AdaptiveDefenseCalculate(damageResult, Poring.Target); maximizePower = Poring.GetStatus(SkillStatus.MaximizePower); damageResult *= (maximizePower != null) ? maximizePower.Damage : 1; Poring.Animator.Play("Skill"); yield return(waitSecond); switch (attackerDiceResult.Type) { case AttackTypeResult.None: break; case AttackTypeResult.Double: case AttackTypeResult.PowerUp: case AttackTypeResult.Enchant: InstantiateParticleEffect.CreateFx(attackerDiceResult.EffectOnTarget, Poring.Target.transform.localPosition); Poring.Target.OnReceiverEffect(attackerDiceResult.EffectStatusResults); break; } if (damageResult != 0 && Poring.Property.NormalAttackEffect != null) { InstantiateParticleEffect.CreateFx(Poring.Property.NormalAttackEffect, Poring.Target.transform.position); } if (Poring.Target.TakeDamage(Poring, damageResult)) // alive { yield return(waitSecond); if (!Poring.Target.Behavior.hasAttack && Poring.Node == Poring.Target.Node && !Poring.Target.CheckHasStatus(SkillStatus.Freeze | SkillStatus.Sleep | SkillStatus.Stun) && // target is not freeze, sleep, stun !Poring.CheckHasStatus(SkillStatus.Ambursh)) // Attacker is not ambursh { Poring.Target.Target = Poring; Poring.Target.Behavior.AttackTarget(); } else { Poring.Target.Behavior.hasAttack = hasAttack = false; Poring.Target.Target = Poring.Target = null; m_gameMode.CurrentGameState = eStateGameMode.EndTurn; } } else // die { yield return(waitSecond); Poring.Target.Behavior.Respawn(); Poring.Target.Behavior.hasAttack = hasAttack = false; Poring.Target.Target = Poring.Target = null; m_gameMode.CurrentGameState = eStateGameMode.EndTurn; } }
private IEnumerator WaitForAnimation(Poring poring, float damage, Poring targetPoring = null, Node targetNode = null) { if (targetPoring != null) { // bash poring.transform.LookAt(targetPoring.gameObject.transform); poring.Animator.Play(AnimationStateName); yield return(new WaitForSeconds(2f)); targetOnRoute.ForEach(p => { if (p != targetPoring) { if (EffectOnSelf != null) { InstantiateParticleEffect.CreateFx(EffectOnSelf, p.transform.position); } AddDamageToTarget(poring, p, damage); } }); if (EffectOnSelf != null) { InstantiateParticleEffect.CreateFx(EffectOnSelf, targetPoring.transform.position); } AddDamageToTarget(poring, targetPoring, damage); } else if (targetNode != null) { // thunder bolt poring.transform.LookAt(targetNode.gameObject.transform); poring.Animator.Play(AnimationStateName); if (EffectOnSelf != null) { InstantiateParticleEffect.CreateFx(EffectOnSelf, poring.transform.position); } yield return(new WaitForSeconds(2f)); if (EffectOnTarget != null) { InstantiateParticleEffect.CreateFx(EffectOnTarget, targetNode.transform.position); } AOESkillActivate(poring, targetNode, AOEValue, damage); } else { // Magnum Break poring.Animator.Play(AnimationStateName); yield return(new WaitForSeconds(2.5f)); if (EffectOnSelf != null) { InstantiateParticleEffect.CreateFx(EffectOnSelf, poring.transform.position); } AOESkillActivate(poring, poring.Node, AOEValue, damage); } if (!MoveToTarget && gameMode.IsMineTurn()) { TurnActiveUIController.Instance.SetActivePanel(true, poring.Node.TileProperty.Type); } else { TurnActiveUIController.Instance.NotMyTurn(); } gameMode.CurrentGameState = nextState; }