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 SpecialMove GetSignature(PositionLayout requiredPosition)
 {
     if (signatures.ContainsKey(requiredPosition))
     {
         List <SpecialMove> moveIDs = signatures [requiredPosition];
         return(moveIDs [UsefulActions.RandomiseNumber(0, moveIDs.Count)]);
     }
     return(null);
 }
Exemple #3
0
        protected bool CanAvoidMove(float moveMaxChance, float avoidMaxChance)
        {
            float moveChance  = UsefulActions.RandomiseNumber(0.0f, moveMaxChance);
            float avoidChance = UsefulActions.RandomiseNumber(0.0f, avoidMaxChance);

            avoidChance *= GetStaminaAsAPercentage();                        //Lower chance to avoid if you have low stamina (not health, that will snowball too hard)
            avoidChance  = (IsStunned()) ? avoidChance * 0.6f : avoidChance; //Lower chance to avoid if you're stunned

            return(moveChance < avoidChance);
        }
Exemple #4
0
        //Move without a destination
        public void MoveToAdjacentNode(Wrestler wrestler, NodeIndex start)
        {
            NodeIndex destination;

            do
            {
                destination = start + new NodeIndex((sbyte)UsefulActions.RandomiseNumber(-1, 2), (sbyte)UsefulActions.RandomiseNumber(-1, 2));
            } while (!IsValidNode(destination));
            MoveToAdjacentNode(wrestler, start, destination);
        }
Exemple #5
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 #6
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)]);
        }
Exemple #7
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);
        }