Esempio n. 1
0
    public override IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target)
    {
        if (ActionStarted == true)
        {
            yield break;
        }
        ActionStarted = true;

        //Wait (Later, do Attack Animation here
        yield return(new WaitForSeconds(1.5f));

        //Buff the ATK
        Actor.BuffStat(Actor.Stats.ATK, Actor.Stats.CHR, ActPow);

        if (Actor.Stats.ATK.Current == Actor.Stats.ATK.Base * 2)
        {
            Actor.BSM.DisplayNote("Attack is Maxed Out.");
        }
        else
        {
            Actor.BSM.DisplayNote("Attack has Increased.");
        }

        yield return(new WaitForSeconds(1.5f));

        //Set BSM
        Actor.BSM.TheTurn = BattleStateMachine.TurnStates.DONE;

        //End Coroutine
        ActionStarted = false;
    }
 //Function for finishing the match
 public void FinishMatch(BaseCharStateMachine Winner, BaseCharStateMachine Loser, string WinReason)
 {
     Winner.TurnState = BaseCharStateMachine.CharTurnState.WIN;
     Loser.TurnState  = BaseCharStateMachine.CharTurnState.LOSS;
     TheTurn          = TurnStates.MATCHFINISHED;
     this.WinReason   = WinReason;
 }
    public override IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target)
    {
        if (ActionStarted == true)
        {
            yield break;
        }
        ActionStarted = true;

        Actor.BSM.DisplayNote(Actor.Stats.Name + " looked under the ring...");

        int RNGesus = Random.Range(0, Weapons.Count);

        //Add Weapon to Actor's Special Action
        Actor.AddOrReplaceSpecialAction(Weapons[RNGesus]);

        yield return(new WaitForSeconds(1.5f));

        Actor.BSM.DisplayNote(Actor.Stats.Name + " found a " + Weapons[RNGesus].ActName);

        Actor.AddMomentum(5f, MoveType);

        yield return(new WaitForSeconds(1.5f));

        //Set BSM
        Actor.BSM.TheTurn = BattleStateMachine.TurnStates.DONE;

        //End Coroutine
        ActionStarted = false;
    }
Esempio n. 4
0
    //If character cannot afford move, return false
    public bool IsCostOfActionPossible(BaseCharStateMachine Actor)
    {
        //Apply HP or SP as needed
        if (CostsHP == true)
        {
            //Is CurrentStat > ActCost?
            if (Actor.Stats.HP.Current > ActCost)
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }

        else
        {
            //Is CurrentStat > ActCost?
            if (Actor.Stats.SP.Current >= ActCost)
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
    }
Esempio n. 5
0
    public override IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target)
    {
        if (ActionStarted == true)
        {
            yield break;
        }
        ActionStarted = true;

        //Move Character to Target
        while (MoveToTarget(Actor.Wrestler, Target.Wrestler))
        {
            yield return(null);
        }

        //Wait (Later, do Attack Animation here
        yield return(new WaitForSeconds(0.5f));

        //Calculate Damage
        float Damage = Target.CalculateDamage(ActPow, Actor.Stats.ATK.Current, Target.Stats.DEF.Current);

        //Do Damage
        Target.DamageHP(Damage);

        //Damage WP
        Target.DamageWP(Damage);

        //Add momentum to Target
        float Momentum = (Damage / (Target.Stats.HP.Base * 2)) * 100;

        Target.AddMomentum(Momentum * 0.5f, MoveType);

        //Reset Actor's momentum
        Actor.ResetMomentum();

        //If target is down, reset turns down
        if (Target.Status_Down == true)
        {
            Target.Turns_Down = 0;
        }

        while (MoveToPosition(Actor.Wrestler, Actor.startPosition))
        {
            yield return(null);
        }

        //Set BSM
        Actor.BSM.TheTurn = BattleStateMachine.TurnStates.DONE;

        //End Coroutine
        ActionStarted = false;
    }
Esempio n. 6
0
    public override IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target)
    {
        if (ActionStarted == true)
        {
            yield break;
        }
        ActionStarted = true;

        yield return(new WaitForSeconds(2f));

        //Add SP
        Actor.Stats.SP.Current += 10f;
        Actor.ZeroOrMax(Actor.Stats.SP);

        //Set BSM
        Actor.BSM.TheTurn = BattleStateMachine.TurnStates.DONE;

        //End Coroutine
        ActionStarted = false;
    }
Esempio n. 7
0
    public override IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target)
    {
        if (ActionStarted == true) yield break;
        ActionStarted = true;

        //Move Character to Target
        while (MoveToTarget(Actor.Wrestler, Target.Wrestler))
        {
            yield return null;
        }

        //Wait (Later, do Attack Animation here
        yield return new WaitForSeconds(0.5f);

        //Calculate Damage
        float Damage = Target.CalculateDamage(ActPow, Actor.Stats.ATK.Current, Target.Stats.DEF.Current);

        //Do Damage
        Target.DamageHP(Damage);

        //Damage WP
        Target.DamageWP(Damage);

        //Add momentum to both characters
        float Momentum = (Damage / (Target.Stats.HP.Base * 2)) * 100;
        Actor.AddMomentum(Momentum, MoveType);
        Target.AddMomentum(Momentum * 0.5f, Type.NEUTRAL);

        while (MoveToPosition(Actor.Wrestler, Actor.startPosition))
        {
            yield return null;
        }

        //Set BSM
        Actor.BSM.TheTurn = BattleStateMachine.TurnStates.REFFCHECK;

        //End Coroutine
        ActionStarted = false;
    }
    // Update is called once per frame
    void Update()
    {
        switch (TheTurn)
        {
        case (TurnStates.WAIT):
        {
            //idle state
            break;
        }

        case (TurnStates.WHOSNEXT):
        {
            //Disable NotePanel
            DeactivateNote();

            CurrentChar = GetNextTurn();

            if (CurrentChar.Status_Down == true)
            {
                TheTurn = TurnStates.ISDOWNED;
            }
            else
            {
                TheTurn = TurnStates.GETACTION;
            }

            break;
        }

        case (TurnStates.GETACTION):
        {
            CurrentChar.TurnState = BaseCharStateMachine.CharTurnState.GETACTION;
            TheTurn = TurnStates.WAIT;
            break;
        }

        case (TurnStates.PERFORMACTION):
        {
            //Take cost from currentchar once
            if (ThisTurn.Action.ActionStarted == false)
            {
                CurrentChar.TakeCostOfAction(ThisTurn.Action);
                DisplayNote();
            }

            // Perform Chosen Action
            StartCoroutine(ThisTurn.Action.PerformAction(ThisTurn.Actor, ThisTurn.Target));

            break;
        }

        case (TurnStates.REFFCHECK):
        {
            CheckForDQ();
            break;
        }

        case (TurnStates.DONE):
        {
            // If Character was Downed this turn, change their state and CurrentTurn gets another turn
            if (ThisTurn.Target.Status_Down == false && ThisTurn.Target.Stats.HP.Current == 0f)
            {
                DisplayNote(ThisTurn.Target.Stats.Name + " is Down!");

                ThisTurn.Target.Status_Down = true;
                if (ThisTurn.Target.Status_Defend == true)
                {
                    ThisTurn.Target.Status_Defend = false;
                }
                ThisTurn.Target.StartWP = ThisTurn.Target.Stats.WP.Current;
                TheTurn = TurnStates.GETACTION;
            }

            // Else, End turn
            else
            {
                TheTurn = TurnStates.WHOSNEXT;
            }

            Destroy(GameObject.Find(ThisTurn.Action.name));
            break;
        }

        case (TurnStates.ISDOWNED):
        {
            // This character tries to get up.
            CurrentChar.TurnState = BaseCharStateMachine.CharTurnState.DOWN;

            //Wait for update from Character State Maching
            TheTurn = TurnStates.WAIT;
            break;
        }

        case (TurnStates.MATCHFINISHED):
        {
            //For now, just check who won. Add character specific stuff later.
            bool pWin = false;

            foreach (BaseCharStateMachine Character in AllChars)
            {
                if (Character.TurnState == BaseCharStateMachine.CharTurnState.WIN && Character.type == "PLAYER")
                {
                    pWin = true;
                }
            }

            //Create Win Message
            string WinMessage = PlayerChars[0].GetComponent <PlayerStateMachine>().Stats.Name;

            for (int x = 1; x < PlayerChars.Count; x++)
            {
                if (x < PlayerChars.Count - 1)
                {
                    WinMessage = WinMessage + " and " + PlayerChars[x].GetComponent <PlayerStateMachine>().Stats.Name;
                }
                else
                {
                    WinMessage = WinMessage + ", " + PlayerChars[x].GetComponent <PlayerStateMachine>().Stats.Name;
                }
            }

            //If the player won, have that appear
            if (pWin)
            {
                WinMessage += " Win";
            }
            else
            {
                WinMessage += " Lose";
            }

            //Display Win Message
            DisplayNote(WinMessage + " by " + WinReason + "!");

            //Wait for scene transition
            StartCoroutine(EndOfMatch());
            TheTurn = TurnStates.WAIT;

            break;
        }
        }
    }
Esempio n. 9
0
    public bool Finisher;       //Is this move a Finisher (Only used by CPU)

    public abstract IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target);
Esempio n. 10
0
    float ActorCount0, ActorCount1, ActorCount2; //Modifiers for chances on each count. 0 = ActorWP%, 1 = ActorWP% * 0.75, 2 = ActorWP% * 0.50.

    public override IEnumerator PerformAction(BaseCharStateMachine Actor, BaseCharStateMachine Target)
    {
        if (ActionStarted == true)
        {
            yield break;
        }
        ActionStarted = true;

        //Move Character to Target
        while (MoveToTarget(Actor.Wrestler, Target.Wrestler))
        {
            yield return(null);
        }

        PinCount = 0;
        //Set up ActorCount
        ActorCount0 = 0.0f;
        ActorCount1 = 0.1f;
        ActorCount2 = 0.2f;

        //The Pin Action!
        //Count 1
        yield return(new WaitForSecondsRealtime(1));

        if (Target.TryPinEscape(ActorCount0) == false)
        {
            PinCount++;
            Actor.BSM.DisplayNote(PinCount.ToString());

            //Count 2
            yield return(new WaitForSecondsRealtime(1));

            if (Target.TryPinEscape(ActorCount1) == false)
            {
                PinCount++;
                Actor.BSM.DisplayNote(PinCount.ToString());
                yield return(new WaitForSecondsRealtime(1f));

                //Try for breakup//
                //Reset Breakup //
                Breakup = false;
                EnemiesUp.Clear();

                if (Actor.type == "PLAYER")
                {
                    foreach (GameObject Enemy in Actor.BSM.EnemyChars)
                    {
                        if (Enemy.GetComponent <EnemyStateMachine>().Status_Down == false)
                        {
                            EnemiesUp.Add(Enemy.GetComponent <EnemyStateMachine>());
                        }
                    }
                }
                if (Actor.type == "ENEMY")
                {
                    foreach (GameObject Enemy in Actor.PossibleTargets)
                    {
                        if (Enemy.GetComponent <BaseCharStateMachine>().Status_Down == false)
                        {
                            EnemiesUp.Add(Enemy.GetComponent <BaseCharStateMachine>());
                        }
                    }
                }

                if (EnemiesUp.Count > 0)
                {
                    foreach (BaseCharStateMachine Enemy in EnemiesUp)
                    {
                        if (Enemy.TryPinBreak())
                        {
                            PinBreaker = Enemy;
                            Breakup    = true;
                            break;
                        }
                    }
                }

                if (Breakup == false)
                {
                    //Count 3
                    if (Target.TryPinEscape(ActorCount2) == false)
                    {
                        PinCount++;
                        Actor.BSM.DisplayNote(PinCount.ToString());
                    }
                }
            }
        }

        //If PinCount is 3, Actor wins the match.
        if (PinCount == 3)
        {
            yield return(new WaitForSeconds(1f));

            Actor.BSM.FinishMatch(Actor, Target, "Pinfall");
        }

        else
        {
            //Was there a breakup?
            if (Breakup == true)
            {
                Actor.BSM.DisplayNote(PinBreaker.Stats.Name + " broke up the pin!");
                while (MoveToTarget(PinBreaker.Wrestler, Target.Wrestler))
                {
                    yield return(null);
                }
                //Wait (Later, do Attack Animation here
                yield return(new WaitForSeconds(0.5f));

                //Give PinBreaker some momentum
                PinBreaker.AddMomentum(5f, MoveType);

                //Move both back
                while (MoveToPosition(Actor.Wrestler, Actor.startPosition) || MoveToPosition(PinBreaker.Wrestler, PinBreaker.startPosition))
                {
                    yield return(null);
                }
            }

            // There was a Kickout (PinCount != 3 and Breakup is False)
            else
            {
                Actor.BSM.DisplayNote(Target.Stats.Name + " kicked out at " + PinCount.ToString());

                while (MoveToPosition(Actor.Wrestler, Actor.startPosition))
                {
                    yield return(null);
                }
            }
            //Set BSM
            Actor.BSM.TheTurn = BattleStateMachine.TurnStates.DONE;
        }

        //Give Actor and target Momentum
        Actor.AddMomentum(3f, MoveType);
        Target.AddMomentum(5f, MoveType);

        //End Coroutine
        ActionStarted = false;
    }