示例#1
0
    protected override ShipDecision GenerateShipDecision(bool offerBonus)
    {
        PlayerShip.PactStatus status = factionStatus;
        float trust = playerShip.trustworthiness;

        if (status == PlayerShip.PactStatus.FORMED)
        {
            return(ShipDecision.PARLEY);
        }
        else if (status == PlayerShip.PactStatus.BROKEN)
        {
            return(ShipDecision.ENGAGE);
        }

        float parleyBreakpoint = 125f / (1f + Mathf.Exp(3f * factionTrust - (.5f - playerShip.trustworthiness))) - 7f;
        float engageBreakpoint = 125f / (1f + Mathf.Exp(3f * factionTrust - (.5f - playerShip.trustworthiness))) - 15f;

        float point = Random.Range(0f, 100f);

        if (offerBonus)
        {
            point += 5f;
        }

        if (point > parleyBreakpoint)
        {
            return(ShipDecision.PARLEY);
        }
        else if (point < engageBreakpoint)
        {
            return(ShipDecision.ENGAGE);
        }

        return(Random.Range(0, 2) > 0 ? ShipDecision.PARLEY : ShipDecision.ENGAGE);
    }
示例#2
0
    public void ResponseToPrompt(bool response)
    {
        if (!response)
        {
            if (warning == Warning.THREATEN)
            {
                DeclineThreaten();
                return;
            }

            DeclineWarning();
            return;
        }

        switch (warning)
        {
        case Warning.ATTACK:
        case Warning.THREATEN:
            if (factionStatus == PlayerShip.PactStatus.FORMED)
            {
                factionStatus = PlayerShip.PactStatus.BROKEN;
                factionTrust -= TRUST_FACTION_ACTION_DELTA;
                playerShip.AddTrust(-TRUST_ACTION_DELTA);
            }
            break;

        case Warning.NOT_ATTACK:
            if (otherFactionStatus == PlayerShip.PactStatus.FORMED)
            {
                otherFactionStatus = PlayerShip.PactStatus.BROKEN;
                factionTrust      += TRUST_FACTION_ACTION_DELTA;
                playerShip.AddTrust(-TRUST_ACTION_DELTA);
            }
            break;
        }

        methodAction();
    }