Пример #1
0
        public override void Apply(SystemArgs args)
        {
            if (args.AggressorIfAny == null)
            {
                return;
            }

            if (args.AggressorIfAny is You)
            {
                var d = GetDialogue(args.Recipient.Dialogue.Next);

                //if there is no main dialogue set or its conditions are not yet met, fall back on banter
                if (d == null || !d.AllConditionsMet(args.World, args))
                {
                    d = GetBanter(args);
                }

                if (d != null)
                {
                    Run(args, d);
                }
                else
                {
                    args.UserInterface.ShowMessage("Dialogue", $"{args.Recipient} had nothing interesting to say");
                }
            }
        }
Пример #2
0
 public void ApplyToAll(IEnumerable <IHasStats> recipients, SystemArgs args)
 {
     foreach (IHasStats r in recipients)
     {
         args.Recipient = r;
         Apply(args);
     }
 }
Пример #3
0
        public void Run(SystemArgs args, DialogueNode node)
        {
            var options = node.GetOptionsToShow(args.World, args);

            if (options.Any())
            {
                if (args.UserInterface.GetChoice("Dialogue", FormatString(args, node.Body), out DialogueOption chosen, options))
                {
                    Run(args, chosen);
                }
                else
                {
                    //if user hits Escape just pick the first option for them :)
                    Run(args, options.First());
                }
            }
Пример #4
0
        public override void Apply(SystemArgs args)
        {
            var negotiation = (NegotiationSystemArgs)args;

            //how much do they like you? if they like you they are more likely to do what you say
            var actorRecipient = ((IActor)args.Recipient);
            var world          = actorRecipient.CurrentLocation.World;

            var loveForYou = world.Relationships.SumBetween(actorRecipient, args.AggressorIfAny);


            //You need a high negotiation intensity to persuade people to perform extreme actions
            //Either extremely nasty or extremely nice
            var needed = Math.Abs(negotiation.Proposed.Attitude);

            needed -= loveForYou;

            if (negotiation.Intensity < needed)
            {
                negotiation.RejectNegotiation($"Insufficient persuasion (Needed {needed}, Had {negotiation.Intensity})");
            }
        }
Пример #5
0
        public override void Apply(SystemArgs args)
        {
            if (args.Intensity < 0)
            {
                return;
            }

            if (args.Recipient == null)
            {
                return;
            }

            if (MergeInstances)
            {
                var existing = args.Recipient.Adjectives.OfType <IInjured>().Where(i => i.InjurySystem.Equals(this)).FirstOrDefault();

                if (existing != null)
                {
                    Amplify(existing, args.Intensity, args.UserInterface, args.Round);
                    return;
                }
            }

            var candidate = GetBlueprintFor(args.Intensity);

            if (candidate == null)
            {
                throw new Exception("No Injury  found for severity " + args.Intensity);
            }

            var newInjury = new Injured(candidate.Name, args.Recipient, args.Intensity, candidate.Region, this)
            {
                Identifier = this.Identifier
            };

            args.Recipient.Adjectives.Add(newInjury);
            args.UserInterface.Log.Info(new LogEntry($"{args.Recipient} gained {newInjury}", args.Round, args.Room.GetPoint()));
        }
Пример #6
0
        public void Apply(SystemArgs args)
        {
            //don't form a relationship with yourself or nobody!
            if (args.AggressorIfAny == args.Recipient || args.AggressorIfAny == null)
            {
                return;
            }

            var actorRecipient = (IActor)args.Recipient;

            //if someone is doing something to you
            if (Math.Abs(args.Intensity) > 0.0001)
            {
                //don't form relationships with the dead
                if (args.AggressorIfAny.Dead || actorRecipient.Dead)
                {
                    return;
                }

                var world = actorRecipient.CurrentLocation.World;

                //log the change
                if (args.Intensity > 0.001)
                {
                    args.UserInterface.Log.Info(new LogEntry($"{args.Recipient} expressed approval towards {args.AggressorIfAny}", args.Round, actorRecipient));
                }
                else if (args.Intensity < 0.001)
                {
                    args.UserInterface.Log.Info(new LogEntry($"{args.Recipient} became angry at {args.AggressorIfAny}", args.Round, actorRecipient));
                }


                ApplyChangeToPersonalRelationship(world, actorRecipient, args);
                ApplyChangeToFactionRelationships(world, actorRecipient, args);
            }
        }
Пример #7
0
 public abstract void Apply(SystemArgs args);
Пример #8
0
        private void ApplyChangeToFactionRelationships(IWorld world, IActor actorRecipient, SystemArgs args)
        {
            //each faction you represent as the victim/recipient
            foreach (var receiving in actorRecipient.FactionMembership)
            {
                foreach (var aggressing in args.AggressorIfAny.FactionMembership)
                {
                    var existingRelationship = world.Relationships.OfType <InterFactionRelationship>()
                                               .FirstOrDefault(r => r.HostFaction == receiving && r.ObservedFaction == aggressing);


                    if (existingRelationship != null)
                    {
                        existingRelationship.Attitude += args.Intensity * factionFraction;
                    }
                    else
                    {
                        world.Relationships.Add(new InterFactionRelationship(receiving, aggressing, args.Intensity * factionFraction)
                        {
                            Attitude = args.Intensity
                        });
                    }
                }
            }
        }
Пример #9
0
        private void ApplyChangeToPersonalRelationship(IWorld world, IActor actorRecipient, SystemArgs args)
        {
            //then you need to be angry about that! (or happy)
            var existingRelationship = world.Relationships.OfType <PersonalRelationship>()
                                       .FirstOrDefault(r => r.AppliesTo(actorRecipient, args.AggressorIfAny));

            if (existingRelationship != null)
            {
                existingRelationship.Attitude += args.Intensity;
            }
            else
            {
                world.Relationships.Add(new PersonalRelationship(actorRecipient, args.AggressorIfAny)
                {
                    Attitude = args.Intensity
                });
            }
        }