Exemple #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;
            }
        }
Exemple #2
0
        public void AddCooldown(float value)
        {
            float valueToAdd = value;

            //In real wrestling, wrestlers tend to perform slower as they take more damage and run out of breath. Due to that, that increases the cooldown
            float temp = UsefulActions.ClampValue(GetStaminaAsAPercentage());

            valueToAdd *= (1 - temp) + 1;             //Lower stamina leads to a longer cooldown
            temp        = UsefulActions.ClampValue(GetHealthAsAPercentage());
            valueToAdd *= (1 - temp) + 1;             //Lower health also does

            //Add ambient action time depending on stamina, so the wrestler doesn't attack instantly, which doesn't always happen in wrestling.
            valueToAdd += UsefulActions.RandomiseNumber(0.1f, 6.0f - GetStaminaAsAPercentage() * 4.0f);

            actionTimer += valueToAdd;
        }
Exemple #3
0
        //Left public because in the future there may be match specific moves
        public MoveResult AttemptMove(Wrestler receivingWrestler, IMove move, float costMultiplier = 1)
        {
            float staminaCost      = 0.4f * (byte)move.GetStaminaCost() * costMultiplier;
            float maxSuccessChance = myData.technique / staminaCost;

            //Without increasing this value, people with less technique than someone's counter stat can never ever land a move
            maxSuccessChance *= UsefulActions.ClampValue(GetStaminaAsAPercentage()) * 3;

            MoveData moveData = move.GetMove();
            float    damage   = GetDamageByOffenceType(moveData) * staminaCost;

            damage = UsefulActions.RandomiseNumber(damage);

            ConsumeStamina(MOVE_BASE_STAMINA_COST * staminaCost);
            MoveResult result = receivingWrestler.ReceiveMove(maxSuccessChance, moveData, damage);

            receivingWrestler.ChangeTarget(this);              //Without this, multi-man matches get kinda silly with someone getting beat up for free

            if (result == MoveResult.COUNTERED)
            {
                AddStun(receivingWrestler.GetCounterStunLength());
                ChangePosition(moveData.reversalPosition);
                return(result);
            }

            if (result == MoveResult.NORMAL)
            {
                AddMomentum(MOVE_BASE_MOMENTUM_GAIN + damage / 50);                  //No charisma stat, simply made it so that wrestlers who hit harder gain more momentum
            }

            float moveTime = UsefulActions.RandomiseNumber(moveData.lowerMoveTime, moveData.upperMoveTime);              //How long the move took

            AddCooldown(moveTime);
            receivingWrestler.AddStun(moveTime);

            return(result);
        }