Ejemplo n.º 1
0
        private void HandleOutfit(ItemVO item)
        {
            OutfitVO outfit = item as OutfitVO;

            if (outfit != null)
            {
                InventoryModel inventory = AmbitionApp.Inventory;
                int            credShift;
                if (FactionEffectsBtn != null)
                {
                    FactionEffectsBtn.interactable = true;
                }
                if (OutfitDescriptionText != null)
                {
                    OutfitDescriptionText.text = GetOutfitDescription(outfit);
                }
                OutfitNameText.text = AmbitionApp.Localization.GetItemName(outfit);
                foreach (FactionTextEffect effect in FactionEffects)
                {
                    credShift         = inventory.GetFactionBonus(outfit, effect.Faction);
                    effect.Text.text  = (credShift > 0 ? "+" : "") + credShift.ToString();
                    effect.Text.color = credShift > 0
                        ? PositiveEffectTxtColor
                        : credShift < 0
                        ? NegativeEffectTxtColor
                        : NeutralEffectTxtColor;
                    effect.Text.fontStyle = (credShift == 0) ? FontStyle.Normal : FontStyle.Bold;
                }
            }
            else
            {
                foreach (FactionTextEffect effect in FactionEffects)
                {
                    effect.Text.text      = "0";
                    effect.Text.color     = NeutralEffectTxtColor;
                    effect.Text.fontStyle = FontStyle.Normal;
                }
            }
        }
Ejemplo n.º 2
0
        // PRIVATE METHODS //////////////////////////////
        protected override OutfitVO[] FetchListData()
        {
            InventoryModel inventory = AmbitionApp.Inventory;

            if (IsMerchant)
            {
                AmbitionApp.SendMessage(InventoryMessages.UPDATE_MERCHANT);
            }
            List <ItemVO> items = IsMerchant
                ? inventory.Market.FindAll(i => i.Type == ItemType.Outfit)
                : new List <ItemVO>(inventory.GetItems(ItemType.Outfit));
            List <OutfitVO> outfits = new List <OutfitVO>();

            foreach (ItemVO item in items)
            {
                if (item is OutfitVO)
                {
                    outfits.Add((OutfitVO)item);
                }
            }
            return(outfits.ToArray());
        }
Ejemplo n.º 3
0
        public override void OnEnterState()
        {
            PartyModel     model     = AmbitionApp.GetModel <PartyModel>();
            PartyVO        party     = model.Party;
            InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
            FactionVO      faction   = AmbitionApp.GetModel <FactionModel>()[party.Faction];
            OutfitVO       outfit    = inventory.Equipped[ItemConsts.OUTFIT] as OutfitVO;

            // TODO: Passive buff system
            //Is the Player using the Fascinator Accessory? If so then allow them to ignore the first negative comment!
            ItemVO item;

            if (inventory.Equipped.TryGetValue(ItemConsts.ACCESSORY, out item) && item != null)
            {
                switch (item.Name)
                {
                case "Garter Flask":
                    //model.AddBuff(GameConsts.DRINK, ItemConsts.ACCESSORY, 1.0f, 1.0f);
                    break;

                case "Fascinator":
                    AmbitionApp.GetModel <ConversationModel>().ItemEffect = true;
                    break;

                case "Snuff Box":
                    model.Party.MaxIntoxication += 5;
                    break;
                }
            }

            //Is the Player decent friends with the Military? If so, make them more alcohol tolerant!
            // TODO: why?
            if (AmbitionApp.GetModel <FactionModel>()[FactionConsts.MILITARY].Level >= 3)
            {
                model.Party.MaxIntoxication += 3;
            }

            model.Drink        = 0;
            model.Intoxication = 0;

            float             outfitScore  = 400 - Math.Abs(faction.Modesty - outfit.Modesty) - Math.Abs(faction.Luxury - outfit.Luxury);
            ConversationModel conversation = AmbitionApp.GetModel <ConversationModel>();
            int num = model.DeckSize
                      + (int)(outfitScore * (float)(outfit.Novelty) * 0.001f)
                      + faction.DeckBonus
                      + AmbitionApp.GetModel <GameModel>().DeckBonus;

            int[]  remarkids = Enumerable.Range(0, num).ToArray();
            int    index;
            int    tmp;
            string interest;
            int    numTargets;
            int    targetIndex = (int)(num * .5f); // Fifty-fifty one or two targets

            conversation.Deck    = new Queue <RemarkVO>();
            conversation.Discard = new List <RemarkVO>();
            for (int i = num - 1; i >= 0; i--)
            {
                index            = Util.RNG.Generate(i);
                tmp              = remarkids[i];
                remarkids[i]     = remarkids[index];
                remarkids[index] = tmp;
                interest         = model.Interests[remarkids[i] % model.Interests.Length];
                numTargets       = remarkids[i] > targetIndex ? 2 : 1;
                conversation.Deck.Enqueue(new RemarkVO(numTargets, interest));
            }

            // TODO: Commandify and insert after entering map for first time
            //Damage the Outfit's Novelty, now that the Confidence has already been Tallied
            AmbitionApp.SendMessage(InventoryMessages.DEGRADE_OUTFIT, outfit);

//         string introText = AmbitionApp.GetString("party.intro." + party.ID + ".body");
//          if (introText != null) AmbitionApp.OpenMessageDialog("party.intro." + party.ID);
        }
Ejemplo n.º 4
0
 public override void Initialize()
 {
     _inventory = AmbitionApp.GetModel <InventoryModel>();
     AmbitionApp.Subscribe(PartyMessages.START_PARTY, HandleCheckOutfit);
 }
Ejemplo n.º 5
0
        public void Execute(int intoxication)
        {
            PartyModel model = AmbitionApp.GetModel <PartyModel>();
            PartyVO    party = model.Party;

            if (intoxication >= party.MaxIntoxication)
            {
                InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
                ItemVO         item;
                //Determine Random Effect
                switch (Util.RNG.Generate(0, 10))
                {
                case 0:
                    model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, -Util.RNG.Generate(20, 51)));
                    break;

                case 1:
                    model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, party.Faction, -Util.RNG.Generate(20, 51)));
                    break;

                // Outfit penalized
                case 2:
                    item = inventory.GetEquipped(ItemConsts.OUTFIT);
                    if (item is OutfitVO)
                    {
                        ((OutfitVO)item).Novelty -= Util.RNG.Generate(20, 51);
                    }
                    break;

                // Outfit Ruined
                case 3:
                    item = inventory.GetEquipped(ItemConsts.OUTFIT);
                    if (item is OutfitVO)
                    {
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Item, item.Name, -1));
                    }
                    break;

                // Accessory Lost
                case 4:
                    item = inventory.GetEquipped(ItemConsts.ACCESSORY);
                    if (item != null)
                    {
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Item, item.Name, -1));
                    }
                    else
                    {
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Livre, -Util.RNG.Generate(30, 61)));
                    }
                    break;

                // Livre Lost
                case 5:
                    model.Party.Rewards.Add(new CommodityVO(CommodityType.Livre, -Util.RNG.Generate(30, 61)));
                    break;

                // Enemy made
                case 6:
                    model.Party.Rewards.Add(new CommodityVO(CommodityType.Enemy, party.Faction));
                    break;

                // Forgot gossip
                case 7:
                    model.Party.Rewards.RemoveAll(r => r.Type == CommodityType.Gossip);
                    {
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Enemy, party.Faction));
                    }
                    break;

                case 8:
                    switch (Util.RNG.Generate(0, 6))
                    {
                    case 1:
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, Util.RNG.Generate(20, 51)));
                        break;

                    case 2:
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Reputation, party.Faction, Util.RNG.Generate(20, 51)));
                        break;

                    case 3:
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Livre, Util.RNG.Generate(30, 61)));
                        break;

                    case 4:
                        model.Party.Rewards.Add(new CommodityVO(CommodityType.Gossip, party.Faction, 1));
                        break;

                    default:
                        EnemyVO enemy = Util.RNG.TakeRandom(party.Enemies);
                        if (enemy != null)
                        {
                            model.Party.Rewards.Add(new CommodityVO(CommodityType.Enemy, enemy.Name, -1));
                        }
                        else
                        {
                            model.Party.Rewards.Add(new CommodityVO(CommodityType.Gossip, party.Faction, 1));
                        }
                        break;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 6
0
 private void UpdateInventory(InventoryModel inventory)
 {
     Refresh();
     ItemCountText.text = Count.ToString();
 }
Ejemplo n.º 7
0
        public bool CheckRequirements(CommodityVO[] requirments)
        {
            GameModel model = AmbitionApp.GetModel <GameModel>();

            foreach (CommodityVO req in requirments)
            {
                switch (req.Type)
                {
                case CommodityType.Item:
                    InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>();
                    ItemVO         item      = inventory.Inventory.Find(i => i.Name == req.ID);
                    if (item == null || item.Quantity < req.Value)
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Livre:
                    if (model.Livre < req.Value)
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Location:
                    ParisModel paris = AmbitionApp.GetModel <ParisModel>();
                    if (!paris.Locations.Contains(req.ID))
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Reputation:
                    FactionModel factions = AmbitionApp.GetModel <FactionModel>();
                    return((req.ID != null && factions.Factions.ContainsKey(req.ID))
                            ? factions[req.ID].Reputation >= req.Value
                            : model.Reputation >= req.Value);

                case CommodityType.Servant:
                    ServantModel servants = AmbitionApp.GetModel <ServantModel>();
                    if (!servants.Servants.ContainsKey(req.ID))
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Date:
                    CalendarModel calendar = AmbitionApp.GetModel <CalendarModel>();
                    if (calendar.Today.Ticks < req.Value)
                    {
                        return(false);
                    }
                    break;

                case CommodityType.Mark:
                    MapModel map = AmbitionApp.GetModel <MapModel>();
                    return(Array.Exists(map.Map.Rooms, r => r.HostHere && r.Cleared));
                }
            }
            return(true);
        }
 // Use this for initialization
 void Start()
 {
     _model = AmbitionApp.GetModel <InventoryModel>();
     myText = GetComponent <Text>();
 }
Ejemplo n.º 9
0
 private void HandleInventory(InventoryModel inventory)
 {
     Button.interactable = inventory.GetItems(ItemType.Outfit)?.Length > 0;
 }