Exemplo n.º 1
0
        /// <summary>
        /// Check to see if any events are about to be triggered
        /// </summary>
        internal void CurrentEventCheck(Team team, IntegratedAuthoringToolAsset iat)
        {
            var spacelessName = Name.NoSpaces();

            //if the crew member is expecting to be selected
            if (LoadBelief(NPCBelief.ExpectedSelection) != null)
            {
                //if the crew member is not in a position
                if (team.Boat.GetCrewMemberPosition(this) == Position.Null)
                {
                    //reduce opinion of the manager
                    AddOrUpdateOpinion(team.ManagerName, -3);
                    //send event on record that this happened
                    var eventString = EventHelper.ActionStart("Player", "PostRace(NotPickedNotDone)", spacelessName);
                    RolePlayCharacter.Perceive(eventString);
                    eventString = EventHelper.ActionStart("Player", "MoodChange(-3)", spacelessName);
                    RolePlayCharacter.Perceive(eventString);
                }
                //set their belief to 'null'
                UpdateSingleBelief(NPCBelief.ExpectedSelection);
                TickUpdate(0);
            }
            //if the crew member is expecting to be selecting in a particular position
            if (LoadBelief(NPCBelief.ExpectedPosition) != null)
            {
                var expected = LoadBelief(NPCBelief.ExpectedPosition);
                if (expected != null && team.Boat.Positions.Any(p => p.ToString() == expected))
                {
                    //if they are currently not in the position they expected to be in
                    if (team.Boat.GetCrewMemberPosition(this).ToString() != expected)
                    {
                        //reduce opinion of the manager
                        AddOrUpdateOpinion(team.ManagerName, -3);
                        //send event on record that this happened
                        var eventString = EventHelper.ActionStart("Player", "PostRace(PWNotDone)", spacelessName);
                        RolePlayCharacter.Perceive(eventString);
                        eventString = EventHelper.ActionStart("Player", "MoodChange(-3)", spacelessName);
                        RolePlayCharacter.Perceive(eventString);
                    }
                    //set their belief to 'null'
                    UpdateSingleBelief(NPCBelief.ExpectedPosition);
                    TickUpdate(0);
                }
            }
            //if the crew member expects to be selected in a position after this current race, set them to instead be expecting to be selected for the current race
            if (LoadBelief(NPCBelief.ExpectedPositionAfter) != null)
            {
                var expected = LoadBelief(NPCBelief.ExpectedPositionAfter);
                if (expected != null)
                {
                    UpdateSingleBelief(NPCBelief.ExpectedPositionAfter);
                    UpdateSingleBelief(NPCBelief.ExpectedPosition, expected);
                    TickUpdate(0);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retire this CrewMember
        /// </summary>
        internal void Retire()
        {
            UpdateSingleBelief(NPCBelief.Position, "Retired");
            var spacelessName = Name.NoSpaces();
            var eventString   = EventHelper.ActionStart("Player", "Status(Retired)", spacelessName);

            RolePlayCharacter.Perceive(eventString);
            Avatar = new Avatar(this, false);
            SaveStatus();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Make changes based off of post-race events
        /// </summary>
        private void PostRaceFeedback(string ev, Team team, List <string> subjects)
        {
            var spacelessName = Name.NoSpaces();
            var eventString   = EventHelper.ActionStart("Player", $"PostRace({ev})", spacelessName);

            if (ev.Contains("("))
            {
                eventString = EventHelper.ActionStart("Player", ev, spacelessName);
            }
            //event perceived to trigger any mood change events kept in the EA file
            RolePlayCharacter.Perceive(eventString);
            if (Enum.IsDefined(typeof(PostRaceEventImpact), ev))
            {
                //trigger different changes based off of what dialogue the player last picked
                switch ((PostRaceEventImpact)Enum.Parse(typeof(PostRaceEventImpact), ev))
                {
                //improve opinion of manager, crew member now expects to be picked in the selected position (subjects[0]) next race
                case PostRaceEventImpact.ExpectedPosition:
                    AddOrUpdateOpinion(team.ManagerName, 1);
                    UpdateSingleBelief(NPCBelief.ExpectedPosition, subjects[0]);
                    break;

                //improve opinion of manager, crew member now expects to be picked in the selected position (subjects[0]) in two races time
                case PostRaceEventImpact.ExpectedPositionAfter:
                    AddOrUpdateOpinion(team.ManagerName, 1);
                    UpdateSingleBelief(NPCBelief.ExpectedPositionAfter, subjects[0]);
                    break;

                //make opinion of manager worse
                case PostRaceEventImpact.ManagerOpinionWorse:
                    AddOrUpdateOpinion(team.ManagerName, -1);
                    break;

                //make all crew members' opinion of manager worse
                case PostRaceEventImpact.ManagerOpinionAllCrewWorse:
                    foreach (var cm in team.CrewMembers)
                    {
                        cm.Value.AddOrUpdateOpinion(team.ManagerName, -2);
                        cm.Value.SaveStatus();
                    }
                    break;

                //improve opinion of manager
                case PostRaceEventImpact.ManagerOpinionBetter:
                    AddOrUpdateOpinion(team.ManagerName, 1);
                    break;

                //make all crew members' opinion of manager better
                case PostRaceEventImpact.ManagerOpinionAllCrewBetter:
                    foreach (var cm in team.CrewMembers)
                    {
                        cm.Value.AddOrUpdateOpinion(team.ManagerName, 2);
                        cm.Value.SaveStatus();
                    }
                    break;

                //improve opinion of manager greatly
                case PostRaceEventImpact.ManagerOpinionMuchBetter:
                    AddOrUpdateOpinion(team.ManagerName, 5);
                    break;

                //make opinion of manager much worse
                case PostRaceEventImpact.ManagerOpinionMuchWorse:
                    AddOrUpdateOpinion(team.ManagerName, -5);
                    break;

                //reveal two random skills for this crew member (can be already revealed skills)
                case PostRaceEventImpact.RevealTwoSkills:
                    AddOrUpdateOpinion(team.ManagerName, 1);
                    for (var i = 0; i < 2; i++)
                    {
                        var randomStat = Math.Pow(2, StaticRandom.Int(0, Skills.Count));
                        var statName   = ((Skill)randomStat).ToString();
                        var statValue  = Skills[(Skill)randomStat];
                        RevealedSkills[(Skill)randomStat] = statValue;
                        UpdateSingleBelief(NPCBelief.RevealedSkill, statValue, statName);
                    }
                    break;

                //reveal four random skills for this crew member (can be already revealed skills)
                case PostRaceEventImpact.RevealFourSkills:
                    AddOrUpdateOpinion(team.ManagerName, 3);
                    for (var i = 0; i < 4; i++)
                    {
                        var randomStat = Math.Pow(2, StaticRandom.Int(0, Skills.Count));
                        var statName   = ((Skill)randomStat).ToString();
                        var statValue  = Skills[(Skill)randomStat];
                        RevealedSkills[(Skill)randomStat] = statValue;
                        UpdateSingleBelief(NPCBelief.RevealedSkill, statValue, statName);
                    }
                    break;

                //improve all crew members' opinion of the crew member who was the subject of the event (subjects[0]) greatly and reveals their opinion.
                //Regex adds spaces back before each capital letter
                case PostRaceEventImpact.ImproveConflictOpinionGreatly:
                    var subGreatHelp = Regex.Replace(subjects[0], @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0");
                    foreach (var cm in team.CrewMembers)
                    {
                        if (cm.Key != subGreatHelp)
                        {
                            cm.Value.AddOrUpdateOpinion(subGreatHelp, 2);
                            cm.Value.AddOrUpdateRevealedOpinion(subGreatHelp, cm.Value.CrewOpinions[subGreatHelp]);
                            cm.Value.SaveStatus();
                        }
                    }
                    break;

                //improve all crew members' opinion of the crew member who was the subject of the event (subjects[0]) and reveals their opinion.
                //Regex adds spaces back before each capital letter
                case PostRaceEventImpact.ImproveConflictTeamOpinion:
                    var subHelp = Regex.Replace(subjects[0], @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0");
                    foreach (var cm in team.CrewMembers)
                    {
                        if (cm.Key != subHelp)
                        {
                            cm.Value.AddOrUpdateOpinion(subHelp, 1);
                            cm.Value.AddOrUpdateRevealedOpinion(subHelp, cm.Value.CrewOpinions[subHelp]);
                            cm.Value.SaveStatus();
                        }
                    }
                    break;

                //reveals all crew members' opinion of the crew member who was the subject of the event (subjects[0]) and slightly improves this the opinion of the manager for this crew member.
                //Regex adds spaces back before each capital letter
                case PostRaceEventImpact.ImproveConflictKnowledge:
                    var subKnow = Regex.Replace(subjects[0], @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0");
                    AddOrUpdateOpinion(team.ManagerName, 1);
                    foreach (var cm in team.CrewMembers)
                    {
                        if (cm.Key != subKnow)
                        {
                            cm.Value.AddOrUpdateRevealedOpinion(subKnow, cm.Value.CrewOpinions[subKnow]);
                            cm.Value.SaveStatus();
                        }
                    }
                    break;

                //improve opinion of manager, expects to be placed in perferred position (subjects[0]) next race
                //other crew member involved in this event (subjects[1]) - improve opinion of manager, expects to be placed in perferred position (subjects[0]) in two races times
                //Regex adds spaces back before each capital letter
                case PostRaceEventImpact.CausesSelectionAfter:
                    AddOrUpdateOpinion(team.ManagerName, 1);
                    UpdateSingleBelief(NPCBelief.ExpectedPosition, subjects[0]);
                    var otherPlayer = Regex.Replace(subjects[1], @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0");
                    team.CrewMembers[otherPlayer].AddOrUpdateOpinion(team.ManagerName, 1);
                    team.CrewMembers[otherPlayer].UpdateSingleBelief(NPCBelief.ExpectedPositionAfter, subjects[0]);
                    team.CrewMembers[otherPlayer].SaveStatus();
                    break;

                //improves opinion of manager greatly, all unselected crew members' opinion of manager improves and expect to be selected next race
                case PostRaceEventImpact.WholeTeamChange:
                    AddOrUpdateOpinion(team.ManagerName, 4);
                    foreach (var cm in team.CrewMembers)
                    {
                        if (!team.PreviousSession.PositionCrew.Values.Select(v => v.Name).Contains(cm.Key))
                        {
                            cm.Value.AddOrUpdateOpinion(team.ManagerName, 1);
                            cm.Value.UpdateSingleBelief(NPCBelief.ExpectedSelection, "true");
                            cm.Value.SaveStatus();
                        }
                    }
                    break;
                }
            }
            TickUpdate(0);
        }