Exemplo n.º 1
0
    public IEnumerator Co_UpdateValue(SideEffectExecute buffSee, PlayerBuffUpdateRequest.UpdateTypes updateType)
    {
        BuffDescText.text = Utils.TextMeshProColorStringConvertToText(((PlayerBuffSideEffects)buffSee.SideEffectBases[0]).GenerateDesc());
        PlayerBuffSideEffects buff = (PlayerBuffSideEffects)buffSee.SideEffectBases[0];
        int buffValue = GetBuffValue(buffSee, buff);

        if (buffValue >= 0)
        {
            if (updateType == PlayerBuffUpdateRequest.UpdateTypes.Trigger)
            {
                BuffAnim.SetTrigger("Jump");
                AudioManager.Instance.SoundPlay("sfx/OnBuffTrigger", 0.7f);
            }

            else if (updateType == PlayerBuffUpdateRequest.UpdateTypes.Refresh)
            {
                BuffAnim.SetTrigger("Rotate");
                AudioManager.Instance.SoundPlay("sfx/OnBuffTrigger", 0.7f);
            }
        }

        yield return(new WaitForSeconds(0.2f));

        BuffValueText.text = buffValue == 0 ? "" : buffValue.ToString();
        yield return(new WaitForSeconds(0.1f));

        yield return(null);
    }
Exemplo n.º 2
0
    public void Init(SideEffectExecute buffSee, int buffId)
    {
        Cur_Buff = ((PlayerBuffSideEffects)buffSee.SideEffectBases[0]);
        int buffValue = GetBuffValue(buffSee, Cur_Buff);

        BuffValueText.text = buffValue == 0 ? "" : buffValue.ToString();
        BuffId             = buffId;
        ClientUtils.ChangeImagePicture(Image, Cur_Buff.M_SideEffectParam.GetParam_ConstInt("BuffPicId"));
        Color buffColor = ClientUtils.HTMLColorToColor(AllBuffs.GetBuff((Cur_Buff.Name)).M_SideEffectParam.GetParam_String("BuffColor"));

        BuffBloom.color        = buffColor;
        BuffDescText.color     = buffColor;
        BuffValuePanel.enabled = Cur_Buff.M_SideEffectParam.GetParam_Bool("HasNumberShow");
        BuffValueText.enabled  = Cur_Buff.M_SideEffectParam.GetParam_Bool("HasNumberShow");
        BuffAnim.SetTrigger("Add");
        BuffDescText.text = Utils.TextMeshProColorStringConvertToText(Cur_Buff.GenerateDesc());
    }
Exemplo n.º 3
0
    public IEnumerator DoMoves(Move move, Monster attacker, Monster defender)
    {
        if (attacker != null)
        {
            Debug.Log("Doing Moves");
            WriteToLog(attacker.name + " used " + move.name + "!");
            isTurnInProgress = true;
            var       isSTAB = false;
            var       dmg    = 0;
            AtkAnim   AtkAnimDel1st;
            FaintAnim FaintAnimDel1st;
            BuffAnim  BuffAnimDel1st;

            AtkAnim   AtkAnimDel2nd;
            FaintAnim FaintAnimDel2nd;
            BuffAnim  BuffAnimDel2nd;

            if (attacker == player1Monster)
            {
                AtkAnimDel1st   = new AtkAnim(PlayAtkAnimP1);
                FaintAnimDel1st = new FaintAnim(PlayFaintAnimP1);
                BuffAnimDel1st  = new BuffAnim(PlayStatusAnimP1);

                AtkAnimDel2nd   = new AtkAnim(PlayAtkAnimP2);
                FaintAnimDel2nd = new FaintAnim(PlayFaintAnimP2);
                BuffAnimDel2nd  = new BuffAnim(PlayStatusAnimP2);
            }
            else
            {
                AtkAnimDel1st   = new AtkAnim(PlayAtkAnimP2);
                FaintAnimDel1st = new FaintAnim(PlayFaintAnimP2);
                BuffAnimDel1st  = new BuffAnim(PlayStatusAnimP2);

                AtkAnimDel2nd   = new AtkAnim(PlayAtkAnimP1);
                FaintAnimDel2nd = new FaintAnim(PlayFaintAnimP1);
                BuffAnimDel2nd  = new BuffAnim(PlayStatusAnimP1);
            }

            if (attacker.type1 == move.type || attacker.type2 == move.type)
            {
                //is stab
                isSTAB = true;
            }
            else
            {
                isSTAB = false;
            }

            //FIRST ATTACKS SECOND
            switch (move.cat)
            {
            case Category.PHYSICAL:
                var dmg1 = (int)Mathf.Floor((float)((move.power) * (isSTAB ? 1.5f : 1f)) * (attacker.ATK.getTrueValue() / defender.DEF.getTrueValue()) * 0.3f * (TypeUtils.Effectiveness(move.type, defender.type1) * TypeUtils.Effectiveness(move.type, defender.type2)));

                defender.receiveDamage(dmg1);
                //Debug.Log(move.secondaryEffects[0]);
                yield return(AtkAnimDel1st(move));

                /*
                 * foreach (SecondaryEffect se in move.secondaryEffects) {
                 *  if (se != null) {
                 *      var affectsOthers = false;
                 *      if (se.type == SecondaryEffectType.OTHER) {
                 *          affectsOthers = true;
                 *      }
                 *
                 *      if (affectsOthers) {
                 *          yield return BuffAnimDel1st (move);
                 *          yield return ApplyEffect (se, defender);
                 *      } else {
                 *          yield return BuffAnimDel1st (move);
                 *          yield return ApplyEffect (se, attacker);
                 *      }
                 *  }
                 * }
                 */
                break;

            case Category.SPECIAL:
                var dmg2 = (int)Mathf.Floor((float)((move.power) * (isSTAB ? 1.5f : 1f)) * (attacker.spATK.getTrueValue() / defender.spDEF.getTrueValue()) * 0.3f * (TypeUtils.Effectiveness(move.type, defender.type1) * TypeUtils.Effectiveness(move.type, defender.type2)));
                Debug.Log("First attacks defender: " + dmg2);
                defender.receiveDamage(dmg2);
                //Debug.Log(move.secondaryEffects[0]);
                yield return(AtkAnimDel1st(move));

                /*
                 * foreach (SecondaryEffect se in move.secondaryEffects) {
                 *  if (se != null) {
                 *      var affectsOthers = false;
                 *      if (se.type == SecondaryEffectType.OTHER) {
                 *          affectsOthers = true;
                 *      }
                 *
                 *      if (affectsOthers) {
                 *          yield return BuffAnimDel1st (move);
                 *          yield return ApplyEffect (se, defender);
                 *      } else {
                 *          yield return BuffAnimDel1st (move);
                 *          yield return ApplyEffect (se, attacker);
                 *      }
                 *  }
                 * }
                 */
                break;

            case Category.STATUS:
                //nothing special. All it does is the buff / debuff animations which already happen with other moves

                yield return(BuffAnimDel1st(move));

                /*
                 * foreach (SecondaryEffect se in move.secondaryEffects) {
                 *  if (se != null) {
                 *      var affectsOthers = false;
                 *      if (se.type == SecondaryEffectType.OTHER) {
                 *          affectsOthers = true;
                 *      }
                 *
                 *      if (affectsOthers) {
                 *          yield return BuffAnimDel1st (move);
                 *          yield return ApplyEffect (se, defender);
                 *      } else {
                 *          yield return BuffAnimDel1st (move);
                 *          yield return ApplyEffect (se, attacker);
                 *      }
                 *  }
                 * } */
                break;
            }

            if (defender.currentHP <= 0)
            {
                yield return(FaintAnimDel2nd());

                //turn is over
                yield break;
            }

            if (move.secondaryEffects != null)
            {
                foreach (SecondaryEffect se in move.secondaryEffects)
                {
                    if (se != null)
                    {
                        var affectsOthers = false;
                        if (se.type == SecondaryEffectType.OTHER)
                        {
                            affectsOthers = true;
                        }

                        if (affectsOthers)
                        {
                            yield return(ApplyEffect(se, defender));
                        }
                        else
                        {
                            yield return(ApplyEffect(se, attacker));
                        }
                    }
                }
            }


            /*
             * if (defender.type1 == secondMove.type || defender.type2 == secondMove.type) {
             *  //is stab
             *  isSTAB = true;
             * } else {
             *  isSTAB = false;
             * }
             *
             *
             * //SECOND ATTACKS FIRST
             * switch (secondMove.cat) {
             *  case Category.PHYSICAL:
             *      var dmg3 = (int) Mathf.Floor (((secondMove.power) * (isSTAB ? 1.5f : 1f)) * (defender.ATK.getTrueValue() / attacker.DEF.getTrueValue()) * 0.3f * (TypeUtils.Effectiveness (secondMove.type, attacker.type1) * TypeUtils.Effectiveness (secondMove.type, attacker.type2)));
             *      attacker.receiveDamage (dmg3);
             *      Debug.Log ("Second attacks attacker: " + dmg3);
             *      yield return AtkAnimDel2nd (secondMove);
             *      break;
             *
             *  case Category.SPECIAL:
             *      attacker.receiveDamage ((int) Mathf.Floor (((secondMove.power) * (isSTAB ? 1.5f : 1f)) * (defender.spATK.getTrueValue() / attacker.spDEF.getTrueValue()) * 0.3f * (TypeUtils.Effectiveness (secondMove.type, attacker.type1) * TypeUtils.Effectiveness (secondMove.type, attacker.type2))));
             *      yield return AtkAnimDel2nd (secondMove);
             *      break;
             *
             *  case Category.STATUS:
             *      foreach (SecondaryEffect se in secondMove.secondaryEffects) {
             *      var affectsOthers = false;
             *      if (se.type == SecondaryEffectType.OTHER) {
             *          affectsOthers = true;
             *      }
             *      if (affectsOthers) {
             *              yield return BuffAnimDel2nd (secondMove);
             *              yield return ApplyEffect (se, attacker);
             *      } else {
             *              yield return BuffAnimDel2nd (secondMove);
             *              yield return ApplyEffect (se, defender);
             *       }
             *      }
             *
             *      break;
             *
             * }
             *
             * if (attacker.currentHP <= 0) {
             *  yield return FaintAnimDel1st ();
             *
             *  yield break; //turn is over
             * }
             */
            isTurnInProgress = false;
        }
    }
Exemplo n.º 4
0
 public void OnRemove()
 {
     BuffAnim.SetTrigger("Remove");
 }