Ejemplo n.º 1
0
        public void AddStun(float value)
        {
            float valueToAdd = UsefulActions.RandomiseNumber(value);

            float clampedValue = GetHealthAsAPercentage();

            clampedValue = UsefulActions.ClampValue(clampedValue); //Allowing the value to equal 0 leads to infinity, which bugs the game
            valueToAdd  /= clampedValue;                           //Recover slower the lower your health is

            clampedValue = GetStaminaAsAPercentage();
            clampedValue = UsefulActions.ClampValue(clampedValue); //Allowing the value to equal 0 leads to infinity, which bugs the game
            valueToAdd  /= clampedValue;                           //Recover slower the lower your stamina is

            valueToAdd /= Match.instance.GetRecoveryMultiplier();
            valueToAdd *= Match.instance.StunnedMultiplier();

            valueToAdd = (IsStunned()) ? valueToAdd / 2 : valueToAdd;              //Reduce stun added to already stunned targets. Essentially a softcap
            if (UsefulActions.RandomiseChance(momentum * QUICK_RECOVER_CHANCE_SCALER))
            {
                valueToAdd /= 10;                 //Recover quicker. Reduce the length of time you'll be stunned for.
                UseMomentum(QUICK_RECOVER_MOMENTUM_COST);
            }

            stunnedTimer += valueToAdd;
            actionTimer   = 0;           //Wouldn't make sense to be put on cooldown from a move whilst you're on the ground.

            if (stunnedTimer > 300)      //Don't allow wrestlers to be stunned for too long (but don't limit it entirely. doing so can ruin multi-man matches).
            {
                stunnedTimer = 300;
            }
        }
Ejemplo n.º 2
0
        protected bool CanUseSpecialMove(Wrestler attackingWrestler, Wrestler receivingWrestler, float bonusChance)
        {
            float attackerStamina = attackingWrestler.GetStaminaAsAPercentage();
            float receiverHealth  = receivingWrestler.GetHealthAsAPercentage();
            float chance          = 5 + receiverHealth * 20;

            chance -= (1 - attackerStamina) * 15;
            chance *= bonusChance;

            return(UsefulActions.RandomiseChance(chance));
        }
Ejemplo n.º 3
0
 //Mostly used to have wrestlers stay down for longer during multi-man matches, like in wrestling
 public virtual float StunnedMultiplier()
 {
     if (wrestlers.Length == 2)
     {
         return(1);
     }
     if (UsefulActions.RandomiseChance(wrestlers.Length * 5))
     {
         return(2);
     }
     return(1);
 }
Ejemplo n.º 4
0
        public MoveData GetRandomMove(PositionLayout requiredPosition)
        {
            List <MoveData> moves = null;

            if (favouriteMoves.ContainsKey(requiredPosition) && UsefulActions.RandomiseChance(80))
            {
                moves = favouriteMoves [requiredPosition];
            }

            if (normalMoves.ContainsKey(requiredPosition))
            {
                moves = normalMoves [requiredPosition];
            }

            if (moves == null || moves.Count == 0)
            {
                return(null);
            }
            return(moves [UsefulActions.RandomiseNumber(0, moves.Count)]);
        }
Ejemplo n.º 5
0
        public void ChangeTargetToSelection(Wrestler[] selectableWrestlers)
        {
            targettingWrestler = selectableWrestlers [0];
            for (byte i = 1; i < selectableWrestlers.Length; i++)
            {
                byte chance = 20;

                if (selectableWrestlers [i].IsStunned())
                {
                    chance = 5;
                }
                if (selectableWrestlers [i].IsTargettingWrestler(this))
                {
                    chance = 50;
                }

                if (UsefulActions.RandomiseChance(chance))
                {
                    targettingWrestler = selectableWrestlers [i];
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public bool AttemptPinEscape(float chanceMultiplier)
        {
            float chance = GetHealthAsAPercentage() * myData.heart;

            //Wrestlers sometimes lose simply through being gassed, not through being beat up a lot.
            //There is a threshold so that the wrestler doesn't solely lose due to them being tired. It's just a factor.
            chance *= 0.25f + GetStaminaAsAPercentage() * 0.75f;

            //Multiplier below is used to help wrestlers kick out. Without it, wrestlers with low heart (i.e. 40) will never kickout, losing often in < 30 seconds
            chance *= PIN_MULTIPLIER * chanceMultiplier * Match.instance.GetRecoveryMultiplier();              //It can technically go over 100 at this point. That simply means you will kick out

            //Wrestlers stunned for longer (i.e. from a big move, or in this simulator, multiple moves) should have a lower chance of kicking out
            chance -= stunnedTimer / 10;

            bool kickedOut = UsefulActions.RandomiseChance(chance);

            if (kickedOut)
            {
                Output.AddToOutput(myData.name + " kicked out");
                ReduceMaxHealth();
            }

            return(kickedOut);
        }
Ejemplo n.º 7
0
        //This will be more complex in the future. It's mostly set like this right now to show that it all works.
        public override void MatchStep()
        {
            //Output.AddToOutput (elapsedTime.ToString());
            Wrestler attackingWrestler = GetNextActiveWrestler();
            Wrestler receivingWrestler = attackingWrestler.GetTargettingWrestler();
            float    pinMultiplier     = 4;

            //In multiman matches, randomly change targets if your target is stunned
            if (wrestlers.Length > 2 && receivingWrestler.IsStunned() && UsefulActions.RandomiseChance(25))
            {
                Wrestler[] otherWrestlers = GetOtherWrestlers(attackingWrestler).ToArray();
                attackingWrestler.ChangeTargetToSelection(otherWrestlers);
            }

            if (attackingWrestler.GetPosition() != WrestlerPosition.STANDING)
            {
                if (attackingWrestler.GetPosition() == WrestlerPosition.GROUNDED)
                {
                    ChangePosition(attackingWrestler, WrestlerPosition.GROGGY);
                }
                else
                {
                    ChangePosition(attackingWrestler, WrestlerPosition.STANDING);
                }
                return;
            }

            IMove    attackToUse = null;
            MoveType moveType    = MoveType.NORMAL;

            if (CanUseFinisher(attackingWrestler, receivingWrestler))
            {
                attackToUse   = attackingWrestler.GetFinisher();
                moveType      = MoveType.FINISHER;
                pinMultiplier = 0.5f;
            }
            else if (CanUseSignature(attackingWrestler, receivingWrestler))
            {
                attackToUse   = attackingWrestler.GetSignature();
                moveType      = MoveType.SIGNATURE;
                pinMultiplier = 1;
            }
            else if (CanUseMove(attackingWrestler, receivingWrestler))
            {
                attackToUse   = attackingWrestler.GetMove();
                moveType      = MoveType.NORMAL;
                pinMultiplier = 2;
            }

            if (attackToUse != null)
            {
                MoveResult moveResult = AttemptMove(attackingWrestler, receivingWrestler, attackToUse, moveType);
                if (moveResult != MoveResult.NORMAL)                 //Stop the turn immediately if our move didn't go through
                {
                    return;
                }
            }

            if (attackingWrestler.IsStunned())              //If the wrestler collapsed by any chance
            {
                return;
            }

            if (receivingWrestler.GetPosition() == WrestlerPosition.GROUNDED)
            {
                if (UsefulActions.RandomiseChance(49.0f / pinMultiplier) && attackToUse != null || UsefulActions.RandomiseChance(10))
                {
                    PinAttempt(attackingWrestler, receivingWrestler, pinMultiplier);
                    return;
                }
                if (UsefulActions.RandomiseChance(40))
                {
                    ChangeReceiverPosition(attackingWrestler, receivingWrestler, WrestlerPosition.GROGGY);
                    return;
                }
            }
        }