public void SetPartyOutfit(OutfitVO outfit) { Substitutions[LocalizationConsts.OUTFITNAME] = GetItemName(outfit); Substitutions[LocalizationConsts.OUTFITTITLE] = GetItemName(outfit); Substitutions[LocalizationConsts.OUTFITMODESTY] = GetStatText(outfit, ItemConsts.MODESTY); Substitutions[LocalizationConsts.OUTFITLUXURY] = GetStatText(outfit, ItemConsts.LUXURY); }
public void Execute(DateTime day) { InventoryModel model = AmbitionApp.GetModel <InventoryModel>(); int count = model.ItemDefinitions.Length; ItemVO item; string style = null; model.Market.Clear(); while (model.Market.Count < model.NumMarketSlots) { item = new ItemVO(model.ItemDefinitions[Util.RNG.Generate(0, count)]); item.State[ItemConsts.STYLE] = style = model.Styles[Util.RNG.Generate(0, model.Styles.Length)]; item.Name = style + " " + item.Name; model.Market.Add(item); } OutfitVO outfit = OutfitVO.Create(); outfit.Style = style; outfit.GenerateName(); List <ItemVO> outfits = new List <ItemVO>() { outfit, OutfitVO.Create(), OutfitVO.Create() }; if (AmbitionApp.GetModel <FactionModel>()["Bourgeoisie"].Level >= 3) { outfits.Add(OutfitVO.Create()); } model.Market.RemoveAll(i => i.Type == ItemConsts.OUTFIT); model.Market.AddRange(outfits); }
void HandleItemDisplay(ItemVO item) { _item = item; OutfitVO outfitTest = _item as OutfitVO; //This is to test if the item is an Outfit if (outfitTest != null) { OutfitVO outfit = (OutfitVO)_item; int displayPrice; if (_inventorymodel.Market.Contains(_item)) //If the item is in Fatima's shop { ItemCostText.text = CostString; BuyOrSellItemText.text = BuyOutfitString; displayPrice = outfit.Price; } else //If the item is not in Fatima's shop { ItemCostText.text = ValueString; BuyOrSellItemText.text = SellOutfitString; displayPrice = (int)(outfit.Price * _inventorymodel.SellbackMultiplier); } ItemPriceText.text = "£" + displayPrice.ToString("### ###"); } }
void PopulateInventory() { List <ItemVO> scanList; if (InventoryOwner == InventoryType.Shop) { scanList = _inventorymodel.Market; //If it's Fatima's shop } else { scanList = _inventorymodel.Inventory; } //Clearing the display lists out to prevent duplicates _outfitDisplayList.Clear(); _accessoryDisplayList.Clear(); foreach (ItemVO i in scanList) { OutfitVO outfitTest = i as OutfitVO; //This is to test if the item is an Outfit if (outfitTest != null) { _outfitDisplayList.Add(outfitTest); } else if (i.Type == "Accessory")//To Do: Make this actually populate the list, but we first need working accessories again (I mean, they used to, sort of work) { _accessoryDisplayList.Add(i); } } AccessoriesCountCheck(_accessoryDisplayList.Count); DisplayInventory(); }
public int GetFactionBonus(ItemVO item, FactionType faction) { OutfitVO outfit = item as OutfitVO; if (outfit == null) { return(0); } FactionVO fvo = AmbitionApp.GetModel <FactionModel>()[faction]; if (fvo == null) { return(0); } if (outfit.State == null) { outfit.State = new Dictionary <string, string>(); } int modesty = outfit.Modesty; int luxury = outfit.Luxury; int novelty = outfit.Novelty; // -200 to +200 int sum = 200 - (Math.Abs(fvo.Modesty - modesty) + Math.Abs(fvo.Luxury - luxury)); // max range +/- 20 cred for outfit const int credibility_shift_scale = 20; // TODO expose this tuning variable return((int)(sum * novelty * credibility_shift_scale * 0.00005f)); }
private void HandleOutfit(ItemVO item) { OutfitVO outfit = item as OutfitVO; int val = outfit?.Novelty ?? 0; _animator.SetFloat("OutfitNovelty", .01f * (float)val); }
public string GetStatText(OutfitVO outfit, string stat) { if (outfit == null) { return(null); } Dictionary <string, string> phrases = AmbitionApp.GetPhrases("outfit." + stat); if (phrases.Count == 0) { return(""); } int value = outfit.GetIntStat(stat); switch (stat) { case ItemConsts.NOVELTY: value = (int)(.099f * phrases.Count * value); break; case ItemConsts.MODESTY: case ItemConsts.LUXURY: value = (int)Mathf.Floor(.00499f * phrases.Count * (value + 100)); break; } return(new List <string>(phrases.Values)[value]); }
// Empty/Default Constructor means random outfit public static OutfitVO Create() { OutfitVO result = new OutfitVO(); result.Novelty = 100; result.Modesty = GenerateRandom(); result.Luxury = GenerateRandom(); switch (Util.RNG.Generate(0, 4)) { case 1: result.Style = "Frankish"; break; case 2: result.Style = "Venezian"; break; default: result.Style = "Catalan"; break; } result.CalculatePrice(); result.GenerateName(); result.GenerateDescription(); return(result); }
private void HandleOutfit(OutfitVO outfit) { Sprite s = (outfit != null) ? DressConfig.GetSprite(outfit.Style) : null; _dollImage.sprite = (s != null) ? s : DressConfig.Sprites[0].Sprite; }
public void Execute() { PartyVO party = AmbitionApp.GetModel <PartyModel>().Party; OutfitVO outfit = AmbitionApp.Inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO; AmbitionApp.GetModel <FactionModel>().Factions.TryGetValue(party.Faction, out FactionVO faction); int score = 200 - Math.Abs(faction.Modesty - outfit.Modesty) - Math.Abs(faction.Luxury - outfit.Luxury); int cred = (int)(score * outfit.Novelty * .001f); CommodityVO reward = new CommodityVO(CommodityType.Credibility, cred); AmbitionApp.SendMessage(reward); }
public int GetOutfitFavor(string characterID, OutfitVO outfit) { CharacterVO character = GetCharacter(characterID); if (character == null) { return(0); } AmbitionApp.GetModel <FactionModel>().Factions.TryGetValue(character.Faction, out FactionVO faction); int score = 200 - Math.Abs(outfit.Modesty - faction.Modesty) - Math.Abs(outfit.Luxury - faction.Luxury); return((int)Math.Floor(score * outfit.Novelty * .00333333)); }
private void HandleOutfit(OutfitVO outfit) { if (outfit != null) { ItemVO item = (ItemVO)outfit; object value; _meter.value = item.State.TryGetValue(Stat, out value) ? Convert.ToInt32(value) : 0; } else { _meter.value = 0; } }
private void HandleEquip(ItemVO item) { OutfitVO outfit = item as OutfitVO; if (outfit != null) { int value = outfit.GetIntStat(Stat); if (Stat != ItemConsts.NOVELTY) { value = (int)((100 + value) >> 1); } StopAllCoroutines(); ValueText.text = value.ToString(); StartCoroutine(Fill(value)); } }
public override void OnEnterState() { InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>(); List <ItemVO> items = inventory.Inventory.FindAll(i => i.Type == ItemConsts.ACCESSORY); OutfitVO outfit = null; if (items.Count == 0) { items = inventory.Inventory.FindAll(i => i.Type == ItemConsts.OUTFIT); if (items.Count == 1) { outfit = new OutfitVO(items[0]); } } inventory.Equipped[ItemConsts.OUTFIT] = outfit; inventory.Equipped[ItemConsts.ACCESSORY] = null; }
public void Execute() { InventoryModel inventory = AmbitionApp.GetModel <InventoryModel>(); // Update the "Last Equipped" outfit in the player's inventory OutfitVO outfit = inventory.GetEquipped(ItemConsts.OUTFIT) as OutfitVO; if (outfit != null) { outfit.Novelty -= inventory.NoveltyDamage; } inventory.Equipped[ItemConsts.LAST_OUTFIT] = outfit; // Reset the player's equipped items inventory.Equipped.Remove(ItemConsts.OUTFIT); inventory.Equipped.Remove(ItemConsts.ACCESSORY); }
void Start() { PartyModel model = AmbitionApp.GetModel <PartyModel>(); _inventory = AmbitionApp.GetModel <InventoryModel>(); List <GossipVO> gossipList = AmbitionApp.Gossip.Gossip; int gossipIndex = gossipList.Count - 1; PartyText.text = AmbitionApp.Localize(PartyConstants.PARTY_NAME + model.Party.ID); FactionIcon.sprite = FactionIconConfig.GetSprite(model.Party.Faction.ToString()); List <RewardItem> rewards = AmbitionApp.CreateRewardListItems(model.Rewards, listItem); OutfitVO outfit = _inventory.GetEquippedItem(ItemType.Outfit) as OutfitVO; if (outfit != null) { int novelty = outfit.Novelty - model.BaseNoveltyLoss - model.CumulativeNoveltyLoss * outfit.TimesWorn; if (novelty < 0) { novelty = 0; } OutfitText.text = AmbitionApp.Localization.GetItemName(outfit); NoveltySlider.value = novelty; NoveltySliderText.text = novelty.ToString(); } string host = AmbitionApp.Localize(PartyConstants.PARTY_HOST + model.Party.Host); if (string.IsNullOrEmpty(host)) { host = model.Party.Host; } Dictionary <string, string> subs = new Dictionary <string, string>() { { HOST_TOKEN, host } }; PartyHostText.text = AmbitionApp.Localize("after_party_dialog.host", subs); for (int i = rewards.Count - 1; i >= 0; --i) { if (rewards[i].Data.Type == CommodityType.Gossip) { rewards[i].SetGossip(gossipList[gossipIndex]); --gossipIndex; } } }
//TO DO: Make this work with Accessories (when they're full implemented) void HandleItemDisplay(ItemVO item) { OutfitVO outfitTest = item as OutfitVO; //This is to test if the item is an Outfit if (outfitTest != null) { OutfitVO outfit = (OutfitVO)item; ItemNameText.text = outfit.Name; ItemDescriptionText.text = outfit.Description; //To Do: Make the modesty and luxury sliders always work in the right direction LuxurySlider.value = outfit.Luxury; LuxuryStatText.text = outfit.Luxury + " (" + outfit.GenerateLuxuryString() + ")"; ModestySlider.value = outfit.Modesty; ModestyStatText.text = outfit.Modesty + " (" + outfit.GenerateModestyString() + ")"; NoveltySlider.value = outfit.Novelty; NoveltyStatText.text = outfit.Novelty + "/100"; PaperDoll.sprite = DressCollection.GetSprite(outfit.Style); } }
OutfitVO GenerateOutfit(InventoryModel inventory, List <OutfitVO> defs) { OutfitVO outfit = new OutfitVO() { Created = AmbitionApp.Calendar.Today, Modesty = 100 - RNG.Generate(201), Luxury = 100 - RNG.Generate(201) }; outfit.Price = Math.Abs(outfit.Modesty) + Math.Abs(outfit.Luxury); if (outfit.Price < 10) { outfit.Price = 10; } int modesty = outfit.Modesty <= inventory.RisqueLimit ? -1 : outfit.Modesty >= inventory.ModestLimit ? 1 : 0; int luxury = outfit.Luxury <= inventory.HumbleLimit ? -1 : outfit.Modesty >= inventory.LuxuryLimit ? 1 : 0; List <OutfitVO> candidates = new List <OutfitVO>(); foreach (OutfitVO def in defs) { if ((def.Modesty < 0) == (modesty < 0) && (def.Modesty > 0) == (modesty > 0) && (def.Luxury < 0) == (luxury < 0) && (def.Luxury > 0) == (luxury > 0)) { candidates.Add(def); } } OutfitVO candidate = Util.RNG.TakeRandom(candidates); outfit.ID = candidate.ID; outfit.AssetID = candidate.AssetID; return(outfit); }
private void HandleOutfit(OutfitVO outfit) { _animator.SetFloat("OutfitNovelty", (float)outfit.Novelty * .01f); }
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); }