public ApplyEffect(ApplySystemBlueprint apply, SystemArgsTarget target) : base(target) { Identifier = apply.Identifier; Intensity = apply.Intensity; Name = apply.Name; All = apply.All; }
public override IHasStats GetTarget(SystemArgsTarget target) { if (target == SystemArgsTarget.Owner) { return(Action.Owner); } return(base.GetTarget(target)); }
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")); } }
/// <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(); } }
public VariableCondition(string expression, SystemArgsTarget check) : base(check) { Expression = new ArithmeticComparisonExpression(expression); }
public Condition(SystemArgsTarget check) { Check = check; }
public Effect(SystemArgsTarget target) { Target = target; }
public SpawnEffect(string toSpawn, SystemArgsTarget target) : base(target) { ToSpawn = toSpawn; }
public HasCondition(string required, SystemArgsTarget check) : base(check) { Requirement = required; }
public KillEffect(string reason, SystemArgsTarget target) : base(target) { Reason = reason; }
public SetEffect(string expression, SystemArgsTarget target) : base(target) { Expression = new AssignmentExpression(expression); }