コード例 #1
0
        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));
        }
コード例 #2
0
        public void Execute(PartyVO party)
        {
            PartyModel model   = AmbitionApp.GetModel <PartyModel>();
            FactionVO  faction = AmbitionApp.GetModel <FactionModel>()[party.Faction];

            //Extra Turns because of Faction Reputation Level
            switch (party.Importance)
            {
            case PartySize.Trivial:
                if (faction.Level >= 4)
                {
                    model.Party.Turns += 2;
                }
                break;

            case PartySize.Decent:
                if (faction.Level >= 7)
                {
                    model.Party.Turns += 3;
                }
                break;

            case PartySize.Grand:
                if (faction.Level >= 9)
                {
                    model.Party.Turns += 4;
                }
                break;
            }
        }
コード例 #3
0
 public FactionVO(FactionVO faction)
 {
     Type       = faction.Type;
     Modesty    = faction.Modesty;
     Luxury     = faction.Luxury;
     Steadfast  = faction.Steadfast;
     Allegiance = faction.Allegiance;
     Power      = faction.Power;
 }
コード例 #4
0
ファイル: FactionModel.cs プロジェクト: rasmus-z/DeWinter
        public FactionVO GetRandomFactionNoNeutral() //Used for a variety of tasks, this returns a randomly selected faction that isn't the 'Neutral' faction used for certain parties
        {
            List <FactionVO> factionList       = Factions.Values.ToList();
            List <FactionVO> randomFactionList = new List <FactionVO>();

            foreach (FactionVO f in factionList)
            {
                if (f.Name != "Neutral")
                {
                    randomFactionList.Add(f);
                }
            }
            FactionVO randomFaction = randomFactionList[Util.RNG.Generate(0, randomFactionList.Count)];

            return(randomFaction);
        }
コード例 #5
0
ファイル: AdjustFactionCmd.cs プロジェクト: rasmus-z/DeWinter
        public void Execute(AdjustFactionVO vo)
        {
            FactionVO faction = _model[vo.Faction];

            if (faction != null)
            {
                FactionLevelVO[] Levels = _model.Levels;
                faction.Allegiance            = Clamp(faction.Allegiance + vo.Allegiance, -100, 100);
                faction.Power                 = Clamp(faction.Power + vo.Power, 0, 100);
                faction.Reputation           += vo.Reputation;
                faction.Level                 = Array.FindAll(Levels, l => faction.Reputation > l.Requirement).Min(l => l.Requirement);
                faction.LargestAllowableParty = Levels[faction.Level].LargestAllowableParty;
                faction.DeckBonus             = Levels[faction.Level].DeckBonus;
                faction.Priority              = Levels[faction.Level].Importance;
                AmbitionApp.SendMessage <FactionVO>(faction);
            }
        }
コード例 #6
0
        void OnEnable()
        {
            PartyVO party = AmbitionApp.GetModel <PartyModel>().Party;

            if (party != null)
            {
                string    factionID = party == null ? null : party.Faction;
                FactionVO faction   = AmbitionApp.GetModel <FactionModel>()[factionID];
                int       stat      = (Stat.ToLower() == ItemConsts.LUXURY ? faction.Luxury : faction.Modesty);
                Minimum.enabled = (stat < 0);
                Maximum.enabled = (stat > 0);
            }
            else
            {
                Minimum.enabled = false;
                Maximum.enabled = false;
            }
        }
コード例 #7
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);
        }
コード例 #8
0
ファイル: GenerateMapState.cs プロジェクト: rasmus-z/DeWinter
        private MapVO BuildRandomMap(PartyVO party)
        {
            MapVO     map     = new MapVO();
            FactionVO faction = AmbitionApp.GetModel <FactionModel>().Factions[party.Faction];

            // Room size is proportional to how "baroque" the structure is.
            // Curvilinear features are a function of "modernness," which will be determined by the host.
            // Overall size of the house will be proportional to the "Importance" of the party.
            int    hyphen   = (int)party.Importance + Util.RNG.Generate(3);                                             // the width of the hyphen in rooms
            int    pavilion = (int)party.Importance + Util.RNG.Generate(3);                                             // length of the pavilion in rooms
            int    jut      = Util.RNG.Generate(0, 2);
            int    spacing  = (int)(Util.RNG.Generate(faction.Baroque[0], faction.Baroque[1]) * .01f * MAX_ROOM_WIDTH); // Median room spacing
            float  curve1   = .1f * Util.RNG.Generate(6, 11);
            float  delta;
            RoomVO room;

            if (spacing < MIN_ROOM_WIDTH)
            {
                spacing = MIN_ROOM_WIDTH;
            }
            int salonX = Util.RNG.Generate(spacing, spacing + spacing);
            int salonY = Util.RNG.Generate(spacing, (int)(spacing * PHI));
            int salonH = Util.RNG.Generate(salonY, spacing + spacing);

            delta = 0f;            //(float)((salonX - Util.RNG.Generate(spacing, salonX)>>1));

            // Make the vestibule
            room            = MakeRectRoom((int)(delta), 0, salonX - (int)(delta + delta), salonY);
            room.Cleared    = true;
            room.Features   = new string[0];
            room.Difficulty = 0;
            room.Name       = "Vestibule";

            // Make the Salon
            room      = MakeRectRoom(0, salonY, salonX, salonH);
            room.Name = "Salon";

            MakeRectRoom(salonX, salonY, spacing, salonH);
            MakeRectRoom(-spacing, salonY, spacing, salonH);

            MakeRectRoom(salonX - (int)(delta), 0, spacing + (int)(delta), salonY);
            MakeRectRoom(-spacing, 0, spacing + (int)(delta), salonY);


            for (int column = 0; column <= hyphen; column++)
            {
                delta = column == hyphen ? 1 : (float)(hyphen - column);
                for (int numrooms = (int)Math.Ceiling(pavilion * curve1 / delta) - 1; numrooms >= 0; numrooms--)
                {
                    MakeRectRoom(salonX + spacing + column * spacing, -numrooms * spacing,
                                 spacing, numrooms > 0 ? spacing : salonY);
                    MakeRectRoom(-(column + 2) * spacing, -numrooms * spacing,
                                 spacing, numrooms > 0 ? spacing : salonY);
                }
                for (int numrooms = 1 + (int)Math.Floor((float)(jut) / delta); numrooms > 0; numrooms--)
                {
                    MakeRectRoom(
                        salonX + spacing + column * spacing,
                        salonY + (numrooms - 1) * salonH,
                        spacing, numrooms > 1 ? spacing : salonH);
                    MakeRectRoom(
                        -(column + 2) * spacing,
                        salonY + (numrooms - 1) * salonH,
                        spacing, numrooms > 1 ? spacing : salonH);
                }
            }

            foreach (KeyValuePair <RoomVO, List <RoomVO> > kvp in _rooms)
            {
                kvp.Key.Doors = kvp.Value.Where(r => r != kvp.Key).ToArray();
            }
            map.Rooms = _rooms.Keys.ToArray();
            return(map);
        }