Exemplo n.º 1
0
    IEnumerator EvaluateNPCResponse(InteractionMenuLogic.InteractionIcon action,
                                    bool success)
    {
        string msg = "";

        if (action == InteractionMenuLogic.InteractionIcon.Bite)
        {
            // Bites always count as a humanity loss
            m_playerBehavior.AddToCurrentHumanity(m_humanityLosePenalty);
            Bite();
            CompleteInteraction();
            yield return(null);
        }

        else if (action == InteractionMenuLogic.InteractionIcon.Charm)
        {
            msg = success ? m_npcBehavior.charmWinLine[m_dialogueIndex] :
                  m_npcBehavior.charmLoseLine[m_dialogueIndex];
        }

        else if (action == InteractionMenuLogic.InteractionIcon.Intimidate)
        {
            msg = success ? m_npcBehavior.intimidateWinLine[m_dialogueIndex] :
                  m_npcBehavior.intimidateLoseLine[m_dialogueIndex];
        }

        else if (action == InteractionMenuLogic.InteractionIcon.Think)
        {
            msg = success ? m_npcBehavior.thinkWinLine[m_dialogueIndex] :
                  m_npcBehavior.thinkLoseLine[m_dialogueIndex];
        }

        m_npcBalloon.Speak(msg);
        yield return(new WaitForSecondsRealtime(3f));

        m_npcBalloon.Stop();
        yield return(new WaitForSecondsRealtime(0.5f));

        // Apply humanity penalty / reward to player

        m_playerBehavior.AddToCurrentHumanity(
            success ? m_humanityWinReward : m_humanityLosePenalty);

        // If success, render this NPC inactive for future interactions
        // and complete.

        if (success)
        {
            CompleteInteraction();
            yield return(null);
        }

        // On failure, proceed to sudden-death bite chance...

        StartCoroutine(SuddenDeath());
    }
Exemplo n.º 2
0
    void EvaluatePlayerResponse(InteractionMenuLogic.InteractionIcon action)
    {
        // Success formula: Take base success chance for this action
        // and subtract 50% times current zombifcation ratio
        // (calculated by taking 100% - current humanity ratio)
        // (NOTE: The penalty becomes a bonus for intimidation attempts!)

        // NOTE: Bites are always 100% successful for now

        float baseSuccessChance = 1f;

        if (action == InteractionMenuLogic.InteractionIcon.Charm)
        {
            baseSuccessChance = m_npcBehavior.baseCharmSuccess;
        }
        if (action == InteractionMenuLogic.InteractionIcon.Intimidate)
        {
            baseSuccessChance = m_npcBehavior.baseIntimidateSuccess;
        }
        if (action == InteractionMenuLogic.InteractionIcon.Think)
        {
            baseSuccessChance = m_npcBehavior.baseThinkSuccess;
        }

        float successChance = baseSuccessChance;

        if (action != InteractionMenuLogic.InteractionIcon.Bite)
        {
            float modifier = (1f - m_playerBehavior.GetCurrentHumanityRatio()) / 2f;
            if (action == InteractionMenuLogic.InteractionIcon.Intimidate)
            {
                successChance += modifier;
            }
            else
            {
                successChance -= modifier;
            }
        }

        bool success = Random.Range(0f, 1f) <= successChance;

        StartCoroutine(EvaluateNPCResponse(action, success));
    }