Exemplo n.º 1
0
 public ApplyEffect(ApplySystemBlueprint apply, SystemArgsTarget target) : base(target)
 {
     Identifier = apply.Identifier;
     Intensity  = apply.Intensity;
     Name       = apply.Name;
     All        = apply.All;
 }
Exemplo n.º 2
0
        public override IHasStats GetTarget(SystemArgsTarget target)
        {
            if (target == SystemArgsTarget.Owner)
            {
                return(Action.Owner);
            }

            return(base.GetTarget(target));
        }
Exemplo n.º 3
0
        public void Test_ApplySystem(SystemArgsTarget target, bool toAll)
        {
            TwoInARoom(out You you, out IActor them, out IWorld world);

            world.InjurySystems.Add(new InjurySystem()
            {
                Name     = "Violence",
                Injuries = new List <InjuryBlueprint> {
                    new InjuryBlueprint()
                    {
                        Name = "Cracked Rib"
                    }
                }
            });

            var blue = new EffectBlueprint()
            {
                Target = target,
                Apply  = new ApplySystemBlueprint()
                {
                    Name      = "Violence",
                    Intensity = 40,
                    All       = toAll
                }
            };

            var effect = (ApplyEffect)blue.Create().Single();

            effect.Apply(new SystemArgs(world, new FixedChoiceUI(), 0, you, them, Guid.NewGuid()));

            if (toAll)
            {
                Assert.IsTrue(you.Has("Injured"));
                Assert.IsTrue(them.Has("Injured"));
            }
            else
            if (target == SystemArgsTarget.Aggressor)
            {
                Assert.IsTrue(you.Has("Injured"));
                Assert.IsFalse(them.Has("Injured"));
            }
            else
            if (target == SystemArgsTarget.Recipient)
            {
                Assert.IsFalse(you.Has("Injured"));
                Assert.IsTrue(them.Has("Injured"));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a reference to the <paramref name="target"/>
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public virtual IHasStats GetTarget(SystemArgsTarget target)
        {
            switch (target)
            {
            case SystemArgsTarget.Aggressor:
                return(AggressorIfAny ?? Recipient);

            case SystemArgsTarget.Recipient:
                return(Recipient);

            case SystemArgsTarget.Room:
                return(Room);

            case SystemArgsTarget.Owner:
                return(null);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 5
0
 public VariableCondition(string expression, SystemArgsTarget check) : base(check)
 {
     Expression = new ArithmeticComparisonExpression(expression);
 }
Exemplo n.º 6
0
 public Condition(SystemArgsTarget check)
 {
     Check = check;
 }
Exemplo n.º 7
0
 public Effect(SystemArgsTarget target)
 {
     Target = target;
 }
Exemplo n.º 8
0
 public SpawnEffect(string toSpawn, SystemArgsTarget target) : base(target)
 {
     ToSpawn = toSpawn;
 }
Exemplo n.º 9
0
 public HasCondition(string required, SystemArgsTarget check) : base(check)
 {
     Requirement = required;
 }
Exemplo n.º 10
0
 public KillEffect(string reason, SystemArgsTarget target) : base(target)
 {
     Reason = reason;
 }
Exemplo n.º 11
0
 public SetEffect(string expression, SystemArgsTarget target) : base(target)
 {
     Expression = new AssignmentExpression(expression);
 }