예제 #1
0
    public Resources_Player(ProfileSettings profile,
                            Resources_Building home,
                            int money,
                            int income,
                            int expenses,
                            int strength,
                            int presence,
                            int opinion,
                            Resources_Inventory inventory)
        : base(profile.id,
               profile.name,
               profile.image,
               profile.gender,
               home,
               money,
               income,
               expenses,
               strength,
               inventory)
    {
        _presence = presence;
        _opinion  = opinion;
        instance  = this;

        Manager_Resources.NewPlayer(this);
    }
    private void DetermineShopOptions(Resources_Player player, Resources_Shopkeeper shopkeeper)
    {
        List <string> Options = new List <string>();

        shopkeeperState = Enums.ShopkeeperState.Passive;

        if (shopkeeperState != Enums.ShopkeeperState.Robbed)
        {
            Options.Add("Purchase Wares");
            if (shopkeeperState == Enums.ShopkeeperState.Vandalized)
            {
                Options.Add("Inquire");
            }
        }
        else
        {
            /*if(player.getProof(shopkeeper.referenceID))
             * { Options.Add ("Placate"); }*/
            Options.Add("Inquire");
        }

        if (shopkeeper.home.payment > 0)
        {
            Options.Add("Request Payment");
            Options.Add("Renegotiate Payment");
        }
        else
        {
            Options.Add("Suggest Protection");
        }
    }
    public Resources_Player(ProfileSettings profile,
	                         Resources_Building home,
	                         int money,
	                         int income,
	                         int expenses,
	                         int strength,
	                         int presence,
	                         int opinion,
	                         Resources_Inventory inventory)
        : base(profile.id,
		        profile.name,
		        profile.image,
		        profile.gender,
		        home,
		        money,
		        income,
		        expenses,
		        strength,
		        inventory)
    {
        _presence = presence;
        _opinion = opinion;
        instance = this;

        Manager_Resources.NewPlayer(this);
    }
    static public Dialogue_Prompt DefaultAmount(Resources_Player player, Resources_Shopkeeper shopkeeper, int askingPrice)
    {
        Resources_Building shop = shopkeeper.home;
        float profit            = shop.income - shop.expenses;

        if (profit == 0)
        {
            profit = 0.0001f;
        }

        float affordValue   = 2 * ((1 - askingPrice / profit * shopkeeper.greed) * (shopkeeper.fear / shopkeeper.greed) - 50);
        float strengthValue = (Utilities.difficultyHandicap / 5 + player.strength) * player.presence - (shopkeeper.strength * 100 / shopkeeper.fear);
        float moralValue    = Utilities.difficultyHandicap * shopkeeper.fear / 10 - shopkeeper.integrity / shopkeeper.respect;

        Debug.Log("Afford Value: " + affordValue + ". Strength Value: " + strengthValue + ". Moral Value: " + moralValue + ". Total: " + (affordValue + strengthValue + moralValue) + ".");

        if ((affordValue + strengthValue + moralValue) >= 0)
        {
            Dialogue_Prompt_Logic.OfferAccepted();
            return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_offerAccepted"));
        }
        else
        {
            Dialogue_Prompt_Logic.OfferRefused();
            return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_offerRefused"));
        }
    }
 static public Dialogue_Prompt TakeRegisterMoney(Resources_Player player, Resources_Shopkeeper shopkeeper, int amount)
 {
     shopkeeper.home.money -= amount;
     player.money          += amount;
     Dialogue_Prompt_Logic.Root();
     return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_root"));
 }
 static public void ClearAllResources()
 {
     _referenceIDs = new List <Resources_Root>();
     _player       = null;
     _shopkeepers  = new List <Resources_Shopkeeper>();
     _officers     = new List <Resources_Officer>();
     _buildings    = new List <Resources_Building>();
 }
 public static void ClearAllResources()
 {
     _referenceIDs = new List<Resources_Root>();
     _player = null;
     _shopkeepers = new List<Resources_Shopkeeper>();
     _officers = new List<Resources_Officer>();
     _buildings = new List<Resources_Building>();
 }
예제 #8
0
 public void SpawnPlayer(Resources_Player resources)
 {
     /*
      * Transform spawnPoint = resources.home.building.transform;
      * GameObject player = Instantiate (playerPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;
      * ((PlayerMovement)player.GetComponent("PlayerMovement")).resources = resources;
      * player.name = "Player";
      */
 }
 static public void NewPlayer(Resources_Player value)
 {
     if (_player == null)
     {
         _player = value;
         _referenceIDs.Add(value);
     }
     else
     {
         Debug.LogError("Attempted to create a player when a player already exists");
     }
 }
    public static Dialogue_Prompt DefaultAmount(Resources_Player player, Resources_Shopkeeper shopkeeper, int askingPrice)
    {
        Resources_Building shop = shopkeeper.home;
        float profit = shop.income - shop.expenses;
        if(profit == 0) { profit = 0.0001f; }

        float affordValue = 2 * ((1 - askingPrice / profit * shopkeeper.greed) * (shopkeeper.fear / shopkeeper.greed) - 50);
        float strengthValue = (Utilities.difficultyHandicap/5 + player.strength) * player.presence - (shopkeeper.strength * 100/shopkeeper.fear);
        float moralValue = Utilities.difficultyHandicap * shopkeeper.fear/10 - shopkeeper.integrity / shopkeeper.respect;
        Debug.Log ("Afford Value: " + affordValue + ". Strength Value: " + strengthValue + ". Moral Value: " + moralValue + ". Total: " + (affordValue+strengthValue+moralValue) + ".");

        if((affordValue + strengthValue + moralValue) >= 0)
        {
            Dialogue_Prompt_Logic.OfferAccepted();
            return Dialogue_Prompt.GetPromptByName("dialogue_prompt_offerAccepted");
        } else {
            Dialogue_Prompt_Logic.OfferRefused();
            return Dialogue_Prompt.GetPromptByName("dialogue_prompt_offerRefused");
        }
    }
 public static void NewPlayer(Resources_Player value)
 {
     if (_player == null) {
         _player = value;
         _referenceIDs.Add (value);
     } else {
         Debug.LogError ("Attempted to create a player when a player already exists"); }
 }
 public static Dialogue_Prompt TakeRegisterMoney(Resources_Player player, Resources_Shopkeeper shopkeeper, int amount)
 {
     shopkeeper.home.money -= amount;
     player.money += amount;
     Dialogue_Prompt_Logic.Root();
     return Dialogue_Prompt.GetPromptByName("dialogue_prompt_root");
 }
 public static Dialogue_Prompt OtherAmount(Resources_Player player, Resources_Shopkeeper shopkeeper, int askingPrice)
 {
     return DefaultAmount (player, shopkeeper, askingPrice);
 }
 static public Dialogue_Prompt OtherAmount(Resources_Player player, Resources_Shopkeeper shopkeeper, int askingPrice)
 {
     return(DefaultAmount(player, shopkeeper, askingPrice));
 }
 static public Dialogue_Prompt EarlyPayment(Resources_Player player, Resources_Shopkeeper shopkeeper)
 {
     shopkeeper.respect -= 10;
     return(RequestPayment(player, shopkeeper));
 }
    private void DetermineShopOptions(Resources_Player player, Resources_Shopkeeper shopkeeper)
    {
        List<string> Options = new List<string>();

        shopkeeperState = Enums.ShopkeeperState.Passive;

        if(shopkeeperState != Enums.ShopkeeperState.Robbed)
        {
            Options.Add ("Purchase Wares");
            if(shopkeeperState == Enums.ShopkeeperState.Vandalized)
            { Options.Add("Inquire"); }
        } else {
            /*if(player.getProof(shopkeeper.referenceID))
            { Options.Add ("Placate"); }*/
            Options.Add ("Inquire");
        }

        if(shopkeeper.home.payment > 0)
        {
            Options.Add ("Request Payment");
            Options.Add ("Renegotiate Payment");
        } else {
            Options.Add ("Suggest Protection");
        }
    }
 public static Dialogue_Prompt EarlyPayment(Resources_Player player, Resources_Shopkeeper shopkeeper)
 {
     shopkeeper.respect -= 10;
     return RequestPayment (player, shopkeeper);
 }
    static public Dialogue_Prompt RequestPayment(Resources_Player player, Resources_Shopkeeper shopkeeper)
    {
        int randNum       = Random.Range(0, 50);
        int paymentAmount = shopkeeper.home.payment;

        // Determine if the shopkeeper is feeling cocky enough to not pay you.
        if (randNum > shopkeeper.respect && shopkeeper.strength > player.strength)
        {
            // The shopkeeper doesn't respect you, and isn't afraid of you, so you are not getting your payment
            Dialogue_Prompt_Logic.PaymentNone();
            return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentNone"));
        }
        else
        {
            // Check to see if the store can afford to make the payment
            if (shopkeeper.home.money < paymentAmount)
            {
                // If the shop can't afford the payment
                // Check to see if the shopkeeper is fearful enough to try to pay out of pocket
                if (shopkeeper.fear > 50)
                {
                    // The shopkeeper is fearful enought to pay out of pocket
                    // Check to see if the shopkeeper can afford it
                    if (shopkeeper.home.money + shopkeeper.money < paymentAmount)
                    {
                        // The shopkeeper can't make up the difference and must pay only partially
                        player.money         += shopkeeper.home.money;
                        shopkeeper.home.money = 0;
                        Dialogue_Prompt_Logic.PaymentPartial();
                        return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentPartial"));
                    }
                    else
                    {
                        // The shopkeeper will make up the difference out of pocket
                        player.money += paymentAmount;
                        int difAmount = paymentAmount;
                        difAmount            -= shopkeeper.home.money;
                        shopkeeper.home.money = 0;
                        shopkeeper.money     -= difAmount;
                        Dialogue_Prompt_Logic.PaymentFull();
                        return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentFull"));
                    }
                }
                else
                {
                    // The shopkeeper is unwilling to pay out of pocket and will pay only partially
                    player.money         += shopkeeper.home.money;
                    shopkeeper.home.money = 0;
                    Dialogue_Prompt_Logic.PaymentPartial();
                    return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentPartial"));
                }
            }
            else
            {
                // The shopkeeper can afford the full payment
                player.money          += paymentAmount;
                shopkeeper.home.money -= paymentAmount;
                Dialogue_Prompt_Logic.PaymentFull();
                return(Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentFull"));
            }
        }
    }
    public static Dialogue_Prompt RequestPayment(Resources_Player player, Resources_Shopkeeper shopkeeper)
    {
        int randNum  = Random.Range(0, 50);
        int paymentAmount = shopkeeper.home.payment;

        // Determine if the shopkeeper is feeling cocky enough to not pay you.
        if(randNum > shopkeeper.respect && shopkeeper.strength > player.strength)
        {
            // The shopkeeper doesn't respect you, and isn't afraid of you, so you are not getting your payment
            Dialogue_Prompt_Logic.PaymentNone();
            return Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentNone");
        } else {
            // Check to see if the store can afford to make the payment
            if (shopkeeper.home.money < paymentAmount)
            {
                // If the shop can't afford the payment
                // Check to see if the shopkeeper is fearful enough to try to pay out of pocket
                if (shopkeeper.fear > 50)
                {
                    // The shopkeeper is fearful enought to pay out of pocket
                    // Check to see if the shopkeeper can afford it
                    if (shopkeeper.home.money + shopkeeper.money < paymentAmount)
                    {
                        // The shopkeeper can't make up the difference and must pay only partially
                        player.money += shopkeeper.home.money;
                        shopkeeper.home.money = 0;
                        Dialogue_Prompt_Logic.PaymentPartial();
                        return Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentPartial");
                    }
                    else
                    {
                        // The shopkeeper will make up the difference out of pocket
                        player.money += paymentAmount;
                        int difAmount = paymentAmount;
                        difAmount -= shopkeeper.home.money;
                        shopkeeper.home.money = 0;
                        shopkeeper.money -= difAmount;
                        Dialogue_Prompt_Logic.PaymentFull();
                        return Dialogue_Prompt.GetPromptByName ("dialogue_prompt_paymentFull");
                    }
                } else {
                    // The shopkeeper is unwilling to pay out of pocket and will pay only partially
                    player.money += shopkeeper.home.money;
                    shopkeeper.home.money = 0;
                    Dialogue_Prompt_Logic.PaymentPartial();
                    return Dialogue_Prompt.GetPromptByName("dialogue_prompt_paymentPartial");
                }
            } else {
                // The shopkeeper can afford the full payment
                player.money += paymentAmount;
                shopkeeper.home.money -= paymentAmount;
                Dialogue_Prompt_Logic.PaymentFull();
                return Dialogue_Prompt.GetPromptByName ("dialogue_prompt_paymentFull");
            }
        }
    }